Need to use 0-1 alpha clamp, and still write to depth buffer

Software: Away3D 4.x

Avatar
Sinisa, Newbie
Posted: 26 April 2012 08:12 AM   Total Posts: 8

Hello everyone,

I need to find a way to use alpha channel in my diffuse map texture, using alpha clamping (just like in gl is glAlphaFunct(GL_GEQUAL,0.9)), so triangles using this material will STILL write into depth buffer, and not be treated as semi-transparent triangles.

Idea is to use this for wires, cables, or billboards with images that have 0-1 alpha (just like 16bit png), and still have these objects be able to cast shadow.

In GL this is simply done by using glEnable(GL_ALPHA_TEST); and alpha function set to clamp all values that have less than 0.9 value (thus writing to fragment is ignored), while values greater than 0.9 will be written in both color and depth buffer.

How do you set this in Away3D?

   

Avatar
Sinisa, Newbie
Posted: 26 April 2012 08:20 AM   Total Posts: 8   [ # 1 ]

To answer to my own question:

material.alphaThreshold value to be set higher than 0.0..

Now I haven’t seen this property popping up in FlashDevelop3 when accessing properties of a BitmapMaterial, although it is a public property of DefaultMaterialBase class? Weird.

 

   

Avatar
Matse, Sr. Member
Posted: 26 April 2012 09:50 AM   Total Posts: 149   [ # 2 ]

Hi, if you are using Away 3D Beta 4 then you should be using TextureMaterial and BitmapTexture instead of BitmapMaterial, which is more or less deprecated.

Not sure about you FD3 issue, using FD4 here and no problem.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X