Solved

# Directx - Drawing Prmitives vs. Meshes  (Lighting issues)

Posted on 2006-05-23
643 Views
If I draw a primitive (triangle strip for example) with vertices setup with this FVF:

#define SIMPLE_FVF (D3DFVF_XYZ|D3DFVF_DIFFUSE)

I understand that I can expect no shadowing whatsoever even if lighting is turned on.

This is because there are no normals in this FVF, correct?
- Or do normals even go in the FVF?
- Would I have a normal vector?

When I'm drawing a mesh (.X), normals are calculated for every triangle (if I remember correctly).
- Therefore, I can create a directional light source (like the sun) and pretty shadows will appear
- Even if the vertices have only colors & positions, shadows will appear
- By shadows I mean brigter and darker triangles corresponding to their angle to the light source
- Am I correct here ?

I'm a bit rusty on this directx stuff, it's been a while for me.

I'm trying to nail this stuff down in my brain so that I can proceed with more complicated stuff.

Thanks

0
Question by:oxygen_728

LVL 1

Accepted Solution

I'm not developing in C++, and I'm using C# with the DirectX 10 SDK. If you create a mesh with the FVF that doesn't have normals, calling a D3DX method that computes normals will throw an exception. If you create a mesh with normals you can specify the vertex information (ommiting the vertex normal vectors) and later call the D3DX compute normals method.

Triangles without normals will only use the material diffuse color *even with lighting enabled*. I tested this on my hardware device AND the reference device. To have any lighting you need vertex normals.

Cheers,
Kris
0

Author Comment

thanks
0

## Featured Post

Artificial Intelligence comes in many forms, and for game developers, Path-Finding is an important ability for making an NPC (Non-Playable Character) maneuver through terrain.  A* is a particularly easy way to approach it.  I’ll start with the algor…
As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…