PDA

View Full Version : uv mapping & fragment shaders



nyquist
02-24-2011, 09:28 AM
When a mesh with seams is unwrapped, a vertex may end up having multiple coordinates on the corresponding uv map. How do you pass that information into the fragment shader?

carsten neumann
02-24-2011, 12:30 PM
You need to have multiple vertices with the same position, but different texture coordinates.

Conceptually a vertex is a tuple of attributes, not just a position (which is just one attribute) and two vertices are different if they differ in one or more of their attributes. So two vertices that share the same position but have different texture coordinates are in fact two distinct vertices and both need to sent to the graphics card.

nyquist
02-24-2011, 01:09 PM
I was going down the road you suggest, but I was not sure if that was the way to go (because of the duplication). Thanks Carsten!