Hi guys I set scene.environment = null
then all meshes in scene color change black like below screenshot
but Directional Light, Ambient Light still exist in scene
is there any idea why meshes looks black?
Hi guys I set scene.environment = null
then all meshes in scene color change black like below screenshot
If the meshes have high metalness / low roughness - they will appear black, since they have no environment map to reflect.
If that’s not the case - could you show how the meshes are created?
the shadow is work,i think is texture problem,try to set transparent:true
yepp that’s the case right I understand but
https://threejs.org/examples/?q=light#webgl_lights_physical
This example make a shadow from only light
and then How to don’t reflect black without hdri?
once hdri set in scene, and then set null is there any way to receive shadow?
that shadow from Shadow Material of Plane Mesh I mean Mesh’s Shading from light
Do either this:
gltf.scene.traverse(child => {
if (child.material) {
child.material.metalness = 0.0;
}
});
Or this:
gltf.scene.traverse(child => {
if (child.material) {
child.material.roughness = 1.0;
}
});
Keep in mind each gives a slightly different visual effect (metalness set to 0 should look kinda like just using Phong; roughness set to 1 give a crazy smooth looks, but combined with metalness it will also make the surface look way way darker.)
For pbr material need envmap
I found it
Here’s My code
renderer.toneMapping = THREE.ACESFilmicToneMapping
scene.environment = null
renderer.toneMappingExposure = 1
Setting toneMapping Options after scene.environment set null causes looks all black
The code below works
renderer.toneMapping = THREE.ACESFilmicToneMapping
renderer.toneMappingExposure = 1
scene.environment = null
I wanted to know why, so I checked the THREE.WebGLRenderer source code to see what happens when I put a number in renderer.exposure.
when renderer.toneMappingExposure set,
Inside of WebGLRenderer.setProgram
let refreshMaterial = false;
let refreshLights = false;
const p_uniforms = program.getUniforms(),
m_uniforms = materialProperties.uniforms;
if ( state.useProgram( program.program ) ) {
refreshProgram = true;
refreshMaterial = true;
refreshLights = true;
}
program state changed so refreshMaterial set true
if ( refreshMaterial ) {
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
toneMappingExposure set in shader
At ShaerChunk’s toneMapping shader
uniform has set and material’s color multiplied toneMappingExposure
but I set environment null so zero multiply then color 0x000000
uniform float toneMappingExposure;
// exposure only
vec3 LinearToneMapping( vec3 color ) {
return toneMappingExposure * color;
}
// source: https://www.cs.utah.edu/docs/techreports/2002/pdf/UUCS-02-001.pdf
vec3 ReinhardToneMapping( vec3 color ) {
color *= toneMappingExposure;
return saturate( color / ( vec3( 1.0 ) + color ) );
}
// source: http://filmicworlds.com/blog/filmic-tonemapping-operators/
vec3 OptimizedCineonToneMapping( vec3 color ) {
// optimized filmic operator by Jim Hejl and Richard Burgess-Dawson
color *= toneMappingExposure;
color = max( vec3( 0.0 ), color - 0.004 );
return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}