Search Unity

Problems with Standard Shader Fade rendering mode

Discussion in 'Shaders' started by kaffiene, May 8, 2015.

  1. kaffiene

    kaffiene

    Joined:
    May 26, 2013
    Posts:
    21
    Hi there

    I have a top down view on a house and I want the roof to transition from fully opaque to transparent as an agent enters the house. We thought we would get this working with the standard shader using the Fade rendering mode and the albedo set to some color. The color works fine in Opaque rendering mode but when we switch to Fade rendering mode, the roof goes to black. It does fade beautifully when I change the alpha value of the albedo parameter - exactly what I want EXCEPT that it's starting out as fully black and not the albedo color we've set.

    Any ideas?
     
  2. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    I think you'll have to give more details and perhaps a screenshot of your material as in a quick test I could not reproduce your issue.
     
  3. Jeff_B

    Jeff_B

    Joined:
    Mar 12, 2014
    Posts:
    5
    Just a bump to note that I'm experiencing a similar problem: using "fade" or "transparent" with the new Standard shader produces an effect like that of flipped normals. This is happening on an imported (FBX) model. "Opaque" works fine. Curiously, "fade" with Unity primitives works fine, too, so I'm suspecting something in FBX import. (I'm bringing in models from 3ds Max 2014).
     
  4. Jeff_B

    Jeff_B

    Joined:
    Mar 12, 2014
    Posts:
    5
    Changing the material on the temporary "block" buildings (the grey ones). This appears the same in Game View.
    unityFadeError_1.jpg unityFadeError_2.jpg
     
  5. Noisecrime

    Noisecrime

    Joined:
    Apr 7, 2010
    Posts:
    2,054
    I'd say you have a different problem from the OP. Looks to me as though most of your buildings are collapsed into a few single models/meshes instead of being individual. This means when using a transparent shader type you will suffer from draw order problems as real-time 3d engines rarely, if ever, sort per triangle. Instead they sort per model/mesh as sorting per polygon is usually unfeasible in terms of overall performance. In opaque rendering this doesn't matter as the depth buffer is used to ensure correct draw order at the pixel leve, but this cannot be used with transparent objects.

    Split you model into individual buildings and it should work fine with transparent shader.
     
  6. Jeff_B

    Jeff_B

    Joined:
    Mar 12, 2014
    Posts:
    5
    Well, son-of-a-- that did work!
    Many thanks, Noisecrime. I appreciate the explanation of what's happening in the engine, too. I'm coming to this from a "build whatever and just wait for the render" career (video animation), so it's good to get some education -- even if some of it does come the hard way (about 6 hours of it today)!
     
    Noisecrime likes this.
  7. kaffiene

    kaffiene

    Joined:
    May 26, 2013
    Posts:
    21
    I've added three images. roof_opaque.png is a Unity 5 standard shader with Opaque rendering mode - this renders with a reddish color as per the albedo setting. roof_fade_black.png is the same shader switched to Fade rendering mode with alpha = 255. It shows as fully black where we were expecting the same color as per roof_opaque. The shader does fade nicely when the alpha is adjusted as per roof_fade_alpha. Do those pictures adequately describe the issue?
     

    Attached Files: