Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

HLSL indexing issue

$
0
0

So, I wanted to add cascaded shadow maps just to allow some additional shadowing mode for directional lights. And here I hit a wall with HLSL.

This code is seemingly alright:

DirectionalLight dirLight = (DirectionalLight)lightsData[lightInput.id];


...


// Just for the check - assign red/green/blue/yellow color to each cascade (along with storing index)
float3 cascadeMul = float3(0.0f, 0.0f, 0.0f);
int cascadeID = -1;
if (posz < dirLight.cascadeShadowClip[0])
{
	cascadeID = 0;
	cascadeMul = float3(1.0f, 0.0f, 0.0f);
}
else if (posz < dirLight.cascadeShadowClip[1])
{
	cascadeID = 1;
	cascadeMul = float3(0.0f, 1.0f, 0.0f);
}
else …

Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>