Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

rileyriley

does D3DXCreateSphere generate normals?

This topic is 5423 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I want to render a sphere. However, D3DXCreateSphere creates a mesh that is in the wrong FVF for my rendering code. So, I use: D3DXCreateSphere(d3dDevice, 0.5, 20, 10, &tempMesh, NULL); tempMesh->CloneMeshFVF(NULL, D3D9POSCOLORVERTEX_FVF, d3dDevice, &tempMesh2); where D3D9POSCOLORVERTEX_FVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE. This is the FVF all of my scene uses. The trouble is that I get a black, unlit circle! I am assuming that the normal values are either getting lost in the conversion or are never generated - other objects in my scene with their normals set properly are lit just fine. Does anyone know of a way to extract the normals easily? Or will I have to calculate them myself? Thanks for any help! riley Edit: PS: I'm using DX9 [edited by - rileyriley on February 5, 2004 8:26:46 PM]

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Without consulting the docs, I think you need to clone the resultant mesh and specify that you want normal data(just like you are doing). However, this doesn''t create the normals, it just leaves a place for them. You then need to run D3DXComputeNormals() on the new mesh. This should fix you up.

Share this post


Link to post
Share on other sites
It should have normals already. By default those meshes have a position (XYZ) and a normal. Have you set a material? Have you assigned anything to the diffuse member of the vertex? It may be that it''s lighting your sphere properly, it''s just that your sphere is black.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Thanks a lot - I had looked for a Calculate Normals, but not Compute.

Also, it helps to set the color to something other than 0.. ::blush::

Thanks again,

riley

Edit: DrunkenHyena's post popped up before I hit submit - he was/is right, I just wasn't coloring it. Thanks for the help!

[edited by - rileyriley on February 5, 2004 10:07:00 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!