how to make .obj semitransparent after readin?

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
max6666north
Posts: 15
Joined: Fri Jun 03, 2011 9:35 am

how to make .obj semitransparent after readin?

Post by max6666north »

hi

i have some animatedscenenodes readin from several OBJ-files with solid textures inthere
defined over the OBJ-materialfiles etc...

now i want to make some of them semitransparent if they are in foreground.

what do i have to add to the scenenodes for this?

some hints out there?

thanx
max
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: how to make .obj semitransparent after readin?

Post by Radikalizm »

max6666north wrote:hi

i have some animatedscenenodes readin from several OBJ-files with solid textures inthere
defined over the OBJ-materialfiles etc...

now i want to make some of them semitransparent if they are in foreground.

what do i have to add to the scenenodes for this?

some hints out there?

thanx
max
Could you define "if they are in the foreground"?

Do you mean that you want objects to become see-through when they get close to the near-plane? If so, the easiest way to accomplish that IMO would be by using a shader which manipulates vertex color alpha depending on the vertex' position to the near-plane

If that's not the case, please explain what you want to do exactly
max6666north
Posts: 15
Joined: Fri Jun 03, 2011 9:35 am

Re: how to make .obj semitransparent after readin?

Post by max6666north »

[quote="Radikalizm"]

Could you define "if they are in the foreground"?

Do you mean that you want objects to become see-through when they get close to the near-plane? If so, the easiest way to accomplish that IMO would be by using a shader which manipulates vertex color alpha depending on the vertex' position to the near-plane

If that's not the case, please explain what you want to do exactly[/quote]

Hi
- yes see-through is the goal...
- finding which object shoud be semitransparent is not the problem.
- want to switch hole animatedmeshscenenotes
- I dont want to use shaders

tried something like this:

model=smgr->addAnimatedMeshSceneNode(smgr->getMesh("test.obj"));
model->getMaterial(0).DiffuseColor.setAlpha(120);
model->getMaterial(0).MaterialType=EMT_TRANSPARENT_VERTEX_ALPHA;

but wont work - shows only inverted hidden surfaces in solid...

thx
max
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: how to make .obj semitransparent after readin?

Post by Radikalizm »

Any particular reason why you really don't want to use shaders?
They're extremely useful for situations like these and from what I understand they could help you out perfectly in your case, but if you're targeting a platform with no programmable pipeline features (eg. OpenGL ES 1.x) I can understand
max6666north
Posts: 15
Joined: Fri Jun 03, 2011 9:35 am

Re: how to make .obj semitransparent after readin?

Post by max6666north »

[quote="Radikalizm"]Any particular reason why you really don't want to use shaders?
They're extremely useful for situations like these and from what I understand they could help you out perfectly in your case, but if you're targeting a platform with no programmable pipeline features (eg. OpenGL ES 1.x) I can understand[/quote]
... no shaders available
max
Lonesome Ducky
Competition winner
Posts: 1123
Joined: Sun Jun 10, 2007 11:14 pm

Re: how to make .obj semitransparent after readin?

Post by Lonesome Ducky »

If the object has textures, you'll need to make a blending function after assigning the vertex alpha. Try:

Code: Select all

material.MaterialTypeParam = irr::video::pack_texureBlendFunc(irr::video::EBF_SRC_ALPHA, irr::video::EBF_ONE_MINUS_SRC_ALPHA, irr::video::EMFN_MODULATE_1X, irr::video::EAS_TEXTURE | irr::video::EAS_VERTEX_COLOR); 
This blends the vertex color and the texture.
Post Reply