Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Render geometry to texture

Started by 51mon Sep 13, 2006 at 5:45 AM 1 replies 600+ views
Original Post
51mon
51mon
I am rendering position and normal from geometry to 2D textures. I do this by assigning uv-values to all vertex by an algorithm (pre-process), then the uv-coordinates transform the geometry from 3D to 2D: Output.Position.xy = vTexCoord1.xy; Output.Position.zw = float2(1.0f,1.0f);) Since I want to render all geometry I turn off clipping and culling. But there I got a problem. The polygons that lay on the seam and should be on the backside and not be seen is shining thru on part of the map. Here is a pic of the normal map of a cylinder (slightly deformed): The pic at the top is errorous as you can see. The only way to come around this that I have came to think of is to have an alternative index buffer that is used when render to the textures. The alternative buffer lose the naughty polygons. I'm looking for a more convenient way to solve this problem. By the way does anyone know what this technique is caled, it is a bit similar to light mapping?
DonnieDarko
DonnieDarko
I don't understand how you get overlapping polygons when rendering the mesh in texture space - that somehow suggests that the atlas texture coordinates are wrong.

Also, remeber to flip the y axis when going from texture coordinates to screen coordinates (it seems that you are not doing this atm).
51mon
51mon
Quote:
Original post by DonnieDarko
I don't understand how you get overlapping polygons when rendering the mesh in texture space - that somehow suggests that the atlas texture coordinates are wrong.

To be honest I don't really get that either. But I guess since the polygons all have the same depth (1.0f) the hardware can't handle it right.


Quote:
Original post by DonnieDarko
Also, remeber to flip the y axis when going from texture coordinates to screen coordinates (it seems that you are not doing this atm).

Are you sure? I uv-map the mesh in a pre-process so it fit the projection space ((-1.0f,-1.0f,0.0f), (1.0f,1.0f,1.0f)).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.