Can a GraphicItem use a material file?

FocusedWolfFocusedWolf Join Date: 2005-01-09 Member: 34258Members
Is it possible to give a GraphicItem a material file so that bloom/emissive effects can be used?

Comments

  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer
    If you mean a GUI graphical item then no.
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer
    I should mention that GUI Items can now use pixel shaders though. That is how the "wobbly" effect on the alien buy menu is done if you want to see an example. I think the shader code is compiled in the release builds though so I can post an example of that if needed.
  • FocusedWolfFocusedWolf Join Date: 2005-01-09 Member: 34258Members
    <!--quoteo(post=1857532:date=Jul 1 2011, 01:32 PM:name=MurphyIdiot)--><div class='quotetop'>QUOTE (MurphyIdiot @ Jul 1 2011, 01:32 PM) <a href="index.php?act=findpost&pid=1857532"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I should mention that GUI Items can now use pixel shaders though. That is how the "wobbly" effect on the alien buy menu is done if you want to see an example. <u>I think the shader code is compiled in the release builds though so I can post an example of that if needed</u>.<!--QuoteEnd--></div><!--QuoteEEnd-->

    An example of uncompiled shader code? Hmm something i've never dealt with before, but i'll still accept the example if it's no trouble.
  • MurphyIdiotMurphyIdiot NS2 programmer Join Date: 2008-04-17 Member: 64095Members, Super Administrators, NS2 Developer, Subnautica Developer, Pistachionauts, Future Perfect Developer
    edited July 2011
    Here is how the wavy effect is done.

    <!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1--><shader>
        
        <inputs>
            <input name="baseTexture"   type="texture" address="wrap" />
        </inputs>
        
        <code>
        
            void MaterialShader(bool textured, float2 texCoord, float4 color, inout Material material)
            {
                
                float wavyAmount = 1;
                float2 resultCoord = texCoord;
                resultCoord.x += ((sin((resultCoord.y + cos(time)) * wavyAmount * 10) * 0.002 + 0.002) / (1.0 + 2 * 0.002)) * resultCoord.y;
                resultCoord.y += ((sin((resultCoord.x + cos(time - 0.5)) * wavyAmount * 10) * 0.002 + 0.002) / (1.0 + 2 * 0.002)) * resultCoord.x;
                material.resultColor = tex2D(baseTexture, resultCoord) * color;

            }
            
        </code>

    </shader><!--c2--></div><!--ec2-->

    That is GUIWavyNoMask.surface_shader inside the shaders directory. It is compiled in the release build but the game will compile it if it is plain text like this.

    BTW, if anyone wants to improve this effect I'll be watching this thread ;)
Sign In or Register to comment.