Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Help with Shadow Mapping and Multi-Texturing


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
23 replies to this topic

#21 Terin   Members   -  Reputation: 192

Like
0Likes
Like

Posted 27 July 2012 - 07:35 AM

Some **are** negative...

How do I identify what the correct order is? Is there a good URL or site that explains what the order is -- because for what I thought, it was all the same, so long as you take three points in a triangle.

EDIT:

I revisited a few things and saw that a "Front" face is defined (by default) as going COUNTER clockwise (unless you change it). I reversed the order of my points for the triangles that were always rendering funky, so that they were counter-clockwise (one triangle of the quad was counter-clockwise, the other was clockwise).

That seems to have fixed everything! Oy! I *never* read/learned anything about this stuff before even in formal education.

Edited by Terin, 27 July 2012 - 07:51 AM.


Sponsor:

#22 dpadam450   Members   -  Reputation: 934

Like
1Likes
Like

Posted 27 July 2012 - 08:29 AM

Look up cross product right hand rule. The order of the two vectors matters.

#23 Terin   Members   -  Reputation: 192

Like
0Likes
Like

Posted 01 August 2012 - 01:11 PM

That fixed it! Thank you. Now, to try and solve other problems and get this all working together. :-)

#24 Terin   Members   -  Reputation: 192

Like
0Likes
Like

Posted 04 August 2012 - 08:56 AM

OK, so I've been working on my engine some more and I'm having an issue when calculating the face normals. I've seen a lot of different methods online about calculating the subtraction between vertices in a triangle. The most common appears to be B - A = Vector 1; C - A = Vector 2; Then cross-product the two vectors and you have your face normal.

So, say I have two triangles that compose a tile that is used. The triangles form a triangle mesh in the form of:

AD
BC

Wherein ABC is the first triangle and CDA is the second triangle.

When I run through the calculations to do the face normal of ABC, the vector appears to be in the wrong direction. My directional light is at 0,0,1; the normal is at 0,0,-1 for a flat face (or in the negative Z axis, in general). I was using B - A and C - A; Then I figured it should be B - A and B - C to calculate the correct direction -- and indeed, my face normal goes to +Z.

Is this the correct order to do it? I've googled and haven't found a very good explanation on what the correct order is -- very few sites actually draw it out cleanly to explain which order one should do it in -- they just throw in Spaghetti code (which I'm guilty of copying) to do the basic B - A and C - A -- which was totally wrong.

EDIT: And now I see another topic a little further down that suggest A - B and C - B, wherein B is the common shared point between the two in the triangle... Which again, works to some degree.

At this point, I think I may have my light being setup incorrectly -- which sucks, but it's good to know that my Light is just wrong (so I can fix it). Once I know the correct order, I can proceed, I think, to building this correctly.

Thoughts?

Edited by Terin, 04 August 2012 - 09:07 AM.





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