Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cookies #12

Open
fznmeatpopsicle opened this issue Aug 21, 2016 · 6 comments
Open

Cookies #12

fznmeatpopsicle opened this issue Aug 21, 2016 · 6 comments

Comments

@fznmeatpopsicle
Copy link

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.

@betavr
Copy link

betavr commented Sep 12, 2016

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

@fznmeatpopsicle
Copy link
Author

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)

@betavr
Copy link

betavr commented Sep 12, 2016

You can try to add this line to the top of the file, below g_tOverrideLightmap:

sampler3D g_tVrLightCookieTexture;

@fznmeatpopsicle
Copy link
Author

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.

@betavr
Copy link

betavr commented Sep 12, 2016

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.

@fznmeatpopsicle
Copy link
Author

Ah, I see. Thanks for trying.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants