diff --git a/examples/assets/models/playbot/26020273/Playbot_head.json b/examples/assets/models/playbot/26020273/Playbot_head.json index 0ddd66245ae..7b7fc1b6579 100644 --- a/examples/assets/models/playbot/26020273/Playbot_head.json +++ b/examples/assets/models/playbot/26020273/Playbot_head.json @@ -1 +1 @@ -{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020286/head_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020277/head_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020276/head_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"conserveEnergy":true,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file +{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020286/head_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020277/head_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020276/head_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file diff --git a/examples/assets/models/playbot/26020274/Playbot_body.json b/examples/assets/models/playbot/26020274/Playbot_body.json index 8182ada2b15..d186e0fae47 100644 --- a/examples/assets/models/playbot/26020274/Playbot_body.json +++ b/examples/assets/models/playbot/26020274/Playbot_body.json @@ -1 +1 @@ -{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020287/body_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020288/body_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020280/body_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"conserveEnergy":true,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file +{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020287/body_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020288/body_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020280/body_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file diff --git a/examples/assets/models/playbot/26020283/Playbot_arm.json b/examples/assets/models/playbot/26020283/Playbot_arm.json index 71c5dbfb9b1..fb151aa65a9 100644 --- a/examples/assets/models/playbot/26020283/Playbot_arm.json +++ b/examples/assets/models/playbot/26020283/Playbot_arm.json @@ -1 +1 @@ -{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020279/arm_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020281/arm_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020289/arm_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"conserveEnergy":true,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file +{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020279/arm_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020281/arm_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020289/arm_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file diff --git a/examples/assets/models/playbot/26020285/Playbot_leg.json b/examples/assets/models/playbot/26020285/Playbot_leg.json index d72b7605725..37e7eafdb83 100644 --- a/examples/assets/models/playbot/26020285/Playbot_leg.json +++ b/examples/assets/models/playbot/26020285/Playbot_leg.json @@ -1 +1 @@ -{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020290/leg_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020284/leg_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020282/leg_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"conserveEnergy":true,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file +{"shader":"blinn","ambient":[0.588,0.588,0.588],"diffuse":[0.588,0.588,0.588],"diffuseMap":"../26020290/leg_clean.png","diffuseMapOffset":[0,0],"diffuseMapTiling":[1,1],"specular":[0.9,0.9,0.9],"shininess":90.9091,"emissive":[0,0,0],"emissiveMap":"../26020284/leg_E.png","emissiveMapOffset":[0,0],"emissiveMapTiling":[1,1],"normalMap":"../26020282/leg_N_clean.png","normalMapOffset":[0,0],"normalMapTiling":[1,1],"bumpMapFactor":0.3,"opacity":1,"sphereMap":"../26020278/env_01.png","reflectivity":0.2,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveIntensity":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"mapping_format":"path"} \ No newline at end of file diff --git a/src/scene/materials/lit-material-options-builder.js b/src/scene/materials/lit-material-options-builder.js index e1d6adaf45a..3b93fae235c 100644 --- a/src/scene/materials/lit-material-options-builder.js +++ b/src/scene/materials/lit-material-options-builder.js @@ -2,7 +2,7 @@ import { CUBEPROJ_NONE, LIGHTTYPE_DIRECTIONAL, LIGHTTYPE_OMNI, LIGHTTYPE_SPOT, MASK_AFFECT_DYNAMIC, TONEMAP_NONE, SHADERDEF_INSTANCING, SHADERDEF_MORPH_NORMAL, SHADERDEF_MORPH_POSITION, SHADERDEF_MORPH_TEXTURE_BASED, SHADERDEF_SCREENSPACE, SHADERDEF_SKIN, - SHADERDEF_NOSHADOW, SHADERDEF_TANGENTS, SPECULAR_BLINN, SPRITE_RENDERMODE_SIMPLE + SHADERDEF_NOSHADOW, SHADERDEF_TANGENTS, SPRITE_RENDERMODE_SIMPLE } from "../constants.js"; class LitMaterialOptionsBuilder { @@ -67,7 +67,6 @@ class LitMaterialOptionsBuilder { litOptions.cubeMapProjection = CUBEPROJ_NONE; - litOptions.conserveEnergy = material.conserveEnergy && material.shadingModel === SPECULAR_BLINN; litOptions.useSpecular = material.hasSpecular; litOptions.useSpecularityFactor = material.hasSpecularityFactor; litOptions.enableGGXSpecular = material.ggxSpecular; diff --git a/src/scene/materials/lit-material.js b/src/scene/materials/lit-material.js index 17ca97e8f73..7bd9c8b4cdd 100644 --- a/src/scene/materials/lit-material.js +++ b/src/scene/materials/lit-material.js @@ -57,8 +57,6 @@ class LitMaterial extends Material { opacityShadowDither = DITHER_NONE; - conserveEnergy = true; - ggxSpecular = false; fresnelModel = FRESNEL_SCHLICK; diff --git a/src/scene/materials/standard-material-options-builder.js b/src/scene/materials/standard-material-options-builder.js index e4216968136..9897bd07c5c 100644 --- a/src/scene/materials/standard-material-options-builder.js +++ b/src/scene/materials/standard-material-options-builder.js @@ -276,7 +276,6 @@ class StandardMaterialOptionsBuilder { options.litOptions.cubeMapProjection = stdMat.cubeMapProjection; options.litOptions.occludeDirect = stdMat.occludeDirect; - options.litOptions.conserveEnergy = stdMat.conserveEnergy; options.litOptions.useSpecular = useSpecular; options.litOptions.useSpecularityFactor = (specularityFactorTint || !!stdMat.specularityFactorMap) && stdMat.useMetalnessSpecularColor; options.litOptions.enableGGXSpecular = stdMat.enableGGXSpecular; diff --git a/src/scene/materials/standard-material-parameters.js b/src/scene/materials/standard-material-parameters.js index 70b2f004080..3c1385673f9 100644 --- a/src/scene/materials/standard-material-parameters.js +++ b/src/scene/materials/standard-material-parameters.js @@ -50,7 +50,6 @@ const standardMaterialParameterTypes = { ..._textureParameter('metalness'), useMetalnessSpecularColor: 'boolean', - conserveEnergy: 'boolean', shininess: 'number', gloss: 'number', glossInvert: 'boolean', diff --git a/src/scene/materials/standard-material.js b/src/scene/materials/standard-material.js index 37290040280..ba9b631d90f 100644 --- a/src/scene/materials/standard-material.js +++ b/src/scene/materials/standard-material.js @@ -519,16 +519,12 @@ const _tempColor = new Color(); * @property {number} occludeSpecularIntensity Controls visibility of specular occlusion. * @property {boolean} occludeDirect Tells if AO should darken directional lighting. Defaults to * false. - * @property {boolean} conserveEnergy Defines how diffuse and specular components are combined when - * Fresnel is on. It is recommended that you leave this option enabled, although you may want to - * disable it in case when all reflection comes only from a few light sources, and you don't use an - * environment map, therefore having mostly black reflection. * @property {number} shadingModel Defines the shading model. * - {@link SPECULAR_BLINN}: Energy-conserving Blinn-Phong. * @property {number} fresnelModel Defines the formula used for Fresnel effect. * As a side-effect, enabling any Fresnel model changes the way diffuse and reflection components * are combined. When Fresnel is off, legacy non energy-conserving combining is used. When it is - * on, combining behavior is defined by conserveEnergy parameter. + * on, combining behavior is energy-conserving. * * - {@link FRESNEL_NONE}: No Fresnel. * - {@link FRESNEL_SCHLICK}: Schlick's approximation of Fresnel (recommended). Parameterized by @@ -1219,7 +1215,6 @@ function _defineMaterialProps() { _defineFlag('enableGGXSpecular', false); _defineFlag('occludeDirect', false); _defineFlag('normalizeNormalMap', true); - _defineFlag('conserveEnergy', true); _defineFlag('opacityFadesSpecular', true); _defineFlag('occludeSpecular', SPECOCC_AO); _defineFlag('shadingModel', SPECULAR_BLINN); diff --git a/src/scene/shader-lib/chunks/chunk-validation.js b/src/scene/shader-lib/chunks/chunk-validation.js index 4bd836c5b9d..2089bb37ae0 100644 --- a/src/scene/shader-lib/chunks/chunk-validation.js +++ b/src/scene/shader-lib/chunks/chunk-validation.js @@ -99,7 +99,6 @@ const removedChunks = { combineDiffuseSpecularNoReflPS: CHUNKAPI_1_56, combineDiffuseSpecularNoReflSeparateAmbientPS: CHUNKAPI_1_56, combineDiffuseSpecularOldPS: CHUNKAPI_1_56, - combineDiffuseSpecularNoConservePS: CHUNKAPI_1_55, lightmapSingleVertPS: CHUNKAPI_1_55, normalMapFastPS: CHUNKAPI_1_55, specularAaNonePS: CHUNKAPI_1_55, diff --git a/src/scene/shader-lib/chunks/lit/frag/clusteredLight.js b/src/scene/shader-lib/chunks/lit/frag/clusteredLight.js index 72bb176455a..9dafcd81d10 100644 --- a/src/scene/shader-lib/chunks/lit/frag/clusteredLight.js +++ b/src/scene/shader-lib/chunks/lit/frag/clusteredLight.js @@ -397,9 +397,7 @@ void evaluateLight( vec3 areaDiffuse = (diffuseAttenuation * falloffAttenuation) * light.color * cookieAttenuation; #if defined(LIT_SPECULAR) - #if defined(LIT_CONSERVE_ENERGY) - areaDiffuse = mix(areaDiffuse, vec3(0), dLTCSpecFres); - #endif + areaDiffuse = mix(areaDiffuse, vec3(0), dLTCSpecFres); #endif // area light diffuse - it does not mix diffuse lighting into specular attenuation @@ -453,11 +451,9 @@ void evaluateLight( #if defined(CLUSTER_AREALIGHTS) #if defined(LIT_SPECULAR) - #if defined(LIT_CONSERVE_ENERGY) punctualDiffuse = mix(punctualDiffuse, vec3(0), specularity); #endif #endif - #endif dDiffuseLight += punctualDiffuse; } diff --git a/src/scene/shader-lib/programs/lit-shader-options.js b/src/scene/shader-lib/programs/lit-shader-options.js index c44e4014c40..fee7edc3281 100644 --- a/src/scene/shader-lib/programs/lit-shader-options.js +++ b/src/scene/shader-lib/programs/lit-shader-options.js @@ -193,13 +193,6 @@ class LitShaderOptions { */ cubeMapProjection = 0; - /** - * The value of {@link StandardMaterial#conserveEnergy}. - * - * @type {boolean} - */ - conserveEnergy = false; - /** * If any specular or reflections are needed at all. * diff --git a/src/scene/shader-lib/programs/lit-shader.js b/src/scene/shader-lib/programs/lit-shader.js index 30095e02495..3b6c80dd035 100644 --- a/src/scene/shader-lib/programs/lit-shader.js +++ b/src/scene/shader-lib/programs/lit-shader.js @@ -593,11 +593,6 @@ class LitShader { this.defines.push("LIT_SPECULAR_FRESNEL"); } - // enable conserve energy path in clustered chunk - if (options.conserveEnergy) { - this.defines.push("LIT_CONSERVE_ENERGY"); - } - if (options.useSheen) { this.defines.push("LIT_SHEEN"); } @@ -1019,7 +1014,7 @@ class LitShader { if (addAmbient) { backend.append(" addAmbient(litArgs_worldNormal);"); - if (options.conserveEnergy && options.useSpecular) { + if (options.useSpecular) { backend.append(` dDiffuseLight = dDiffuseLight * (1.0 - litArgs_specularity);`); } @@ -1306,7 +1301,7 @@ class LitShader { if (lightShape !== LIGHTSHAPE_PUNCTUAL) { // area light - they do not mix diffuse lighting into specular attenuation - if (options.conserveEnergy && options.useSpecular) { + if (options.useSpecular) { backend.append(" dDiffuseLight += ((dAttenD * dAtten) * light" + i + "_color" + (usesCookieNow ? " * dAtten3" : "") + ") * (1.0 - dLTCSpecFres);"); } else { backend.append(" dDiffuseLight += (dAttenD * dAtten) * light" + i + "_color" + (usesCookieNow ? " * dAtten3" : "") + ";"); @@ -1314,7 +1309,7 @@ class LitShader { } else { // punctual light - if (hasAreaLights && options.conserveEnergy && options.useSpecular) { + if (hasAreaLights && options.useSpecular) { backend.append(" dDiffuseLight += (dAtten * light" + i + "_color" + (usesCookieNow ? " * dAtten3" : "") + ") * (1.0 - litArgs_specularity);"); } else { backend.append(" dDiffuseLight += dAtten * light" + i + "_color" + (usesCookieNow ? " * dAtten3" : "") + ";"); diff --git a/test/scene/materials/standard-material.test.mjs b/test/scene/materials/standard-material.test.mjs index 768a92efe6c..a96f5f2f7f0 100644 --- a/test/scene/materials/standard-material.test.mjs +++ b/test/scene/materials/standard-material.test.mjs @@ -83,8 +83,6 @@ describe('StandardMaterial', function () { expect(material.clearCoatVertexColor).to.equal(false); expect(material.clearCoatVertexColorChannel).to.equal('g'); - expect(material.conserveEnergy).to.equal(true); - expect(material.cubeMap).to.be.null; expect(material.cubeMapProjection).to.equal(CUBEPROJ_NONE); expect(material.cubeMapProjectionBox).to.be.null; diff --git a/test/test-assets/box/1/Box Material.json b/test/test-assets/box/1/Box Material.json index cdb7263a0c0..5f0bed20058 100644 --- a/test/test-assets/box/1/Box Material.json +++ b/test/test-assets/box/1/Box Material.json @@ -61,7 +61,6 @@ 0 ], "metalness": 1, - "conserveEnergy": true, "glossMapChannel": "r", "glossMapTiling": [ 1, diff --git a/test/test-assets/plane/31208636/lambert1.json b/test/test-assets/plane/31208636/lambert1.json index 25bdba50daa..d0d5a544dd6 100644 --- a/test/test-assets/plane/31208636/lambert1.json +++ b/test/test-assets/plane/31208636/lambert1.json @@ -1 +1 @@ -{"shader":"blinn","ambient":[0,0,0],"diffuse":[0.4,0.4,0.4],"specular":[0,0,0],"emissive":[0,0,0],"opacity":1,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","diffuseMapTiling":[1,1],"diffuseMapOffset":[0,0],"specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"conserveEnergy":true,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveMapTiling":[1,1],"emissiveMapOffset":[0,0],"emissiveIntensity":1,"normalMapTiling":[1,1],"normalMapOffset":[0,0],"bumpMapFactor":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"reflectivity":1,"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"useTonemap":true,"mapping_format":"path"} \ No newline at end of file +{"shader":"blinn","ambient":[0,0,0],"diffuse":[0.4,0.4,0.4],"specular":[0,0,0],"emissive":[0,0,0],"opacity":1,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","diffuseMapTiling":[1,1],"diffuseMapOffset":[0,0],"specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveMapTiling":[1,1],"emissiveMapOffset":[0,0],"emissiveIntensity":1,"normalMapTiling":[1,1],"normalMapOffset":[0,0],"bumpMapFactor":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"reflectivity":1,"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"useTonemap":true,"mapping_format":"path"} \ No newline at end of file diff --git a/tests/test-assets/box/1/Box Material.json b/tests/test-assets/box/1/Box Material.json index cdb7263a0c0..5f0bed20058 100644 --- a/tests/test-assets/box/1/Box Material.json +++ b/tests/test-assets/box/1/Box Material.json @@ -61,7 +61,6 @@ 0 ], "metalness": 1, - "conserveEnergy": true, "glossMapChannel": "r", "glossMapTiling": [ 1, diff --git a/tests/test-assets/plane/31208636/lambert1.json b/tests/test-assets/plane/31208636/lambert1.json index 25bdba50daa..d0d5a544dd6 100644 --- a/tests/test-assets/plane/31208636/lambert1.json +++ b/tests/test-assets/plane/31208636/lambert1.json @@ -1 +1 @@ -{"shader":"blinn","ambient":[0,0,0],"diffuse":[0.4,0.4,0.4],"specular":[0,0,0],"emissive":[0,0,0],"opacity":1,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","diffuseMapTiling":[1,1],"diffuseMapOffset":[0,0],"specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"conserveEnergy":true,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveMapTiling":[1,1],"emissiveMapOffset":[0,0],"emissiveIntensity":1,"normalMapTiling":[1,1],"normalMapOffset":[0,0],"bumpMapFactor":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"reflectivity":1,"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"useTonemap":true,"mapping_format":"path"} \ No newline at end of file +{"shader":"blinn","ambient":[0,0,0],"diffuse":[0.4,0.4,0.4],"specular":[0,0,0],"emissive":[0,0,0],"opacity":1,"aoMapChannel":"r","aoMapTiling":[1,1],"aoMapOffset":[0,0],"occludeSpecular":1,"diffuseMapChannel":"rgb","diffuseMapTiling":[1,1],"diffuseMapOffset":[0,0],"specularMapChannel":"rgb","specularMapTiling":[1,1],"specularMapOffset":[0,0],"specularAntialias":true,"metalnessMapChannel":"r","metalnessMapTiling":[1,1],"metalnessMapOffset":[0,0],"metalness":1,"glossMapChannel":"r","glossMapTiling":[1,1],"glossMapOffset":[0,0],"emissiveMapChannel":"rgb","emissiveMapTiling":[1,1],"emissiveMapOffset":[0,0],"emissiveIntensity":1,"normalMapTiling":[1,1],"normalMapOffset":[0,0],"bumpMapFactor":1,"heightMapChannel":"r","heightMapTiling":[1,1],"heightMapOffset":[0,0],"heightMapFactor":1,"opacityMapChannel":"r","opacityMapTiling":[1,1],"opacityMapOffset":[0,0],"reflectivity":1,"refractionIndex":0.6666666666666666,"cubeMapProjectionBox":{"center":[0,0,0],"halfExtents":[0.5,0.5,0.5]},"lightMapChannel":"rgb","lightMapUv":1,"lightMapTiling":[1,1],"lightMapOffset":[0,0],"depthTest":true,"depthWrite":true,"cull":1,"blendType":3,"shadowSampleType":1,"useFog":true,"useLighting":true,"useSkybox":true,"useTonemap":true,"mapping_format":"path"} \ No newline at end of file diff --git a/utils/plugins/rollup-types-fixup.mjs b/utils/plugins/rollup-types-fixup.mjs index f26091e41e2..0b465802fe2 100644 --- a/utils/plugins/rollup-types-fixup.mjs +++ b/utils/plugins/rollup-types-fixup.mjs @@ -52,7 +52,6 @@ const STANDARD_MAT_PROPS = [ ['clearCoatNormalMapUv', 'number'], ['clearCoatVertexColor', 'boolean'], ['clearCoatVertexColorChannel', 'string'], - ['conserveEnergy', 'boolean'], ['cubeMap', 'Texture|null'], ['cubeMapProjection', 'number'], ['cubeMapProjectionBox', 'BoundingBox'],