Page 1 of 1

Lighting near vertices?

Posted: Thu Nov 06, 2014 1:56 am
by oppositescopez
Hello. i'm not to experienced with irrlicht. But i have a little scene set up, playing around with lighting. The unusual thing i am running into is, When i have my lighting near a vertex of my model it gets really bright shiny and weird. when its not close to a vertex on the model the lighting is perfectly fine, Ill show some examples.
Image
this lighting is fine. its a rotating light though and when it moves over a little bit it gets unusual results.
Image

This is my current lighting code

Code: Select all

 
scene::ISceneNode* lights = 0;
    lights = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
        video::SColorf(1.0f, 0.6f, 0.7f, 1.0f), 600.0f);
 
    scene::ISceneNodeAnimator* anims = 0;
    anims = smgr->createFlyCircleAnimator (core::vector3df(0,60,0),50.0f);
    lights->addAnimator(anims);
    anims->drop();
    lights = smgr->addBillboardSceneNode(lights, core::dimension2d<f32>(50, 50));
 
    lights->setMaterialFlag(video::EMF_LIGHTING, false);
    lights->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
    lights->setMaterialTexture(0,   driver->getTexture("media/particlewhite.bmp"));
    lights->setID(ID_IsNotPickable);
 
Pretty much taken from one of the tutorials.
I don't understand why it gets all bright/reflective and stuff. Are there any methods i can use to prevent this from happening?

Re: Lighting near vertices?

Posted: Thu Nov 06, 2014 8:04 am
by hendu
Looks like your terrain's specular needs tuning.

Re: Lighting near vertices?

Posted: Fri Nov 07, 2014 10:04 pm
by oppositescopez
hey thanks. Im not used to terms like "diffuse" "specular" and things like that. I found out in the documentation that speculation is controlled by shininess.
this simple code on the levelmesh fixed this simple problem.

Code: Select all

levelnode->getMaterial(0).Shininess = 0.0f;
setting it to 0 simply disables the specular reflection on the material.
I overlooked this searching for a solution in the documentation.
Thanks.

Re: Lighting near vertices?

Posted: Fri Nov 07, 2014 10:52 pm
by CuteAlien
Not Irrlicht related, but if you want a general introduction to light and 3D graphics, this video from Carmack is very, very good: https://www.youtube.com/watch?v=MG4QuTe8aUw
90 Minutes is a little long, but it's a great overview about what all those light calculations are about. You won't remember it all from watching it once, but it's a great introduction to get a feeling for this topic (and I a great refresher course even if you are somewhat familiar with it already).