[fixed] .x face color

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
strangeland
Posts: 2
Joined: Fri Dec 09, 2005 6:26 pm

[fixed] .x face color

Post by strangeland »

The direct x file loader reads the face color incorrectly:
In the file "CXFileReader.cpp":

Code: Select all

bool CXFileReader::parseDataObjectMaterial(SXMaterial& material)
{
...
	// read RGBA

	findNextNoneWhiteSpaceNumber();
	material.FaceColor.a = readFloat();
	findNextNoneWhiteSpaceNumber();		
	material.FaceColor.r = readFloat();
	findNextNoneWhiteSpaceNumber();		
	material.FaceColor.g = readFloat();
	findNextNoneWhiteSpaceNumber();		
	material.FaceColor.b = readFloat();
reads the alpha value first, by the specification I believe this should be

Code: Select all

bool CXFileReader::parseDataObjectMaterial(SXMaterial& material)
{
...
	// read RGBA

	findNextNoneWhiteSpaceNumber();		
	material.FaceColor.r = readFloat();
	findNextNoneWhiteSpaceNumber();		
	material.FaceColor.g = readFloat();
	findNextNoneWhiteSpaceNumber();		
	material.FaceColor.b = readFloat();
	findNextNoneWhiteSpaceNumber();
	material.FaceColor.a = readFloat();
strangeland
Posts: 2
Joined: Fri Dec 09, 2005 6:26 pm

Post by strangeland »

I confirmed this with the DirectX SDK docs available here. It would nice if this were corrected for the next release.
tip
Posts: 50
Joined: Fri Feb 13, 2004 8:53 am
Location: grenoble, France
Contact:

face color

Post by tip »

hi,
i've the same problem... but i've corrected and re-compiled and it changes nothing. I wonder if the render uses the face color info??? if yes, is there a render flag for face colors or another trick?
gozargozarian

Post by gozargozarian »

It would be nice to finally get objects to render to solid colors instead of having to texture map everything to get changes. Face colors are important and should be rendered by default.
jayvatar
Posts: 6
Joined: Mon Nov 13, 2006 4:44 pm
Location: Kansas City, MO

Post by jayvatar »

This must be the problem I was having as well... I was trying to load a .irr file which has a .x static mesh attached to it, at runtime the colors would not load using directx and then the colors would load when I rendered with the opengl driver....

http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=17364
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

I think I remember the workaround being to define some uv coordinates. I may be wrong though
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

In order to support a different color for each face in a model, you would need a different material for each face of the model.
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I don't think that anyone wants to have a different color per face, but simply correct colors without textures. Will be checked in soon (face colors without textures).
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

I'm thoroughly confused. Is face color the color of an individual triangle, or is it just the color of a material?
Image
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It's the color of a triangle (or better the color of a vertex). When loading meshes I usually put the material color both to the material and the vertex. This allows for showing the color even without textures or light.
Post Reply