Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Set RenderConfiguration flags when not drawing via ScriptableRenderContext.DrawRenderers

Discussion in 'Graphics Experimental Previews' started by szali, Oct 12, 2018.

  1. szali

    szali

    Joined:
    Jan 12, 2016
    Posts:
    17
    Hi,

    We have a custom render pipeline in development for our project. We have full custom shaders, but they take advantage of built-in indirect lighting shader constants (unity_SHAr, unity_SHAg, ..., unity_SpecCube0, unity_SpecCube0_HDR, ...).

    It is easy to utilize this when using ScriptableRenderContext.DrawRenderers, all you have to do is set
    RendererConfiguration.PerObjectReflectionProbes | RendererConfiguration.PerObjectLightProbe flags to the RendererConfiguration of the DrawRendererSettings structure passed to the DrawRenderers funcion, and the system sets these constants to the shader when rendering.

    In our project, some of our objects are not rendered by renderer components (MeshRenderer, SkinnedMeshRenderer, ...). Their mesh is drawn manually via CommandBuffer.DrawMesh or CommandBuffer.DrawMeshInstancedIndirect in a command buffer that is passed from our render pipeline. The lighting constants I mentioned above are still set when drawing manually in editor, but they are missing in build.

    Is there a way to ask the context to set these constants to a command buffer, so they can be expected in a shader when rendering manually? Or can I get these resources somehow, so I can set them manually?

    Thanks in advance,
    Gábor Szalóki
     
  2. szali

    szali

    Joined:
    Jan 12, 2016
    Posts:
    17
    Any idea?
     
  3. CianNoonan

    CianNoonan

    Joined:
    May 19, 2017
    Posts:
    139