material and light issues.

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
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

material and light issues.

Post by Cube_ »

Image
That is one node, but each block uses a different material (probably because I set my material settings when I create the each cube, I should probably pass a material pointer but for now I just want to merge all the materials).

How would I set the same material for every face/vertex and then remove the redundant materials?

and to my light issues

All of these materials have the EMF_LIGHTING flag set to true, however regardless of how many lights I add I don't see anything change (they were completely black until I added global light at a strength of 0.3f)

This is the current lights in my scene (I've tried with up to 9 all at different positions, radii and colors)

Code: Select all

    smgr->setAmbientLight(video::SColorf(0.3,0.3,0.3,1)); 
       
    scene::ISceneNode* lightOne = smgr->addLightSceneNode(0, core::vector3df(2,2,2), video::SColorf(0.8f,0.8f,0.8f,0.8f), 3.0f);
    ILightSceneNode* light1 = smgr->addLightSceneNode( 0, core::vector3df(0,400,-200), video::SColorf(0.3f,0.3f,0.3f), 100.0f,4); 
I still don't get anything from this and I don't know why, this should just work with the EMF_LIGHTING flag enabled.
"this is not the bottleneck you are looking for"
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: material and light issues.

Post by mongoose7 »

Remember the 'n's in S3Vertex that you dismissed? You might have a look at them now. They're the surface normals. If yours are 0, then n*cos(alpha) = 0 = black!
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: material and light issues.

Post by Cube_ »

Oh, thank you.
I'll have a look at that (and read up on how to properly set them)

EDIT:
I'm shocked, I got them right the first time (I wanted each normal pointing in the direction of the corner and it worked, and I was just guessing based on what seemed to make sense)
Image

EDIT 2:
and my lights are working excellently now, again thank you.
Image
"this is not the bottleneck you are looking for"
Post Reply