Jump to content
  • Advertisement
Sign in to follow this  
simotix

Project texturing issue

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

Quote:
Original post by Shael
Quote:
Original post by simotix
Maybe I am not explaining it correctly, but I do not understand what is going on here

*** Source Snippet Removed ***

That is my main concern, understanding that code. I do not understand why those values were chosen, what they are doing there and how they can be defined. That is what I am looking to be answered.


Those values are simply the position of the "light" that is projecting the texture. Try to think of projective texturing as if it were a film projector projecting a film onto a canvas. You need to specify the position of this projector, the direction it will project images, and its field of view.

Theres no reason why you can't change those values (60,90,0), they simply define the projector to be 60 units to the right and 90 units up from the origin, and the origin is the position the projector is facing to place the projected image.

One thing to note, make sure "objectTransform" is the identity matrix.


I did make the light values to (0, -2, 0) for it to be above it. But what do you mean make sure objectTransform is the identity matrix? I currently move its position, then rotate it. Is that wrong?

Share this post


Link to post
Share on other sites
Advertisement
Does anyone know what the issue may be? Surely somebody has read this chapter before, or may know the issue I am encountering.

Share this post


Link to post
Share on other sites
HAha what is that :)

Anyway, if you have not yet understood what D3DXMatrixLookAtLH and D3DXMatrixPerspectiveFovLH do, maybe you should start with something simpler than Projective Texture Mapping. Like setting a camera and move it around the scene.

I've learnt projective TMap while studying shadow maps. Things are not so difficul as they seem. Basically:
- for each pixel, obtain its screen space position
- by means of a matrix mul, compute its light space position
- project that pixel using the light projection matrix
- now you have clip space coordinates. Convert those to texture space coordinates ( * 0.5 + 0.5)
- now you can access to your goddamned texture :)

(stop pasting thousand of lines of code...)

Share this post


Link to post
Share on other sites
Quote:
Original post by NiGoea
HAha what is that :)

Anyway, if you have not yet understood what D3DXMatrixLookAtLH and D3DXMatrixPerspectiveFovLH do, maybe you should start with something simpler than Projective Texture Mapping. Like setting a camera and move it around the scene.

I've learnt projective TMap while studying shadow maps. Things are not so difficul as they seem. Basically:
- for each pixel, obtain its screen space position
- by means of a matrix mul, compute its light space position
- project that pixel using the light projection matrix
- now you have clip space coordinates. Convert those to texture space coordinates ( * 0.5 + 0.5)
- now you can access to your goddamned texture :)

(stop pasting thousand of lines of code...)



I do understand D3DXMatrixLookAtLH and D3DXMatrixPerspectiveFovLH, however, the problem is I do not understand what the problem is currently with the rest of the code. Everything "looks correct".

I am basically do exactly what you do

I am not pasting thousands of lines of code, I posted around ~250 which is exactly the code I am using to test. I was hoping that someone would load it into a file and also try testing. However, it has been a month later and nobody seems willing to help.

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!