Vertex Normals Issue
I have a model that's uv mapped in two halves. Currently I'm loading it in my Opengl program and rendering it with averaged vertex normals, which I pre-compute myself.
Before loading, in my 3d modelling package, I'm having to unweld the mesh at the uv seams to prevent uv distortion. This messes up my smooth normals along the seam edges because of the duplicate vertices.
This is my problem, what's the best way to solve this?
July 19, 2004 02:10 AM
I don't know anything about uv distortion or whatever, but here is a general rule: vertices that have identical coordinates are actually the same vertice & they should also have identical normals. So even though an edge vertice has the "average normal" for its half... when you combine the halves, you have to create a new average, that includes the other half.
make sense?
make sense?
Hi, thanks for helping.
I'm stuck on the way to combine the duplicate vertices though... any insights appreciated.
I'm stuck on the way to combine the duplicate vertices though... any insights appreciated.
When u unweld the vertices, give them the same normal as it was before it was unwelded.
Or you can take the average of the 2 new normals and get your smooth normal. Make sure both vertices use the same normal.
Or you can take the average of the 2 new normals and get your smooth normal. Make sure both vertices use the same normal.
"When u unweld the vertices, give them the same normal as it was before it was unwelded."
Yes, that would make sense, but I'm unwelding the verts in a 3d modeling app, not in my engine, the normals I generate are based on the unwelded mesh.
"Or you can take the average of the 2 new normals and get your smooth normal. Make sure both vertices use the same normal."
I could try averaging the duplicate edge normals, but I'd still be wasting storage space with duplicate vertices, uv's etc. I'm finding the logic to combine the verts confusing... that's where I need advice. Thanks so far.
Yes, that would make sense, but I'm unwelding the verts in a 3d modeling app, not in my engine, the normals I generate are based on the unwelded mesh.
"Or you can take the average of the 2 new normals and get your smooth normal. Make sure both vertices use the same normal."
I could try averaging the duplicate edge normals, but I'd still be wasting storage space with duplicate vertices, uv's etc. I'm finding the logic to combine the verts confusing... that's where I need advice. Thanks so far.
July 19, 2004 04:25 PM
ah ha, so you are "welding" these 2 halves in your 3D modeling ap, then this is not the place to be seeking help for combining your common vertices... you need to consult a help board for your 3d modelling app. If its a common one, you might be lucky if you ask in here, what is the app & what types of files are you loading? 3DS perhaps?
No that's incorrect. I'm not after advice for 3d modelling. Basically I'm looking for coding help on combining vertices (AKA welding). The main problem areas are once you find the duplicate verts, how then to correctly combine them by removing duplicates, re-organising the vertices data list, handling uv's, and updating the face indices so everything looks as it should.
Psuedo c code:
for( i < total_verts )
for( j+1 < total_verts )
{
if ( vert == vert[j] )
{
Combine ( vert , vert[j] );
Update faceindexlist;
}
}
Psuedo c code:
for( i < total_verts )
for( j+1 < total_verts )
{
if ( vert == vert[j] )
{
Combine ( vert , vert[j] );
Update faceindexlist;
}
}
July 20, 2004 09:47 AM
I think I understand now, & GamerSG is right. You have 2 options:
Don't change the normals on the edges after you split the model into 2 models.
or
Find the shared vertices on the seam edges & make the normal for them the average of those 2 vertex normals.
Basically... if you average the normals & they look good... don't change them after you split the model.
Don't change the normals on the edges after you split the model into 2 models.
or
Find the shared vertices on the seam edges & make the normal for them the average of those 2 vertex normals.
Basically... if you average the normals & they look good... don't change them after you split the model.
Thanks, but the vertex normals are no longer an issue. I can re-calculate them once I've worked out how to stitch the mesh together in code. I need help with combining the vertices as mentioned in my previous post. Here it is again for clarity:
Basically I'm looking for coding help on combining vertices (AKA welding). The main problem areas are once you find the duplicate verts, how then to correctly combine them by removing duplicates, re-organising the vertices data list, handling uv's, and updating the face indices so everything looks as it should.
Pseudo c code:
for( i < total_verts )
for( j+1 < total_verts )
{
if ( vert == vert[j] )
{
Combine ( vert , vert[j] );
Update faceindexlist;
}
}
Basically I'm looking for coding help on combining vertices (AKA welding). The main problem areas are once you find the duplicate verts, how then to correctly combine them by removing duplicates, re-organising the vertices data list, handling uv's, and updating the face indices so everything looks as it should.
Pseudo c code:
for( i < total_verts )
for( j+1 < total_verts )
{
if ( vert == vert[j] )
{
Combine ( vert , vert[j] );
Update faceindexlist;
}
}
July 20, 2004 12:28 PM
We'll have to see a lot more than that snipett of code to help out with what you request. Do you write your own vertex, face, & uv code? I was gonna ask if you write your own classes... but it seems you like C code. How is everything structured?
Are faces registered with every vertice they are made of?
Vertices of a face are of course registered with that face, right?
It would be nice if you had some data structure that allowed you to subscribe vertices & faces with each other, then this solution would just fall into place.
Are faces registered with every vertice they are made of?
Vertices of a face are of course registered with that face, right?
It would be nice if you had some data structure that allowed you to subscribe vertices & faces with each other, then this solution would just fall into place.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement