Loading Mesh with Specular Level

Started by
35 comments, last by GeniusPooh 11 years, 4 months ago
The main question is: Does .x file export specular level from 3Ds Max? If not, then what is the solution for exporting specular information? Maybe I should use another .x file exporter or read it from effects file.
Advertisement
According to the .x file specification, the material data should contain the specular color and power values.

MSDN spesifications on the .x file.
http://msdn.microsoft.com/en-us/library/windows/desktop/bb147174(v=vs.85).aspx

Other question is that if your exporter supports them, although they are rather basic for typical lighting models.

Are you able to look in to the data and see if the materials have specular values?

Cheers!
I think the exporter support them, I tried to calculate the MD5 hash for .x file with specular level and another .x file with the same mesh and same everything except different specular level and it's showing different MD5 hash, the attached file is a sphere that I added a specular level to it, you can check it out and let me know if it has specular level and how can I render it in DirectX with it's specular level.
Hi, My directx exporter has make a update. Now it can export the power of specular and support 3ds Max 2013 ! The following is the result from my x file exporter:

Material _01_-_Default {
0.388235;0.411765;0.576471;1.000000;;
0.780000; //specular power
0.900000;0.900000;0.900000;;
0.000000;0.000000;0.000000;;
}
Mesh Sphere001 {
482;
...
If you want to use my exporter, download the axe free edition :)
Hi Alin,

What render state should I use before the line mesh->DrawSubset(); so I can have the mesh drawn with specular level?

I tried to export using your exporter and draw the mesh using the following code:
m_d3dDevice->SetRenderState(D3DRS_LIGHTING, TRUE);
m_d3dDevice->SetRenderState(D3DRS_SPECULARENABLE, TRUE);
m_d3dDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
mesh->DrawSubset(i);


I still don't see the specular level.
Do you extract the power from x file ahd set the material? like this:
D3DMATERIAL9 mtl;
mtl.Power = 78;
...
m_pd3dDevice->SetMaterial( &mtl );
...
When I set the specular level to 100 in 3Ds Max, I can see that material.Power value is 1.0, I tried setting the material using m_pd3dDevice->SetMaterial( &material ); but can't see the specular level.

Also, I'm only loading the mesh, I don't use D3DLIGHT in the scene.
I'm still wondering how do you see the model if there isn't any light sources. Can you get a screen shot of your screen to show the output of your program.

Specular high lights are strongly dependent on the light source position / direction so I'm not sure what you expect to get if you don't have a light source in the scene.

Cheers!
I want to see the mesh exactly as I see it when I render it in 3Ds Max, I'm not adding any light in 3Ds Max, just changing the specular level, so I want it to appear exactly as I see it in 3Ds Max.
And how do you suppose MAX is able to show the mesh with specular highlights if there isn't a light source in the scene?

The answer is : 3DS MAX has a light source in the scene (called Default Light) which will disappear when you place the first light source in the scene.

So to answer your question in a short way : you'll need a light source which has the same properties as the MAX default light in order to see the model lit as in 3DS MAX.

Best regards!

PS. I have asked a screenshot of your program 2-3 times now. I don't make such request without a reason. Looking at an image gives a lot more information than one person telling what he is doing or not doing or what he wishes that his program would do.

This topic is closed to new replies.

Advertisement