Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

New Standard Terrain Shader does not support deferred mode.

Discussion in 'Unity 5 Pre-order Beta' started by kite3h, Feb 7, 2015.

  1. kite3h

    kite3h

    Joined:
    Aug 27, 2012
    Posts:
    192
    "
    // As we can't blend normals in g-buffer, this shader will not work in standard deferred path.
    // So we use exclude_path:deferred to force it to only use the forward path.
    " in shader sources.

    oops.

    How about performace of forward terrain shader in deferred mode?
    In fact, terrain is not a necessary in deferred mode.
     
  2. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    When you remove the exclude path tag it just works fine.
    I couldn't understand that as well. But it makes sense.

    The problem is when you start to have more than 4 textures. This requires another rendering pass and in deferred mode there is a problem with the blending of the normals.
    I am sure they are going to fix this. If not, you have to use up to 4 textures to use the terrain without any artefacts in deferred mode.

    The forward pass wouldn't that bad if you just use a sunlight. But when you want lots of lights in your scene and shadows of spotlights then deferred rendering is a must.
     
    Last edited: Feb 9, 2015
  3. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    169
    Yes like EyecyArt said the format of the render target for normal vectors are not blendable thus can't be used for terrains that have more than 4 layers. If your terrain doesn't use more than 4 layers and your scene has lots of lights and shadows then you probably can modify the built-in terrain shader to include the deferred path.
     
  4. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    So it is basically possible but the normals are compressed or in a "bad" format only?
     
  5. zeroyao

    zeroyao

    Unity Technologies

    Joined:
    Mar 28, 2013
    Posts:
    169
    For most cases we use A2R10G10B10 format for normal render target. It is an unsigned format so we have to do "*0.5f+0.5f" conversion, and there is no common way to do blending of such encoded normals.
     
  6. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Is this something you plan on fixing or will it always be like this? Seems like a pretty big limitation.