Jump to content

Edit a particular billboard's opacity


photo

Recommended Posts

Hi,

 

I am using an ObjectBillboard to spawn billboards.

I know I can set the objects's material to be a particular opacity, but that effects all billboards associated with that object.

Is it possible to set an individual billboard's opacity?

 

Any ideas?

 

Thanks.

Link to comment

Hi Sam,

 

I haven't worked with billboards, but this might be a material instance issue. Make sure you're using getMaterialInherit to obtain the material pointer. This will instance the object's material so that any changes are not applied to other objects with the same parent material. Using getMaterial will return the parent material (no instancing), so changes to that material pointer will propagate to all other objects with that material.

 

Kevin

Link to comment

All billboards of an ObjectBillboards instance using standard billboard material will be rendered with same material/transparency. If you want to have more diversity then you have to use multiple ObjectBillboards with different material instances having individual transparency values. Of course this will affect render performance as it increases the draw call count.

 

Nevertheless it might be possible to have per billboard transparency with a modified material/fragment shader by 'miss-using' per-billboard angle parameter (see ObjectsBillboards::setAngle) which could be used for specification of individual transparency values. The engine will pass this value for each billboard at least to the vertex shader. From here it could be forwarded to the fragment shader for patching the default material/texture color transparency alpha value

Link to comment
×
×
  • Create New...