i have a light problem simply when i add light i found on my mesh a grey shaded even if i made the light far or near it just gets brighter but there is a small grey shaded exists but when i make lightning false for my mesh it goes!?
thanks.
Ok I saw the picture so now I can see what you mean by "grey". You are referring to the lighter color when the object is set to "lighted".
Looking in the engine source the flag EMF_LIGHTING is defined in the header SMaterial.h as a flag used when dynamic lighting is present. What is your light source?
Without knowing more about what your code is doing I'd look at the value you have set for material shininess. See this excerpt from SMaterial.h
//! Value affecting the size of specular highlights. A value of 20 is common.
/** If set to 0, no specular highlights are being used.
To activate, simply set the shininess of a material to a value other than 0:
Using scene nodes:
\code
sceneNode->getMaterial(0).Shininess = 20.0f;
\endcode
You can also change the color of the highlights using
\code
sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255);
\endcode
The specular color of the dynamic lights (SLight::SpecularColor) will influence
the the highlight color too, but they are set to a useful value by default when
creating the light scene node. Here is a simple example on how
to use specular highlights:
\code
// load and display mesh
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(
smgr->getMesh("data/faerie.md2"));
node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture
node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting
node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights
// add white light
scene::ILightSceneNode* light = smgr->addLightSceneNode(0,
core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f));
\endcode */
but i have 2 questions
1-i saw in all irrlicht tutorials that he doesn't define the material shininess?
2-it worked even when i assigned the material shininess to 0?
and i really thank u datamagik!
As for the default value of material shininess I'd have to search the engine code. Obviously non-zero since that changed the behavior you observed.
Shininess is the quality of reflecting light. Look at a real life black object that's shiny (maybe a black car). Try to look at it objectively and imaging different parts of the surface as if they were rendered to pixels. Many of that object's pixels will not be black, some will be grey (or if it's real world lighting source is a bright stream of sunlight) or even white.
From you pictures it looked like that was what the engine was rendering, that or it was depicting your object as emitting light. Again, guessing here.
materials are set by the mesh loader, which format are you using and what program did you export it from?
it could be a bug in your exporter, the loader, or it could be you're using it wrong. if it is a bug, posting your mesh will help
datamagik wrote:Ok I saw the picture so now I can see what you mean by "grey". You are referring to the lighter color when the object is set to "lighted".
Looking in the engine source the flag EMF_LIGHTING is defined in the header SMaterial.h as a flag used when dynamic lighting is present. What is your light source?
Without knowing more about what your code is doing I'd look at the value you have set for material shininess. See this excerpt from SMaterial.h
//! Value affecting the size of specular highlights. A value of 20 is common.
/** If set to 0, no specular highlights are being used.
To activate, simply set the shininess of a material to a value other than 0:
Using scene nodes:
\code
sceneNode->getMaterial(0).Shininess = 20.0f;
\endcode
You can also change the color of the highlights using
\code
sceneNode->getMaterial(0).SpecularColor.set(255,255,255,255);
\endcode
The specular color of the dynamic lights (SLight::SpecularColor) will influence
the the highlight color too, but they are set to a useful value by default when
creating the light scene node. Here is a simple example on how
to use specular highlights:
\code
// load and display mesh
scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(
smgr->getMesh("data/faerie.md2"));
node->setMaterialTexture(0, driver->getTexture("data/Faerie2.pcx")); // set diffuse texture
node->setMaterialFlag(video::EMF_LIGHTING, true); // enable dynamic lighting
node->getMaterial(0).Shininess = 20.0f; // set size of specular highlights
// add white light
scene::ILightSceneNode* light = smgr->addLightSceneNode(0,
core::vector3df(5,5,5), video::SColorf(1.0f, 1.0f, 1.0f));
\endcode */