Compute the texture coordinate based on object movement
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?
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
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!
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!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement