Artistic Experiments
  • Home
  • Reel
  • Shaders
    • Stylized Shaders
    • Lighting Techniques
    • Shader Effects
    • Cubemaps
    • Pixel Lit Shaders (Basic)
    • Vertex Lit Shaders (Basic)
    • Unlit Shaders (Basic)
  • Tools
  • WIP
  • Contact

Simple Backface Masking - UDK

9/29/2011

0 Comments

 
A super quick material snippet for rendering one thing on the front faces of an object, and another thing on the back faces. Implemented in UDK.
Picture
It all starts with a 2 sided material. Go down to the Material tab in the Properties Bar and check 'Two Sided'. Next we need to get the direction of the camera compared to the surface. This is achieved with a 'Camera Vector' Node. We then need a 'Component Mask' to make sure it only outputs a Positive or Negative value. Set the 'Component Mask' to 'B' for this effect and plug it into the 'A' slot of an 'IF' node. Next, plug a 'Constant' set to '0' into slot 'B' of the 'IF' node. This creates a comparison that essentially means "Is the camera in front or behind the pixel being rendered". You can then plug in your texture inputs in (Front face textures get plugged into the "A>B" and "A=B", while back face textures get plugged into "A<B") and then plug the "IF" node into whatever input you need (Diffuse, Emissive, etc...). 

By creating more 'IF' nodes and connecting the inputs this way, you can completely change what is on either side of the object, which can be useful for stuff like water, which looks very different above and below the surface.
0 Comments



Leave a Reply.

    Graphs

    Shaders graphs for different effects

    Archives

    September 2012
    March 2012
    September 2011
    April 2011

    Categories

    All

    RSS Feed

Powered by Create your own unique website with customizable templates.