dx11 and texture projection...

David_Gallagher 102 Jan 14, 2012 at 22:48

I’m in the process of moving from dx9 to 11 and in my old shaders i was able to use tex2dproj to project a texture to a mesh. Does anyone know how this is now done in shader model 5? thanks for any hints in the right direction to go.

2 Replies

Please log in or register to post a reply.

Reedbeta 167 Jan 14, 2012 at 23:40

I don’t believe there is a specific function for projective texture lookup now. Instead, you must do the divide by w yourself and then do a regular sample.

// DX9
tex2Dproj(sampler, uvw);

// DX10/11
float2 uv = uvw.xy / uvw.w;
texture.Sample(sampler, uv);
David_Gallagher 102 Jan 15, 2012 at 00:32

That worked a treat! now I understand, I really appreciate the help with this, thank you!