I have a problem with light/material... =(
I created a simple custom scene node.
I added a light:
light = scene_manager->addLightSceneNode(0, camera_position, SColorf(0.3f, 0.3f, 0.3f));
And I used a material with these parameters:
material.AmbientColor = SColor(255, 20, 20, 20);
material.DiffuseColor = SColor(255, 20, 20, 20);
material.EmissiveColor = SColor(255, 20, 20, 20);
With OpenGL I have this result:
But with Direct3D8/9:
What is the problem?
Is it "normal"?
Maybe I forgot something in my code... =(
Thanx!
Light / material problem...
It is a problem with D3D renderer.
Try this (in setRenderStates3DMode):
Try this (in setRenderStates3DMode):
Code: Select all
if(ResetRenderStates)
{
pID3DDevice->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
pID3DDevice->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
pID3DDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
pID3DDevice->SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
} :
It is a problem because D3D doesn't take material source while shading triangles. It takes only only information from vertex (like color) into account.Anonymous wrote:Is this "problem" because D3D enables specular by default or something?
This problem is reported before on this forum. Somehow, Niko missed that.
hum, i'm not sure it even takes color informations.
i have a ms3D map created with milkshape of course.
i imported it to irrlicht, results are:
- opengl: color rendered as i set them into my ms3D but alpha values of materials are not loaded. (even if i try to set the alpha values directly in irrlicht, there is a problem and my map is whole black with some bad triangle we can looked when the camera moves even if i set up a light)
- directx: no problem excepts colors are not loaded, my map is whole white if i don't set up a light
i think a patch could be useful for users who don't want to recompile the engine (i don't want to install DX SDK in order to compile the engine)
i have a ms3D map created with milkshape of course.
i imported it to irrlicht, results are:
- opengl: color rendered as i set them into my ms3D but alpha values of materials are not loaded. (even if i try to set the alpha values directly in irrlicht, there is a problem and my map is whole black with some bad triangle we can looked when the camera moves even if i set up a light)
- directx: no problem excepts colors are not loaded, my map is whole white if i don't set up a light
i think a patch could be useful for users who don't want to recompile the engine (i don't want to install DX SDK in order to compile the engine)