Alpha from albedo works in sandbox but not in my scne

Here there

SO im my scene I have this plant. It is using a png for the leaf material. If I drag this model into the sandbox it renders properly , although I do need to change from blended to alpha test for sorting , but that is not the issue :

The issue is in my scene the alpha from the albedo texture is very slightly visible :

i tried all sorts of settings in the sandbox to replicate this and I cant get it to display like in my scene , so I cant work backwards from there and figure out where it is coming from.

Model is here :

https://www.shaderbytes.co.za/babylonjs/plant_1.glb

i checked the console logs of the material, alphaMode is 2 (combine ), useAlphaFromAlbedoTexture is true , changed the transparencyMode to 2 ( alpha test ) , still no luck

im stuck pondering what to do here?

Maybe try dumping all the properties of the Leaf2 material in your setup vs. the sandbox? Maybe also use spector.js to make sure the webgl state is correct. If you are using alpha test, it should be discarding all the pixels.

If you have a live link in which we can display the inspector we could have a more thorough view.

is there a means to display the inspector in any babylon scene? if you clue me up and I can save everyone much effort by going through the values and looking for differences first.

Simply do scene.debugLayer.show().

Thanks for that , i did have to play around with some css to get the inspectors front and functional , just so you know ,

Anyway I found the culprit … SSAO 2! Here is a screen shot showing the strength set to 0 via the inspector and no issues , then the strength set to max , to show the bug.

My scene needs SSAO by obviously not this byproduct , any suggestions for anyone would be much appreciated.

There is a problem with the GeometryBufferRenderer when dealing with alpha-enabled objects.

This PR should fix the problem:

Note that you will have to choose either “Alpha Test” or “Alpha Blend and Test” for the transparencyMode property for this to work.

You can also completely remove the transparent objects from the SSAO layer by doing:

scene.enableGeometryBufferRenderer().renderTransparentMeshes = false;
3 Likes

SOrry to be such a github noob but im not really sure how to get hold of your fix. Currently I need the code to be offline for an dual web/electron app so I dont use a CDN script fetch , im referencing local babylon js files. SO I obviously need to have those files have this fix in them

I did try :

scene.enableGeometryBufferRenderer().renderTransparentMeshes = false;

but obviously this must be code related to your new code additions/fixes because I didnt see it make a difference.

Anyway if you would be so kind as to point me in the right direction i will be very thankful.

cheers

No, this one is not related to the fix, it should work.

Regarding the fix, it must be merged to the core before being available.

As I can see it, it’s done, so you can retrieve the bundle files you need from here: Babylon.js/dist/preview release at master · BabylonJS/Babylon.js · GitHub

thanks very very much

All seems to be working now :wink:

cheers