Jump to content
  • Advertisement
Sign in to follow this  
treeway

Vertex Shader Question

This topic is 4345 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi Im working on my effect class. When i make a shader in Rendermonkey e.g. this code from my skybox

   Out.Pos = mul(matWorld, float4(Input.Pos.xyz + view_position.xyz, 1));

where the matWorld is the WorldViewProjection matrix. this positions the skybox around the camera. okay. but when i exprot the effect, I have to swap over the code so that its:

   Out.Pos = mul(float4(Input.Pos.xyz + view_position.xyz, 1)matWorld);

The way i bind the matricies in my effect class is as follows

matrix = worldMatrix; 
D3DXMatrixMultiply(matrix,matrix,viewMatrix);
D3DXMatrixMultiply(matrix,matrix,projectionMatrix);

pEffect->SetMatrix(currentSemantic->name,matrix);
alright it works fine as long as i swap over the order of the world matrix in the shader before using it, but this means that i have to do that every time i export an effect. Does anyone know the reason why this would be the case? thanks

Share this post


Link to post
Share on other sites
Advertisement
This is all todo with whether you matrices are column-major or row-order. Its compile option in the HLSL compiler. If your implementation does not match what the FX expects you either have to transpose your matrices before you send to the shader (an unnessacary expense) or swap the order you do your matrix multiply.

I don't know about rendermonkey but Nvidia FX composer has an option to swap row/column order.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!