Announcement

Collapse
No announcement yet.

Exclude Objects from SSR Reflection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Exclude Objects from SSR Reflection

    Hi everyone, We want to exclude certain objects from being visible in an SSR Reflection. For example we want to have our Hero Object to have SSR and reflect everything except the Background, so we need to exclude the Background from SSR.
    The only thing I can think of are Custom Depth Stencil and recombine Foreground/Heroobject and Background in a Postprocess Material after Tonemapping ?
    Any ideas if this could work or if there is an easier way ?
    Best Dominic


    #2
    usually excluding objects from SSR is not possible, because it's a screen-space effect and there is no information "behind" the object that you want to skip
    however excluding the background can actually be achieved. the SSR shader code performs traces in screen space using the depth buffer to then sample the result of the previous frame.
    manually modifying the SSR hlsl code, you can limit the screen-space traces to a maximum depth which will be interpreted as a failed trace. and like other failed traces (i.e. the screen borders) the shader will fall back to displaying the skylight's reflection cube.
    so in short, yes you can do it. but you need to modify the SSR hlsl code
    Follow me on Twitter!
    Developer of Elium - Prison Escape
    Local Image-Based Lighting for UE4

    Comment


      #3
      Hi Thanks for the info.
      I guess this will need an custom Engine to be able to change the SSR hlsl code ?

      Comment


        #4
        You can edit the shaders in the launcher version too.

        Comment


          #5
          Manoel.Neto Oh really, have you any links or buzz words to search for ?

          Comment


            #6
            https://docs.unrealengine.com/en-US/...ent/index.html

            Then go into the UE4 engine\shaders folder and hack around.

            Comment


              #7
              Is there a way to overwirte the SSR Shader on a Project basis ?

              Comment


                #8
                No, shaders are included as part of the engine version, not the project.

                Comment


                  #9
                  Is it possible to overwrite Shaders completley in a Project ?

                  Comment


                    #10
                    So i found that you have to add to the if condition in line 159, 217, 248 and 273 a check for the raylength, but i couldnt find the variable holding the RayCast length for this pixel.

                    anyone can help me out here ?

                    Comment


                      #11
                      So this is giving me some results:
                      Code:
                       
                       BRANCH if( HitUVzTime.w < 1 && HitUVzTime.z > 0.02 )
                      But I don't understand why we test for greater than ... isn't HitUVzTime.z the ray length, so it should be smaller than a certain length ?
                      And it of course takes the whole raylenghts from the Viewport and not from the Reflection surface. We want to archive that every reflection ray of our reflective surface longer than 10cm is not giving any SSRs. Is this even possible ?

                      Comment


                        #12
                        Now this would be a neat trick for say a game with Vampires or something :P

                        Comment

                        Working...
                        X