color material can't display in EDT_DIRECTX mode!

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

color material can't display in EDT_DIRECTX mode!

Post by michael520 »

I use 3ds max and make a model of box, giving it a simple color material in the material editor, then export it to an x format file.

Then, I use the Directx Mesh viewer to open the x file and it's display well.
Also, I load the x file in irrlicht with EDT_OPENGL, and it display well,too.
But, when I change the mode to EDT_DIRECTX(8 or 9), the color of the model is gray...(not colorful anymore, lost color)

Anybody here know the causes ? Very emergent~~~
Thanks
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Re: color material can't display in EDT_DIRECTX mode!

Post by michael520 »

michael520 wrote:I use 3ds max and make a model of box, giving it a simple color material in the material editor, then export it to an x format file.

Then, I use the Directx Mesh viewer to open the x file and it's display well.
Also, I load the x file in irrlicht with EDT_OPENGL, and it display well,too.
But, when I change the mode to EDT_DIRECTX(8 or 9), the color of the model is gray...(not colorful anymore, lost color)

Anybody here know the causes ? Very emergent~~~
Thanks
Help please...
Why no body reply? :cry:
dhenton9000
Posts: 395
Joined: Fri Apr 08, 2005 8:46 pm

Post by dhenton9000 »

can you post the problem file?
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

does it work in OpenGL? If so, then it's a problem with DirectX, if not then it's a problem with the 3DS loader.
Image
hybrid

Post by hybrid »

Spintz wrote:does it work in OpenGL? If so, then it's a problem with DirectX, if not then it's a problem with the 3DS loader.
He stated in his first post that it works with OpenGL, but not with any DirectX. Also, it's not a problem of the 3ds loader, but of the x loader as it's been converted to .x. But this introduces a new tool, so it might be a bug of the 3ds->x converter as well.
Vox
Posts: 47
Joined: Fri Apr 01, 2005 5:25 pm

Post by Vox »

I have experienced similar problems (shading working properly for OGL, but not for D3D), so I made following change to D3D renderer:

Code: Select all

	pID3DDevice->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
and voila, D3D renderer problem(s) disappeared.
Guest

Post by Guest »

you are using materials not specific textures - try adding a coloursheet texture and UV mapping co-ords then export it - it will then give you the colour on the sheet (needs to only be small).
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

Anonymous wrote:you are using materials not specific textures - try adding a coloursheet texture and UV mapping co-ords then export it - it will then give you the colour on the sheet (needs to only be small).
I don't quite get it!
How to add a coloursheet texture? that needs a picture with color?

but why the directx mesh viewer can't view the color...
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

Vox wrote:I have experienced similar problems (shading working properly for OGL, but not for D3D), so I made following change to D3D renderer:

Code: Select all

	pID3DDevice->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
Thanks a lot Vox!!! I will try your method later!!
and voila, D3D renderer problem(s) disappeared.
michael520
Posts: 230
Joined: Mon Oct 10, 2005 2:24 am

Post by michael520 »

Vox wrote:I have experienced similar problems (shading working properly for OGL, but not for D3D), so I made following change to D3D renderer:

Code: Select all

	pID3DDevice->SetRenderState(D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_SPECULARMATERIALSOURCE, D3DMCS_MATERIAL);
	pID3DDevice->SetRenderState(D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
and voila, D3D renderer problem(s) disappeared.
Thanks a lot! The problem is solved!!
miko93

Post by miko93 »

Errrm, where exactly did you put this code?
Somewhere within the Irrlicht source like void CD3D8Driver::setBasicRenderStates ?

Thanks,
miko93
miko93
Posts: 54
Joined: Sat Nov 12, 2005 5:24 pm
Location: Regensburg, Germany
Contact:

Post by miko93 »

http://irrlicht.sourceforge.net/phpBB2/ ... php?t=9635

Ups, sorry for not browsing the boards properly before posting.

miko93
Post Reply