Exporting .obj from blender with material colours (tips)

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
xDan
Competition winner
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK
Contact:

Exporting .obj from blender with material colours (tips)

Post by xDan »

This is just some guidelines for setting up materials in blender for export to .obj format. As I had trouble with it!! And maybe someone else will...

If you want more info on lighting here is a good link:
http://www.sjbaker.org/steve/omniv/opengl_lighting.html

So...

- set smooth on a mesh to make it smooth!
- the first colour "col" is diffuse colour
- use very low or zero specular "spe" colour

The .obj exporter seems to use some world ambient colour, I couldn't find how to change this in blender. But maybe someone else can??

For the time being you can change these lines in the .obj exporter so you can set ambient colour:

file.write('Ka %.6f %.6f %.6f\n' % tuple([c*mat.getAmb() for c in worldAmb]) ) # Ambient, uses mirror colour,

to

file.write('Ka %.6f %.6f %.6f\n' % tuple([c for c in mat.getMirCol()]) ) # Ambient, uses mirror colour,

Now the mirror colour in blender's material will be used as ambient.


- When exporting make sure to select the "Normals" button.
- And by default it exports only selected meshes so either select them all or deselect the "Selection Only" button.

- once in irrlicht you can set the ambient lighting:

device->getVideoDriver()->setAmbientLight(video::SColorf(0.5,0.5,0.5));


- or create a sun style directional light

the following light seems to work okay for me:

Code: Select all

	irr::scene::ILightSceneNode *light = device->getSceneManager()->addLightSceneNode(NULL, irr::core::vector3df(0,1,0));
	irr::video::SLight &slight = light->getLightData();
	slight.Type = video::ELT_DIRECTIONAL;
	slight.DiffuseColor = irr::video::SColorf(1.0,1.0,1.0,1.0);
	slight.AmbientColor = irr::video::SColorf(0.4,0.4,0.4,1.0);
	slight.SpecularColor = irr::video::SColorf(1.0,1.0,1.0,1.0);
Last edited by xDan on Tue Sep 12, 2006 11:48 am, edited 2 times in total.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

A sun style light is better relaized using directional light. The position is giving the direction the light is coming from, the position is infinitely far away.
xDan
Competition winner
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK
Contact:

Post by xDan »

much better :D I changed it
Post Reply