Page 1 of 1

My mesh becomes strange b/w, How to control light?

Posted: Thu Nov 27, 2008 9:55 pm
by maxi0361
I have a 3d max model designed by a friend of mine.
and I load it as a mesh, turn off EMF_LIGHTING.
It looks okay, I can see the blue tip of it as its design.
His design
http://maxi0361.pixnet.net/album/photo/103399848
EMF_LIGHTING OFF
http://maxi0361.pixnet.net/album/photo/103399847
LIGHT

Code: Select all

scene::ISceneNode* scnode = smgr->addLightSceneNode(0, core::vector3df(0,0,0),
                video::SColorf(0.7f, 0.7f, 0.7f, 0.7f), 12000.0f);
http://maxi0361.pixnet.net/album/photo/103399846
The blue color is gone and its light look weird.

What do I need to do to make it look just like his design?
is it about shader or light mapping?

Posted: Thu Nov 27, 2008 11:03 pm
by dlangdev
It's not that easy.

There are many approaches to shading the model. If you know how to apply texture, you can create diffuse and specular textures. And if you know shader programming, you can do it in code.

Posted: Thu Nov 27, 2008 11:08 pm
by hybrid
Please show the code for mesh loading and material setup as well. A good idea might be to texture map your model, and make sure the normals are good (and rescaled if necessary).

Posted: Fri Nov 28, 2008 1:37 am
by twilight17
Is your light inside your model?
what's the position of the model?

Posted: Fri Nov 28, 2008 6:36 am
by maxi0361
Add mesh code

Code: Select all

ISceneManager* smgr = device->getSceneManager();
IAnimatedMesh* mesh = smgr->getMesh("./5K_3DS/PLANE.3ds");
IMeshSceneNode * node = smgr->addMeshSceneNode(mesh->getMesh(0),0,-1, vector3df(0,-250,0), vector3df(0,0,0), vector3df(1,1,1),false);
if (node)
	{
		node->setMaterialFlag(EMF_LIGHTING, false);
scene::ISceneNodeAnimator* anim =
smgr->createFlyStraightAnimator(core::vector3df(1000,0,60),
                        core::vector3df(-100,0,60), 2500, true);
                if (anim)
                {
                        node->addAnimator(anim);
                        anim->drop();
                }
	}
Add light code

Code: Select all

scene::ISceneNode* scnode = smgr->addLightSceneNode(0, core::vector3df(0,0,0),video::SColorf(0.7f, 0.7f, 0.7f, 0.7f), 12000.0f);
Hey, Mr twilight17, I think you are right, my light is inside my model!
after moving it out, the model looks much better.
and my another friend told me to use 2 light sources, and here is the improved result.
Image

but I still what to know more about this topic.
I understand it is not simple.
so there are many ways, shader and texture mapping, etc.
where can I dug up more information on these using irrlicht?
Is there any tutorial? or google only?

Posted: Fri Nov 28, 2008 8:21 am
by hybrid
You can also improve lighting by not using 3ds, but e.g. .obj or one of the animated mesh types. Except for 3ds, all other models support vertex normals in Irrlicht, which makes the appearance much more pleasant.

Posted: Sat Nov 29, 2008 6:48 am
by maxi0361
animated mesh and vertex normals.
I will look into these. vertex normal appears couple of times in my l
research.

Thank you, all of you.