Loading Mesh with Specular Level

Started by
35 comments, last by GeniusPooh 11 years, 4 months ago
I create a mesh in 3Ds Max, sometimes I apply specular level in the materials window which make the mesh appears more realistic, I export the mesh to .x file and load it using DirectX 9 and C++, the problem is that I don't see the specular level that I have applied in 3Ds Max.

How can I load .x file in DirectX 9/C++ with specular level according to the material applied in 3Ds Max?

[attachment=12651:0.png]
Advertisement
Are you rendering the mesh using a custom shader? Does your shader support specular highlites?

Cheers!
No, I'm not using shader, I'm just loading the mesh using D3DXLoadMeshFromX() and D3DXLoadMeshHierarchyFromX()
Well have you enabled specular highlights for your rendering? Ie. setting D3DRS_SPECULARENABLE to true?

You don't give much of information about the rendering code so this is just guessing.

Cheers!
No, I was not setting D3DRS_SPECULARENABLE to true, now I tried to set it to true by using:
device->SetRenderState(D3DRS_SPECULARENABLE, TRUE);

but still no specular.
Another thing to check is that your Light structure has some meaningful value for the specular color.

http://msdn.microsoft.com/en-us/library/windows/desktop/bb172566(v=vs.85).aspx

Cheers!
I'm not creating any light using DirectX, I'm just using 3Ds Max to set the specular level as you see in the above screenshot, then I use the following code to render the mesh after loading the mesh from .x file:


device->SetRenderState( D3DRS_LIGHTING, TRUE );
device->SetRenderState( D3DRS_SPECULARENABLE, TRUE );
device->SetRenderState( D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL );
// Code to draw the mesh here...
Well is there a light source in the scene? Does your diffuse lighting work as intended?

Can you confirm that the exported x-file contains lights and that your rendering code sets the lights?

A screenshot of your program with the model would help also.

Cheers!
In 3Ds Max, I'm only changing Specular level value, I don't add any other light, when I load the .x file into DirectX Viewer, I don't see the specular as well, I'm trying to use Panda DirectX Exporter to export from 3Ds Max, I'm not sure if it export information about the specular level that I set in the material window.
ive never tried adding specular in 3dsmax to a mesh, but i know how to add a specular on a model with .fx which gives off a nice effect like this

tinyspec.jpg
:)

This topic is closed to new replies.

Advertisement