.x models

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
lantis
Posts: 64
Joined: Thu Jun 17, 2004 2:46 pm

.x models

Post by lantis »

Can somebody explain me how to load .x models with transparent textures?
As im understand Irrlicht not support alpha channel in tga textures , ok , im
use next code for set transparent textures on my Tree models
for(int i=1;i<TreeModel->getMaterialCount();i++)
{
video::SMaterial mat = TreeModel->getMaterial(i);
TreeModel->getMaterial(i).MaterialType = irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL;
driver->makeColorKeyTexture(mat.Texture1,core::position2d<s32>(0,0));
}

Its worked , but its ruine all particles and billboards in scene!!! Particles
simple go to invisible and billboards have incorrect z-order ;(

Can somebody give me worked example for loading .x models and set
transparent color for part of model.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

try setting the trees' lighting flag to false:

TreeModel->setMaterialFlag(video::EMF_LIGHTING, false);

I had a similar problem where all of my particles went nuts and setting this flag to false corrected it.

give it a try
Image
lantis
Posts: 64
Joined: Thu Jun 17, 2004 2:46 pm

Post by lantis »

No , its not help ;(
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

try setting it in any other model you have loaded,including your world map

usually it's better to have all of the models with their flags set to false and then start switching the ones you need to cast shadows to "true"

try all ogf them in false, and start experimenting
Image
lantis
Posts: 64
Joined: Thu Jun 17, 2004 2:46 pm

Post by lantis »

Tnx afecelis , but its stupid way.
Im want normal models with lighting , optionals shadow (Shadows impossible on Tree models) , etc
Currently its seems like a bug ;(

To Niko:
Any answer? Its a bug? if bug then can it be fixed in 0.7?
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

The renderstates of that material type are not set correctly in the engine, I would say this is a bug. I think I'll fix it for the next version.
lantis
Posts: 64
Joined: Thu Jun 17, 2004 2:46 pm

Post by lantis »

Tnx Niko!
Its a most important feature to have transparent models ;)
Guest

Post by Guest »

Cool,

What would it take to fix this in the current version? Any pointers? Or is the 0.7 coming out in the relatively near future?

Thanks,
-Brian
Post Reply