Page 1 of 1

how to make .obj semitransparent after readin?

Posted: Mon Jul 18, 2011 1:04 pm
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

Re: how to make .obj semitransparent after readin?

Posted: Mon Jul 18, 2011 2:49 pm
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

Re: how to make .obj semitransparent after readin?

Posted: Tue Jul 19, 2011 6:59 am
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

Re: how to make .obj semitransparent after readin?

Posted: Tue Jul 19, 2011 9:56 am
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

Re: how to make .obj semitransparent after readin?

Posted: Tue Jul 19, 2011 11:01 am
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

Re: how to make .obj semitransparent after readin?

Posted: Tue Jul 19, 2011 8:25 pm
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.