Skip to main content
gamedev.net
🔒 Locked

about SphereMapping Texcoord

Started by zny 1 reply 800+ views
Original Post
zny
zny
this is the calcuate sphere mapping uv code In Vertex Shader: the algorithm of calculate uv is from the DirectX SDK. float3x3 mat=ViewITXf; //ViewInverseTranspose matrix float3 n=mul(IN.Norma,mat); n=mul(n,float3(0.5,0.5,1.0))+float3(0.5,0.5,0); OUT.UV = n.xy; it seems there are something wrong from the result of FX Composer.
Jroggy
Jroggy
I can't remember if FX Composer uses row major or column major matricies.. but try switching your matrix multiplications around, like so:
float3x3 mat=ViewITXf; //ViewInverseTranspose matrixfloat3 n=mul(mat,IN.Norma);n=mul(float3(0.5,0.5,1.0),n)+float3(0.5,0.5,0);OUT.UV = n.xy;

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.