I am trying to access the _LightMatrix0 in a forward base pass to calculate some light point of view coordinate but it seems that the _LightMatrix0 is empty with directional light. Any idea how can I solve this and how could I access to the _LightMatrix0 with directional light (without cookies) ? I am trying to do this kind of thing. Code (CSharp): float4 position = mul(_LightMatrix0, worldPos);
In this specific case, I can imagine you just manually set the matrix of the main directional light as global variable. With this specific case I mean that is intended for a forward base pass. For a more generic approach in deferred rendering you'd have to create a custom light shader and execute it using a commandbuffer. But that all depends on what you want to do with it. For a more specific solution, I'll need to know why exactly you want to calculate the position of the surface from the view of the main directional light.
Thanks for you answer @jvo3dc, I am trying to calculate transmittance using the directional light depth map/shadow map. That's why I am trying to access this matrix. The problem is that directional lights are computed in screen space so I need to access two things : The directional light depth map before it is computed in screen space as Aras explained in this thread : http://forum.unity3d.com/threads/un...ordinates-and-stuff-shader-pro-needed.376875/ and the directional light matrix to compute the position. Then I'll be able to get the transmittance but the Unity pipeline doesn't ease the pain of doing that If you have some advice, I'll be glad to read them.
Did you look at the atmospheric scattering package that aras mentioned? There seem to be some shaders in there that could lead as an example.
Yes, I found a way to access the depth map, I think, because I can't test for the moment, but there nothing about the matrix.