customMaterial Fragment_Custom_Alpha does not work

Hi, I make a simple scene to test Fragment_Custom_Alpha of customMaterial, but it doesn’t work. In my thought, this should change the alpha of the sphere to 0.5.

Actually, my finally purpose is to pass one mask map to customMaterial using addUniform, and sample it in Fragment_Custom_Alpha using a customed UV. However, I haven’t even figure out how to use Fragment_Custom_Alpha right now. And it seems there doesn’t exist many informations about this in Doc.

link: Babylon.js Playground

pinging @sebavan

Adding @nasimiasl the daddy of the custom materials as this is a community maintain material.

3 Likes

It looks like CUSTOM_FRAGMENT_UPDATE_ALPHA is defined in the wrong part of the default fragment shader here, inside the #ifdef DIFFUSE block, so it can only be used when there’s a diffuse texture?

3 Likes

you need set .alpha between 0. = 0.999 then you can customize it
because without that standard material work as non transparent material

also the alpha in standard material only release whe u use a transparent texture

  • u can use
    Fragment_Before_FragColor

for directly control alpha without any condation

3 Likes