[Solved] Define queue bucket in material

Is it possible to define the queue bucket in a material?

We have a model with two meshes : one solid and one transparent. We use the SDK to set the material and thus we know which material is set to the transparent mesh.

However, we have to hardcode the queue bucket manually

((Node) m_model).getChild(0).setQueueBucket(RenderQueue.Bucket.Transparent);

Here’s the material for the transparent mesh :

Material crystal_default_shell : Common/MatDefs/Light/Lighting.j3md {
     MaterialParameters {
        Diffuse : 1.0 1.0 1.0 0.25
        UseMaterialColors : true
     }
    AdditionalRenderState {
      Blend Alpha
      DepthTest On
    }
} 

What I would like is a line in this material to set the queue bucket.

AFAIK what you’re looking for is not possible although it would be very useful. Can anyone with more knowledge correct me if I’m wrong please? You can however select the queue bucket for the selected mesh in scene composer properties section.

1 Like

My friend actually just told me that. But it’s kinda weird. I’ll try it ASAP.

You could extend material if you wanted to, or define a has-an (as opposed to is-an) relationship with one in a class.

Why exactly is this not possible @devs? Sounds logical to me.

We fixed it.

What happened is that we were lucky up to now. Because theorytically the second mesh is translucent, my friend had set its bucket to translucent in the SDK and it worked up to now. Recently, we added the SSAO post processor and thus it made the bug emerge. We would actually hold the geometry in the hand of a man asset we could see the transparent part overlap the hand but it didn’t appear through walls because there were no post processors.

So all we did was to set the queue bucket to transparent in the SDK. Also, it doesn’t make sens for us to set the render bucket in the SDK : it is in the material section but it can’t actually be set in the material… and it’s in the material that we set the alpha.

Thanks everyone :slight_smile:

1 Like

You cannot set the Bucket in the material since it is not a material parameter. The bucket ensures that the transparent object is drawn on top of objects behind it. In the material you set the Blend mode to indicate that your color/texture has an alpha channel.

for reference:
https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_material.html

2 Likes

Yes, the queue bucket really has nothing to do with materials… so it’s not a material parameter.

1 Like