Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Renus

vertex shader m4x4 problem on tex coords

This topic is 5770 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

This is a funny one. I try to write a simple vertex shader that allows me to shift texture coordinates according to a given texture transformation matrix: ; v0 = Position ; v3 = Tex coords ; c10-c13 = tex coord transform matrix m4x4 oPos, v0, c0 m4x4 oT0.xy, v3, c10 but what happens, is that from the texture transformation just the rotation applied, i.e. no translation. To make sure that the vertex shaders registers are set properly, I tried mov oT0.xy, c13 which just copies the matrix translation (._41, ._42), and this works well. So it seems that m4x4 fails here?! I also tried m3x3 with accordingly changed matrix, also no success, both in software and hardware processing. Since I am close to losing my mind on this, any hint deeply enlights my mood again. - thomas

Share this post


Link to post
Share on other sites
Advertisement
Texturecoordinates are passed as (s,t,0,1), so set the fouth constant float, not third. Otherwise you are multiplying by 0...


Mike

Share this post


Link to post
Share on other sites
Yes, maybe thats the problem.
But how can I control the fourth constant?
I pass just s and t to my register v3:

DWORD decl[] =
{
...
D3DVSD_REG( 3, D3DVSDT_FLOAT2 ), // tex
...
};

Should I set .zw of my shader register then in my .vsh. like
mov oT0.zw, myRegister0001.zw ?


- thomas

Share this post


Link to post
Share on other sites
Ah, I got it. The vertex shader m4x4 implementation is different from the D3D matrix multiplication one. It lacks exactly the translations. So I have to add them in the shader.
Thanks, anyway!

- thomas

Share this post


Link to post
Share on other sites

  • 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!