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

Inverted z axis in specular reflection

$
0
0

Hello,

I have a problem regarding z axis direction when presenting specular IBL. Notice that z direction is inverted and image presented to user is alongside his view.

Specular IBL - wrong direction
float4 main(PixelInputType input) : SV_TARGET
{	
	input.normal = normalize(input.normal);
	input.tangent = normalize(input.tangent);
	input.binormal = normalize(input.binormal);

	float3x3 TBN = transpose(float3x3(input.tangent, input.binormal, input.normal));
	float3 N = normalTexture.Sample(baseSampler, input.uv).rgb * 2.0 - 1.0;
	N = normalize(mul(TBN, N));

	const float3 V = normalize(input.viewDir.xyz);
	const float NoV = abs(dot(N, V)) + 0.0001f; //avoid artifact - as in Frostbite …

Viewing all articles
Browse latest Browse all 17625

Trending Articles



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