Search Unity

How to Make the Camera to Cull According to a Oblique Matrix?

Discussion in 'General Graphics' started by AhSai, Jun 24, 2020.

  1. AhSai

    AhSai

    Joined:
    Jun 25, 2017
    Posts:
    129
    I am making a reflection camera that is used for a flat water surface. I have successfully made the camera to render objects that are only above the water surface with:
    Code (CSharp):
    1. camera.CalculateObliqueMatrix()
    However, although objects that are under the water surface are not being rendered, they are still issuing draw calls when they are within the camera's frustum. I tried to set:
    Code (CSharp):
    1. camera.cullingMatrix = obliqueMatrix * camera.worldToCameraMatrix;
    but this doesn't work. How do you make the camera to calculate rather or not to issue draw call according to the new obliqueMatrix?
     
  2. TomGoethals

    TomGoethals

    Joined:
    Jan 29, 2022
    Posts:
    48