Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

2 sides, 2 textures, 1 shader

Discussion in 'Shaders' started by iossif, Jul 9, 2012.

  1. iossif

    iossif

    Joined:
    Mar 4, 2011
    Posts:
    332
    i am interested in a shader that allows me to do the following:

    -) both sides of a plain should be visible (already done)
    -) should create shadow (already done)
    -) and also: i have a "front" and a "back" texture. can i also show 2 textures, one at the front, one at the back on a plan with a shader?

    somehow i fail to do point 3.

    thanks for your help.
     
  2. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,356
    Is there any reason you can't use two separate models with different materials for the front and back? This will probably be easier to manage in your game, and you won't have to write or use a special shader.
     
  3. robocognito

    robocognito

    Joined:
    Sep 25, 2010
    Posts:
    23
    You'd like to take two faces (the simplest plane), make it double-facing (normals draw to camera regardless of original orientation), but apply two different texture maps to these same two faces?

    Just asking for clarity.

    I can see the breakdown, you need to tell the shader to change the texture from front mode to back mode - there are no other faces to map the back texture to, you have to change the texture displayed for the entire model - depending on which side the camera is oriented towards. This seems feasible, just capturing the angle of the plane to the camera - 0-180 degrees would be front, 180-360 would be back... .


    I'm just starting to learn this stuff though, so I have no idea how you would begin to implement this. Good luck!
     
unityunity