Transparent shader "shine"?

Hi, I have this problem that with some of these transparent parts I have in models they have this “shine” reflection in them when viewed from below this is most apparent, is this just an issue with my shader? (Applied in blender script) or is this also preventable by some viewer setting?

image
image

Without a repro it’s hard to tell what’s going on. It seems there are some triangles that should not be there…

1 Like

If you are using PBRMaterial you could set useSpecularOverAlpha and useRadianceOverAlpha to false to prevent this behavior, in StandardMaterial it would only be useSpecularOverAlpha .

2 Likes

Ehm, I am not sure how to access the material? I used load async previously but now wish meshtask I can only look at loadedMeshes which as _material and _effectiveMaterial but I cannot access this?

var viewerMeshTask = VIEWER_assetsManager.addMeshTask("loadViewerModel", "", BABYLON_path, BABYLON_file);
            viewerMeshTask.onSuccess = function (task) {

                    console.log(task.loadedMeshes);
                for(i = 0; i < task.loadedMeshes.length; i++) {
                    task.loadedMeshes[i]._material.useRadianceOverAlpha = false;
                    task.loadedMeshes[i]._material.useSpecularOverAlpha = false;
                }

Use .material instead of ._material, that should work.

1 Like

Already tried that the first time, it says it is null?

Tried to make a playground load the model but can’t even get success or error to work here? Works fine on my backend like this…

You need to issue a load on the asset manager: assetsManager.load();

The PG does not work because the files need to be served from https, not http.

This page can help you hosting your assets for use in the PG: Using External Assets In the Playground | Babylon.js Documentation

1 Like

Alright so, for some reason .material was not set on some meshes, not sure how that works but I added a loop in my lighting functions that loops all meshes disables the properties sebavan mentioned and it appears to work.

for(i = 0; i < scene.meshes.length; i++) {
        if(scene.meshes[i]) {
            let material = scene.meshes[i].material;
            if(material != null) {
                material.useSpecularOverAlpha = false;
                material.useRadianceOverAlpha = false;
            }
        }
    }
1 Like