add shine-effect for a select object

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Katsumi
Posts: 10
Joined: Fri Feb 27, 2009 9:26 am

add shine-effect for a select object

Post by Katsumi »

hi. i have cubes, spheres and meshes and want select one object and this should shine little brighter.
how can i realize this? all objects have a texture.

can i give a shine-color for all objects, so its look similar selected?
i mean, a green texture cube sould shine how a brown texture sphere. thanks for help! :wink:
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

specular

Post by 3DModelerMan »

The specular color is what you need to use. It's in the render to texture tutorial.
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
cobra
Posts: 371
Joined: Fri Jan 23, 2009 2:56 am
Location: United States
Contact:

Post by cobra »

node->getMaterial(0).Shininess = 35.0f;

That's how you set your specular highlights. Experiment with it to get the desired result. The higher you set it, the darker the unlit areas become and the brighter the effects is, and the lower, the lighter the unlit areas and the effect is a little weaker (from the normal lighting) if I remember correctly.
Josiah Hartzell
Image
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Specular is only applicable when the camera or the object is moving, unless the lighting is specifically setup so the reflection of the specular angle is facing the camera.

You could try making it EMT_TRANSPARENT_ADD when its selected, making it additive and much brighter, using setTexture(1, ) to change the lightmap texture it uses (the second channel). But then the other option is to add a "lightmap" or detail map to the one that is selected, this way the "light" can have shapes and shading as well, much better using EMT_LIGHTMAP_ADD or EMT_LIGHTMAP_M4 or M2.

If this confuses you, check the documentation and experiment in the given examples, adding a texture to the second layer, setting the material type to lightmap and see what you can come up with (grayscale is better for lightmaps on additive)
Katsumi
Posts: 10
Joined: Fri Feb 27, 2009 9:26 am

Post by Katsumi »

little example with 3 cubes
with setAmbientLight and EMF_LIGHTING = true
or without setAmbientLight and EMF_LIGHTING = false
smgr->setAmbientLight(irr::video::SColorf(1.0,1.0,1.0,1));

irr::scene::ISceneNode* cube1 = smgr->addCubeSceneNode(10);
cube1->setMaterialFlag(irr::video::EMF_LIGHTING, true);
cube1->setMaterialTexture(0, driver->getTexture("..\\..\\irrlicht-1.5\\media\\rockwall.bmp"));

irr::scene::ISceneNode* cube2 = smgr->addCubeSceneNode(5.0f, 0, -1, irr::core::vector3df(10,0,0));
cube2->setMaterialFlag(irr::video::EMF_LIGHTING, true);
cube2->setMaterialTexture(0, driver->getTexture("..\\..\\irrlicht-1.5\\media\\rockwall.bmp"));

irr::scene::ISceneNode* cube3 = smgr->addCubeSceneNode(5.0f, 0, -1, irr::core::vector3df(-10,0,0));
cube3->setMaterialFlag(irr::video::EMF_LIGHTING, true);
cube3->setMaterialTexture(0, driver->getTexture("..\\..\\irrlicht-1.5\\media\\rockwall.bmp"));
@cobra
cube1->getMaterial(0).Shininess = 35.0f;
mhh, this changing nothing in my test.

@FuzzYspo0N
result with this line
cube1->setMaterialType(irr::video::EMT_LIGHTMAP_ADD); // can't see changes
cube1->setMaterialType(irr::video::EMT_LIGHTMAP_M4); // is much to bright
cube1->setMaterialType(irr::video::EMT_LIGHTMAP_M2); // is still to bright

i look in
http://www.irrlicht3d.org/wiki/index.ph ... dMaterials
http://www.irrlicht3d.org/wiki/index.ph ... dMaterials
but this not helping me


additionally
with setAmbientLight i can set the light color for everyone. its possible to set such color to one object?
FuzzYspo0N
Posts: 914
Joined: Fri Aug 03, 2007 12:43 pm
Location: South Africa
Contact:

Post by FuzzYspo0N »

Check the documentation, please.

Each IMesh has a material associated with it. This means that :

http://irrlicht.sourceforge.net/docu/cl ... 18d30e6b4b

Reading about it will help you.

Code: Select all

smgr->setAmbientLight(irr::video::SColorf(1.0,1.0,1.0,1));
This is the scene manager, THE WHOLE SCENE.

Code: Select all

cube2->getMaterial(0).AmbientColor = SColorf(1.0,1.0,1.0,1);
Have fun
Katsumi
Posts: 10
Joined: Fri Feb 27, 2009 9:26 am

Post by Katsumi »

my first destination are tutorials and api, but as noob must first understand the irrlicht concept, without this i would never find in api my result.
the theme with glow is here often, but nobody have a solution. :(

the solution with cube1->getMaterial(0).AmbientColor = SColor(255,128,0,255); was very helpful. its look nice :D
but i founded no way for a additionally inner shining or mild glow for my cube.
Post Reply