Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 647
  • Last Modified:

Directx - Drawing Prmitives vs. Meshes (Lighting issues)

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
oxygen_728
Asked:
oxygen_728
1 Solution
 
nullmindCommented:
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
 
oxygen_728Author Commented:
thanks
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now