Turn off refraction overall in all materials / scene

Hi there,

if i turn of Refraction in inspector (debug, “core texture channels”) my drawcalls reduce about 40%!
But what happens exactly when i use the inspector to turn off the refraction?

RefractionTextureEnabled is only avaliable in StandardMaterials, but i only use PBR.

How can i disable Refraction in my complete scene?

Kind Regards

stefan

RefractionTextureEnabled will actually work for both materials.

Reducing draw call by this much makes sense as with refraction we actually need to render the scene into a renderTarget a second time :slight_smile:

1 Like

thx for your fast reply.

I tried this:

scene.materials.forEach(function(mat){
     mat.RefractionTextureEnabled=false;
})

but it has no effect on draw-calls.
What else i have to do?

THX

it is a global flag only so to use with StandardMaterial.RefractionTextureEnabled = false despite impacting PBR as well :slight_smile: mostly related to historical reasons :slight_smile:

Hi,

means

var stdMat = new BABYLON.StandardMaterial("default", scene);
stdMat.RefractionTextureEnabled = false;

should disable refraction global?

BABYLON.StandardMaterial.RefractionTextureEnabled = false;

In your case / js

2 Likes