Question About P3D's Alpa Abilities

Another day more programming stress, :laughing:

Anyway

I was just wonder about this… If P3D doesn’t support this, then I’ll go with option two.

I’m sure you’re probably thinking to yourself, “ask the question already!”

Sure…

I have worked with graphic engines that had the ability to make an object transparent to which ever degree specified.

I’m not talking about a transparent texture mapped on and object; a completely none transparent texture mapped onto an object that goes transparent.

That’s my question… Does P3D have the APIs for making a none transparent object or mesh (actor or not) become transparent (through code)?

If not, that would be a nice addition to the APIs for those into OpenGL graphic Programming and shaders.

Is this what you are looking for?

nodePath.setAlphaScale(alpha)

Not sure…but I’ll give it a test.

“Nope…” Didn’t work. I’m guessing that only works if the object had some form of alpha to begin with…? Maybe…

I used it on an Actor to see if it would indeed turn half transparent (0.5).

I’m guessing such code was not structured into a function/method for the engine… :cry:

Oh crap… I’ll just use the second method then. :slight_smile:

(I hope it doesn’t wreck the fps :open_mouth: )

You’ve got to add

node.setTransparency(TransparencyAttrib.MAlpha)

or some other TransparencyAttrib.

If a model has a modulate texture in rgba format (even if the texture has an empty alpha channel), then the loader will set up the transparency all by itself.

I’m also pretty sure that in the past I loaded a model and set a texture on it with no transparency whatsoever and then used

node.setColor(1,1,1,.5)

and it got transparent. Can you confirm this?