Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Compute the texture coordinate based on object movement


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 steven166   Members   -  Reputation: 146

Like
0Likes
Like

Posted 16 April 2012 - 10:08 PM

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?

Sponsor:

#2 Álvaro   Members   -  Reputation: 5815

Like
0Likes
Like

Posted 16 April 2012 - 10:49 PM

Why would the texture coordinates of a vertex change when it moves?

#3 steven166   Members   -  Reputation: 146

Like
0Likes
Like

Posted 17 April 2012 - 12:04 AM

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

#4 kauna   Members   -  Reputation: 1132

Like
0Likes
Like

Posted 17 April 2012 - 04:12 AM

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!

#5 steven166   Members   -  Reputation: 146

Like
0Likes
Like

Posted 17 April 2012 - 11:00 PM

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




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS