user1652613
user1652613

Reputation: 76

Controlling refraction with MeshStandardMaterial

So I have very basic setup:

var cubeCamera = new THREE.CubeCamera (1, 1000, 1024);
cubeCamera.renderTarget.texture.minFilter = THREE.LinearMipMapLinearFilter;
cubeCamera.renderTarget.texture.mapping = THREE.CubeRefractionMapping;
cubeCamera.updateCubeMap (renderer, scene);

var matte = new THREE.MeshStandardMaterial({
    envMap: cubeCamera.renderTarget.texture,
    metalness: 0.5,
    roughness: 0.4
});

and this creates correctly blurred refraction. However, driving metalness to 0 makes it vanish almost completely, making the material seem fully opaque. What is correct way to set up matte refractive material?

Upvotes: 0

Views: 835

Answers (1)

WestLangley
WestLangley

Reputation: 104833

You are trying to use MeshStandardMaterial to create a translucent and refractive non-metallic material. You are setting metalness to zero, or near zero.

Non-metals typically have a low specular reflectance. That means the specular reflections from the environment are minimal — certainly compared to metals. Consequently, MeshStandardMaterial has been designed to have similar properties.

You have two options.

The first option is to compensate by increasing material.envMapIntensity, which defaults to 1. This simulates a brighter environment.

A second option is to use the more feature-rich MeshPhysicalMaterial, instead.

MeshPhysicalMaterial has an additional material.reflectivity property which controls the specular reflectance for non-metals. For physically-based materials, setting this property to 1 is a reasonable maximum value, but you can increase it further if you want.

three.js r.86

Upvotes: 1

Related Questions