Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

This is a guess, but it looks like all of your normals are... well, weird. :)

 

Normally a normal is a unit vector (dot product is 1). You've got some normals defined as (-5, 0, 0) which is odd. Since the only geometry I see is a cube (12 triangles), your normals are very likely to be either (1, 0, 0) or (0, 1, 0) or (0, 0, 1). Other normals (something like (0.2, 0.4, 0.1)) are generally created by a 3d Drawing program.

 

When the normal is off, the lighting calculations built into Direct3D behave oddly, including making things too dark or too light or just not having the light blend across a surface quite right (compared to what's expected - the math is working right).

 

I noticed that in loadGeometry, you also define 3 vectors: v0, v1, v2, and v3. They're used in calls to PositionNormalTextured as both the position AND normal vector. I think you'll probably want only one vector for the normal. The position vector can change according to the position you need (I didn't check your code for accuracy on position though the cube does draw).

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Well, I think I maked out why it my self, it was becurse the light was "in" the wall, so sometime it get on the one side, and some time om the other side :-\

 

But, U are talking about the normal, i realy dont understand this, can U descripe them to me, or give some link where to read of it?

  • *Experts*
Posted

A normal is a common graphics term, you can read more on MANY websites on 3D graphics.

 

Basically, there are vertex normals and polygon normals. The kind you're using are polygon normals. Since you're polygons are always simple triangles and they're all facing at very standard angles (all at right angles from each other), you can use a normal that always points in a particular direction (straight up, down, left, right, into the screen or out of the screen). The DX help has some pictures to help explain what a normal is and also contains a lot of info on how DX uses them to calculate lights.

 

-Ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...