obj colours in blender different from in irrlicht

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:

obj colours in blender different from in irrlicht

Post by xDan »

In blender my object is GREEN but in irrlicht it is PURPLE!!

This is the material file

# Blender3D MTL File: body.blend
# Material Count: 1
newmtl Material
Ns 96.078431
Ka 0.000000 0.000000 0.000000
Kd 0.340236 0.800000 0.470134
Ks 0.112804 0.500000 0.112804
Ni 1.000000
d 1.000000
illum 2

Does anyone else have this problem and know what causes it?

(also blue appears yellow, red as blue)
Last edited by xDan on Fri Sep 08, 2006 1:25 pm, edited 1 time in total.
rikyoh
Posts: 14
Joined: Fri Sep 08, 2006 1:02 pm

Post by rikyoh »

Hi,

i'm using milkshape and had similar problems.

How did you make your objekt green, with material color or with texture? I tried it with material color first, that didn't work (dont know why). The "purple" is the default irrlicht color. May be irrlicht can't process that material colors of milkshap and blender.

I made a simple 128x128 texture in just one color and assigend that texture to my material. This works in irrlicht too.

But I had one further problem: milkshape stores the path to the texture in a way that the texture is not found by irrlicht. I have to store my textures twice, in a subfolder of my models for the modeller and in a subfolder of my exe for irrlicht...

Hope this helps, I am beginner with irrlicht and modelling :-)

Bye,
Riky

Is this forum so extremely slow only for me? Its nearly unusable:-(
xDan
Competition winner
Posts: 673
Joined: Thu Mar 30, 2006 1:23 pm
Location: UK
Contact:

Post by xDan »

I think I found the problem:

in COBJMeshFileLoader.cpp

Code: Select all

c8* COBJMeshFileLoader::readColor(c8* pBufPtr, video::SColor& color, const c8* pBufEnd)
{
	const s32 COLOR_BUFFER_LENGTH = 16;
	c8 colStr[COLOR_BUFFER_LENGTH];

	color.setAlpha(255);
	pBufPtr = goAndCopyNextWord(colStr,   pBufPtr, COLOR_BUFFER_LENGTH, pBufEnd);
	color.setRed((s32)(255-core::fast_atof(colStr) * 255));
	pBufPtr = goAndCopyNextWord(colStr,   pBufPtr, COLOR_BUFFER_LENGTH, pBufEnd);
	color.setGreen((s32)(255-core::fast_atof(colStr) * 255));
	pBufPtr = goAndCopyNextWord(colStr,   pBufPtr, COLOR_BUFFER_LENGTH, pBufEnd);
	color.setBlue((s32)(255-core::fast_atof(colStr) * 255));

	return goNextLine(pBufPtr, pBufEnd);
}
should be

Code: Select all

c8* COBJMeshFileLoader::readColor(c8* pBufPtr, video::SColor& color, const c8* pBufEnd)
{
	const s32 COLOR_BUFFER_LENGTH = 16;
	c8 colStr[COLOR_BUFFER_LENGTH];

	color.setAlpha(255);
	pBufPtr = goAndCopyNextWord(colStr,   pBufPtr, COLOR_BUFFER_LENGTH, pBufEnd);
	color.setRed((s32)(core::fast_atof(colStr) * 255));
	pBufPtr = goAndCopyNextWord(colStr,   pBufPtr, COLOR_BUFFER_LENGTH, pBufEnd);
	color.setGreen((s32)(core::fast_atof(colStr) * 255));
	pBufPtr = goAndCopyNextWord(colStr,   pBufPtr, COLOR_BUFFER_LENGTH, pBufEnd);
	color.setBlue((s32)(core::fast_atof(colStr) * 255));

	return goNextLine(pBufPtr, pBufEnd);
}
(the "255-" are removed)

With this the colours are correct, although not exact, but that's probably because it's lighted differently

(I had to recompile the dll)
Post Reply