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

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
maxi0361
Posts: 24
Joined: Thu Nov 20, 2008 3:04 am

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

Post 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?
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post 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.
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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).
twilight17
Posts: 362
Joined: Sun Dec 16, 2007 9:25 pm

Post by twilight17 »

Is your light inside your model?
what's the position of the model?
Post this userbar I made on other websites to show your support for Irrlicht!
Image
http://img147.imageshack.us/img147/1261 ... wernq4.png
maxi0361
Posts: 24
Joined: Thu Nov 20, 2008 3:04 am

Post 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?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
maxi0361
Posts: 24
Joined: Thu Nov 20, 2008 3:04 am

Post 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.
Post Reply