Hi,
I’ve recently been struggling with trying to implement a glass material in one of my meshes.
I checked out this code https://playground.babylonjs.com/#19JGPR#13 and tried to create a similar material in my project, but for some reason, my glass remains gray ( this is my PG https://playground.babylonjs.com/#643TJF#1 ). If I bring the mesh into the sandbox, and just go to the glass material and change it’s opacity, it looks good enough Capture — ImgBB but if I try to do that in code, I am still stuck with gray windows.
Anybody has any idea what am I doing wrong?
The mesh is named “Glass” and not “Ap2Glass” in the scene, and you should use ImportMesh
instead of ImportMeshAsync
with the syntax you use:
https://playground.babylonjs.com/#643TJF#2
[EDIT] Note that for a proper usage of room.hdr as an env map, you should pass true
for the prefilterOnLoad
parameter of the constructor:
https://playground.babylonjs.com/#643TJF#3
3 Likes
@Evgeni_Popov you rock !!!
1 Like
Oh my god, I feel so stupid now. Been struggling with this the whole day, and I can t believe I never re-checked the mesh name. Everything works now, thanks a lot
1 Like