the_lab_renderer
the_lab_renderer copied to clipboard
Cookies
Supporting light cookies with a Valve Realtime Light would be a nice addition, unless there's currently a way to do it and I'm missing it.
Have you tried uncommenting this section in the shader?
//[branch] if ( g_vLightShadowIndex_vLightParams[ i ].y != 0 ) // If has a light cookie
//{
// // Light cookie
// float4 vPositionTextureSpace = mul( float4( vPositionWs.xyz, 1.0 ), g_matWorldToLightCookie[ i ] );
// vPositionTextureSpace.xyz /= vPositionTextureSpace.w;
// vSpotAtten.rgb = Tex3DLevel( g_tVrLightCookieTexture, vPositionTextureSpace.xyz, 0.0 ).rgb;
//}
https://github.com/ValveSoftware/the_lab_renderer/blob/master/Assets/TheLabRenderer/Shaders/vr_lighting.cginc#L320-L326
Okay, I just tried that now, and all I get is everything going pink, and the following errors:
Shader error in 'Valve/vr_standard': undeclared identifier 'g_tVrLightCookieTexture' at Assets/TheLabRenderer/Shaders/vr_lighting.cginc(325) (on d3d11)
Shader error in 'Valve/vr_photogrammetry': undeclared identifier 'g_tVrLightCookieTexture' at Assets/TheLabRenderer/Shaders/vr_lighting.cginc(325) (on d3d11)
You can try to add this line to the top of the file, below g_tOverrideLightmap:
sampler3D g_tVrLightCookieTexture;
Now it's just giving the same errors, but with "Tex3DLevel" instead. I tried the same thing as your last suggestion, and it's saying 'Tex3DLevel': identifier represents a variable, not a function.
Tex3DLevel is probably a macro similar to Tex2DLevel, which is defined at the beginning of the shader:
#define Tex2DLevel( name, uv, flLevel ) name.SampleLevel( sampler##name, ( uv ).xy, flLevel )
But anyway after looking at the code a little more, I think ValveCamera.cs is also missing important stuff.
Ah, I see. Thanks for trying.