in revision 104 light probe was added which messes up my sparse geometries Github issue .
Is there a method to turn it off?
Karl
in revision 104 light probe was added which messes up my sparse geometries Github issue .
Is there a method to turn it off?
Karl
There is no flag that allows to enable/disable support for light probes. However, you can try to monkey-patch the respective shader chunks with Material.onBeforeCompile(). This is more or less the most basic approach for modifying build-in materials. The following example demonstrate the usage:
thank you. Would this be an acceptable feature request for github? I aprerciate the time and effort you put in to help me on this.
No. The project does not want to promote to shutdown essential lighting entities.
Since I know the background of your actual issue, I think you are heading in the wrong direction with this. The suggestion made by WestLangely (using an additional attribute that controls the visibility) sounds way better and avoids any modification to the library.
The first step of this idea is to provide the respective buffer data which controls the visibility per vertex. The actual attribute would look like so:
const visibilityAttribute = new THREE.Uint32BufferAttribute( data, 1 );
geometry.setAttribute( 'visibility', visibilityAttribute );
You can then inject an additional attribute in the vertex shader and provide it as a varying in the fragment shader for evaluation.
Ok I’ll give it a whack.
Is a light probe essential? Seems like useless overhead unless you actually use it; sort of like shadows or transparency? Or am i wrong?
It’s a basic building block for 3D lighting and implemented according to other light types. If you are not using light probes in your scene, the existing engine overhead is not noticeable.
Still think should have a switch.
Easy fix for anyone needing is to remove the call in light_fragment_begin for function getLightProbeIrradiance();
Then don’t use a light probe(not documented in documentation, but only as an example)
material.onBeforeCompile = function (shader) {
shader.uniforms.time = {
value: 0
};
shader.fragmentShader = 'uniform float time;\n' + shader.fragmentShader;
shader.fragmentShader = shader.fragmentShader.replace(
'#include <lights_fragment_begin>',
"\nGeometricContext geometry;\ngeometry.position = - vViewPosition;\ngeometry.normal = normal;\ngeometry.viewDir = normalize( vViewPosition );\nIncidentLight directLight;\n#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )\n\tPointLight pointLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {\n\t\tpointLight = pointLights[ i ];\n\t\tgetPointDirectLightIrradiance( pointLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( pointLight.shadow, directLight.visible ) ) ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )\n\tSpotLight spotLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {\n\t\tspotLight = spotLights[ i ];\n\t\tgetSpotDirectLightIrradiance( spotLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( spotLight.shadow, directLight.visible ) ) ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowBias, spotLight.shadowRadius, vSpotShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )\n\tDirectionalLight directionalLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {\n\t\tdirectionalLight = directionalLights[ i ];\n\t\tgetDirectionalDirectLightIrradiance( directionalLight, geometry, directLight );\n\t\t#ifdef USE_SHADOWMAP\n\t\tdirectLight.color *= all( bvec2( directionalLight.shadow, directLight.visible ) ) ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;\n\t\t#endif\n\t\tRE_Direct( directLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )\n\tRectAreaLight rectAreaLight;\n\t#pragma unroll_loop\n\tfor ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {\n\t\trectAreaLight = rectAreaLights[ i ];\n\t\tRE_Direct_RectArea( rectAreaLight, geometry, material, reflectedLight );\n\t}\n#endif\n#if defined( RE_IndirectDiffuse )\n\tvec3 irradiance = getAmbientLightIrradiance( ambientLightColor );\n\t#if ( NUM_HEMI_LIGHTS > 0 )\n\t\t#pragma unroll_loop\n\t\tfor ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {\n\t\t\tirradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometry );\n\t\t}\n\t#endif\n#endif\n#if defined( RE_IndirectSpecular )\n\tvec3 radiance = vec3( 0.0 );\n\tvec3 clearCoatRadiance = vec3( 0.0 );\n#endif"
);
};
thanks @Mugen87. I appreciate your patience.