• Advertisement

Archived

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

Generate tex coord from screen-space vertex position

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

I got a simple reflective plane (a horizontal mirror) working with render to texture and texture coordinate generation. But I don''t understand the tex coord generation completely. I got it working by trial and error. I use D3DTTFF_COUNT3 | D3DTTFF_PROJECTED for the D3DTSS_TEXTURETRANSFORMFLAGS, and set D3DTSS_TEXCOORDINDEX to D3DTSS_TCI_CAMERASPACEPOSITION. The texture matrix is set to a 0.5 translation and scaled by (inverse_screen_aspect_ratio * 1.205f). It works, but I have to use a viewport with the same aspect ratio as the frame buffer in my rendering to the texture. I loose memory and precision. I would like to use the complete texture (normal viewport), and thus have the screen-space vertex 0,0 give the tex coord 0,0. (and the screen-space vertex 799,599 give the tex coord 1,1). How can I do that? Thank you. ---------------- Blaster Computer game programmer and part time human being Strategy First - http://www.strategyfirst.com BlasterSoft - http://www.blastersoft.com

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement