Sign in to follow this  

Compute the texture coordinate based on object movement

This topic is 2100 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 just use a triangle with 3 vertices and texture coordinates. At frame t, the first vertex information is (x1, y1, z1) + (u1, v1), if I move it to the right 1 unit ( x1' = x1 + 1 ), so how can I recompute the texture coordinate?. Anybody helps me, please?

Share this post


Link to post
Share on other sites
Normally, the texture coordinate does not change as an object moves but I just want to get to color at the new texture positio for blending, it is similar to blending 2 colors from the last frame and the current frame

Share this post


Link to post
Share on other sites
I don't understand the exact problem although what you are after is totally doable.

Since you update your positions as you have showed, you'll just need to establish a relation between the texture coordinates and the positions. With the information you have provided, it isn't possible to deduce the relation you want to accomplish between the positions and texture coordinates.

Also, you haven't indicated if this is a technical problem such as "I don't know how to update the vertex buffer" or "I don't know how to calculate texture coordinates in vertex shader".

Otherwise, since you add a value to your vertex positions, can't you just add some value to your texture coordinates? Perhaps you could show a piece of code which handles the moving part?

Best regards!

Share this post


Link to post
Share on other sites
thank everyone for replying, I did it, I just rendered to a texture with UV position in frame t, then in next frame I just get UV position and obtain the color of that position with tex2D

Share this post


Link to post
Share on other sites

This topic is 2100 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this