Transparency
Moderator: Moderators
-
- Posts: 4
- Joined: Fri Aug 08, 2008 12:34 pm
Transparency
How can I make a transparent(invisible) material for 3D objects?
Hello Chupacapra,
Right click on the color property of a Material to open up the Alpha dialogue. Alternatively you can use a ZExpression component to set the Alpha value with the following script.
In this example the name of the Material is "MyMaterial", and I'm setting the alpha value to 0.5 ( 128/256 ).
Welcome to the ZGE community
Kjell
Right click on the color property of a Material to open up the Alpha dialogue. Alternatively you can use a ZExpression component to set the Alpha value with the following script.
Code: Select all
MyMaterial.Color.A = 128/256;
Welcome to the ZGE community

Kjell
- Attachments
-
- Material.gif (5.11 KiB) Viewed 15139 times
-
- Posts: 4
- Joined: Fri Aug 08, 2008 12:34 pm
-
- Posts: 4
- Joined: Fri Aug 08, 2008 12:34 pm
Hi Chupacapra,
Hmm, I wonder if it's a hardware problem. Can you try out the attached example ( exe + source )? What you should be seeing is a rotating ( double-sided ) cube fading in and out in front of a colorful background.
Regards,
K
Hmm, I wonder if it's a hardware problem. Can you try out the attached example ( exe + source )? What you should be seeing is a rotating ( double-sided ) cube fading in and out in front of a colorful background.
Regards,
K
- Attachments
-
- Alpha.jpg (37.99 KiB) Viewed 15119 times
-
- Alpha.zip
- (37.78 KiB) Downloaded 639 times
-
- Posts: 4
- Joined: Fri Aug 08, 2008 12:34 pm
Hi Tischk,
There are a couple of ways you can go about this. One is to put the Material Component in the Model's Definitions ( so each Clone has their own instance of the Material assigned ), another is to use a RenderSetColor Component after UseMaterial with some kind of Condition to pick out the desired Clone(s) .. or you could use a ModelState.
These kind of situations always require a bit of creative thinking, even when you're just writing C++ / Delphi.
Good luck ~
K
There are a couple of ways you can go about this. One is to put the Material Component in the Model's Definitions ( so each Clone has their own instance of the Material assigned ), another is to use a RenderSetColor Component after UseMaterial with some kind of Condition to pick out the desired Clone(s) .. or you could use a ModelState.
These kind of situations always require a bit of creative thinking, even when you're just writing C++ / Delphi.
Good luck ~
K
Thank you. I got one more question. How do I remove a model with code?Kjell wrote:Hi Tischk,
There are a couple of ways you can go about this. One is to put the Material Component in the Model's Definitions ( so each Clone has their own instance of the Material assigned ), another is to use a RenderSetColor Component after UseMaterial with some kind of Condition to pick out the desired Clone(s) .. or you could use a ModelState.
These kind of situations always require a bit of creative thinking, even when you're just writing C++ / Delphi.
Good luck ~
K
the (only) way is:
use the condition component and put the "RemoveModel" component inside "On-True". You can also use some kind of global variable and put the condition inside the model (in case you need to eliminate some clones).
The scripting language is under development so it might be easier in the future
use the condition component and put the "RemoveModel" component inside "On-True". You can also use some kind of global variable and put the condition inside the model (in case you need to eliminate some clones).
The scripting language is under development so it might be easier in the future

In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
-=Hugo Rossi=-
Ah okay. That is abit exhausting. ;Pkattle87 wrote:the (only) way is:
use the condition component and put the "RemoveModel" component inside "On-True". You can also use some kind of global variable and put the condition inside the model (in case you need to eliminate some clones).
The scripting language is under development so it might be easier in the future
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
you can also remove all the instances of a single type of model using the RemoveAllModels component, use the pulldown list,. I find this one sometimes quite usefull.
most of the materials I use are pure white with alpha set to 1,. I then use the RenderSetColor in the render events of the Models to set the actual color and alpha values,. in this way you reall only need a few materials for the blend modes and textures you want,. .
most of the materials I use are pure white with alpha set to 1,. I then use the RenderSetColor in the render events of the Models to set the actual color and alpha values,. in this way you reall only need a few materials for the blend modes and textures you want,. .
iterationGAMES.com