Lighting near vertices?

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
oppositescopez
Posts: 14
Joined: Wed Sep 11, 2013 3:00 pm
Contact:

Lighting near vertices?

Post 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?
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Lighting near vertices?

Post by hendu »

Looks like your terrain's specular needs tuning.
oppositescopez
Posts: 14
Joined: Wed Sep 11, 2013 3:00 pm
Contact:

Re: Lighting near vertices?

Post 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.
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Lighting near vertices?

Post 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).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply