View previous topic :: View next topic |
Author |
Message |
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
|
Back to top |
|
|
granada Team member
Joined: 07 Aug 2004 Posts: 1955 Location: England
|
Posted: Sat Mar 12, 2005 5:20 pm Post subject: |
|
|
I like it ,it looks like you hard work is paying off.
dave _________________ AMD Phenom(tm)IIx6 1090t Processor 3.20 GHS
8.00 GB memory
Windows 7 64 bit
Nvida Geforce GTX 580 |
|
Back to top |
|
|
Jeroen Site Admin
Joined: 07 Aug 2004 Posts: 5332 Location: The Netherlands
|
Posted: Sat Mar 12, 2005 9:26 pm Post subject: |
|
|
Looks very nice indeed, it has a realistich atmosphere. Do post more! |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 8:17 am Post subject: |
|
|
Did you guys get the mail I sent out to you about this yesterday? |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 9:42 am Post subject: |
|
|
I had a lot of trouble with my face normals yesterday. I finally got them to face the right way by negating all of them. I'm not sure if I'm doing something wrong, or if the vertices are wound in the wrong order in the dmf files.
Code: |
void c_mapobj::CreateFaceNormals(void)
{
vector3 v1, v2;
for (int i = 0; i < NumTriangles; ++i)
{
v1 = (vtx[tri[i].vtx[1]] - vtx[tri[i].vtx[0]]);
v2 = (vtx[tri[i].vtx[2]] - vtx[tri[i].vtx[0]]);
tri[i].vNorm.x = v1.y * v2.z - v1.z * v2.y;
tri[i].vNorm.y = v1.z * v2.x - v1.x * v2.z;
tri[i].vNorm.z = v1.x * v2.y - v1.y * v2.x;
//tri[i].vNorm = v1.CrossProduct(v2);
tri[i].vNorm.Negate();
}
return;
} |
|
|
Back to top |
|
|
Mr.Fletcher DeleD PRO user
Joined: 07 Aug 2004 Posts: 1772 Location: Germany
|
Posted: Sun Mar 13, 2005 10:34 am Post subject: |
|
|
You need to normalize the normals after doing the cross product. Well, you don't really need to, but it should be normalized for OpenGL-Lighting, etc. _________________ Behold! The DeleD Wiki! Please help us expanding it
DeleD on IRC |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 10:36 am Post subject: |
|
|
I was normalizing them too. But then they get messed up again. So I removed my vNorm.Normalize() line, and did it by hand... and still the wrong results...
So I just turn on glEnable(GL_NORMALIZE); and it's working for now. Something I will solve later. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Mar 13, 2005 11:12 am Post subject: |
|
|
Cool screenshots! And I think you are right about the floor, at least make it it a little more low-contrast (white less white, black less black) and add some scratches. Other then that, very(!) interesting project!
About the winding, DeleD uses clockwise winding for front facing polygons. If you use OpenGL, glFrontFace(GL_CW) will do the trick. If you prefer to use counter-clockwise winding in your project, simply reverse the winding when loading in the polygons.
Even though the OpenGL default is CCW frontfacing, I wouldn't exactly call CW 'wrong'. That makes just as much sense as calling either LHS or RHS wrong. |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 11:16 am Post subject: |
|
|
I didn't mean to imply that it was wrong. But I figured you would use ccw with Deled since it's done with OpenGL.... is this written anywhere?
How do I make them ccw? Do I just reverse v3, v2 and v1?
I may change the floor to blue carpet.. right now working on bottle textures for the bar shelf.. and something for a fireplace. The floor texture did have some variation in it. It was subtle and Deled's texturing filtering options is smoothing it all out. |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 12:58 pm Post subject: |
|
|
Here's today's progress. After spending some time on google images, I found a nice fireplace to model my own after. I'm still only at 702 polygons, and that's only because I haven't deleted the un-needed faces. I think the back shelf needs work.
|
|
Back to top |
|
|
granada Team member
Joined: 07 Aug 2004 Posts: 1955 Location: England
|
Posted: Sun Mar 13, 2005 1:48 pm Post subject: |
|
|
Better all the time Nice one
dave _________________ AMD Phenom(tm)IIx6 1090t Processor 3.20 GHS
8.00 GB memory
Windows 7 64 bit
Nvida Geforce GTX 580 |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 2:28 pm Post subject: |
|
|
Thanks granada.
I solved the winding problem by storing the indices in reverse as I read them in. I guess sometimes, some things ARE THAT EASY! No more negation. But even through I normalize manually as I create the normals, I still have to enable GL_NORMALIZE for everything to light properly. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Mar 13, 2005 3:26 pm Post subject: |
|
|
Cool, love the new screenshot! (although the lighting really looks like it is rendered by Lite I would suggest making the shadows a bit less opaque)
Quote: |
is this written anywhere? |
Nope, you got us there With all the other things going on, there seems to be never enough time for thorough documentation. Then again, I did notice how none of the other fileformats I wrote importers/exporters for ever had the winding specified in the docs. It was usually a trial-and-error thing (hey, my polies are facing the wrong way, let's reverse the order of the vertices/vertex indices)
About the normalization, what exactly is wrong with your normals then? Still negated? When solving these problems, it can really help to make your normals visible (by drawing lines from face centers (or corner vertices) in the direction of the normal), usually provides a lot of insight. |
|
Back to top |
|
|
Paul-Jan Site Admin
Joined: 08 Aug 2004 Posts: 3066 Location: Lage Zwaluwe
|
Posted: Sun Mar 13, 2005 3:36 pm Post subject: |
|
|
Just noticed how you wrote "I was normalizing them too. But then they get messed up again". That suggests a bug in your normalization code, if you could post/mail it we could have a look.
The normal-generation posted above looks ok, although if you really need to negate the vector you could simply reverse the arguments in the initial 2 edge-vector subtractions instead of negating the whole thing in the end. |
|
Back to top |
|
|
Daaark DeleD PRO user
Joined: 01 Sep 2004 Posts: 2696 Location: Ottawa, Canada
|
Posted: Sun Mar 13, 2005 3:49 pm Post subject: |
|
|
I don't have to negate them now, as I reversed the winding back to CCW by reading the indices in 3,2,1 instead of 1,2,3. (as posted above^^^)
Code: |
//normalize the vector
void vector3::Normalize(void)
{
float s = sqrt((x * x) + (y * y) + (z * z));
x *= s; y *= s; z *= s;
return;
} |
THERE WE GO!
FIXED
Code: |
//normalize the vector
void vector3::Normalize(void)
{
float s = sqrt((x * x) + (y * y) + (z * z));
x /*= s; y /*= s; z /= s;
return;
} |
|
|
Back to top |
|
|
|