From 508bbff54eda57db5d2c9ac0d2734eeb656898a3 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:11:30 +0100 Subject: [PATCH 01/11] Add Base Weight uniform parameter --- packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts | 6 ++++++ packages/dev/core/src/Materials/PBR/pbrMaterial.ts | 4 ++++ .../Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx | 3 ++- .../Shaders/ShadersInclude/pbrFragmentDeclaration.fx | 1 + .../src/Shaders/ShadersInclude/pbrUboDeclaration.fx | 1 + packages/dev/core/src/Shaders/pbr.fragment.fx | 5 +++-- .../ShadersInclude/pbrBlockAlbedoOpacity.fx | 1 + .../ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx | 1 + packages/dev/core/src/ShadersWGSL/pbr.fragment.fx | 1 + .../materials/pbrMaterialPropertyGridComponent.tsx | 10 ++++++++++ 10 files changed, 30 insertions(+), 3 deletions(-) diff --git a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts index ae3d9e551da..f9917fdb8aa 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts @@ -559,6 +559,8 @@ export abstract class PBRBaseMaterial extends PushMaterial { */ public _albedoColor = new Color3(1, 1, 1); + public _baseWeight = 1; + /** * AKA Specular Color in other nomenclature. * @internal @@ -1413,6 +1415,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { "vLightsType", "vAmbientColor", "vAlbedoColor", + "vBaseWeight", "vReflectivityColor", "vMetallicReflectanceFactors", "vEmissiveColor", @@ -2005,6 +2008,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { ubo.addUniform("vReflectionColor", 3); ubo.addUniform("vAlbedoColor", 4); + ubo.addUniform("vBaseWeight", 1); ubo.addUniform("vLightingIntensity", 4); ubo.addUniform("vReflectionMicrosurfaceInfos", 3); @@ -2268,6 +2272,8 @@ export abstract class PBRBaseMaterial extends PushMaterial { ubo.updateColor4("vAlbedoColor", this._albedoColor, this.alpha); } + ubo.updateFloat("vBaseWeight", this._baseWeight); + // Misc this._lightingInfos.x = this._directIntensity; this._lightingInfos.y = this._emissiveIntensity; diff --git a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts index 066d69fd23a..62ad14b63d6 100644 --- a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts @@ -270,6 +270,10 @@ export class PBRMaterial extends PBRBaseMaterial { @expandToProperty("_markAllSubMeshesAsTexturesDirty") public albedoColor = new Color3(1, 1, 1); + @serializeAsColor3("baseWeight") + @expandToProperty("_markAllSubMeshesAsTexturesDirty") + public baseWeight = 1; + /** * AKA Specular Color in other nomenclature. */ diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx index 9b6827b904a..8e44993c183 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -11,6 +11,7 @@ albedoOpacityOutParams albedoOpacityBlock( ,in vec4 albedoTexture ,in vec2 albedoInfos #endif + , in float vBaseWeight #ifdef OPACITY ,in vec4 opacityMap ,in vec2 vOpacityInfos @@ -22,7 +23,7 @@ albedoOpacityOutParams albedoOpacityBlock( #ifdef DECAL ,in vec4 decalColor ,in vec4 vDecalInfos -#endif +#endif ) { albedoOpacityOutParams outParams; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx index b2b55b6bd9f..7b75f80b84b 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx @@ -2,6 +2,7 @@ uniform vec4 vEyePosition; uniform vec3 vReflectionColor; uniform vec4 vAlbedoColor; +uniform float vBaseWeight; // CUSTOM CONTROLS uniform vec4 vLightingIntensity; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx index 8a513b2b4ef..143ee0da107 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx @@ -47,6 +47,7 @@ uniform Material { mat4 reflectionMatrix; vec3 vReflectionColor; vec4 vAlbedoColor; + float vBaseWeight; vec4 vLightingIntensity; vec3 vReflectionMicrosurfaceInfos; float pointSize; diff --git a/packages/dev/core/src/Shaders/pbr.fragment.fx b/packages/dev/core/src/Shaders/pbr.fragment.fx index a2daa5c1479..ba44723e6de 100644 --- a/packages/dev/core/src/Shaders/pbr.fragment.fx +++ b/packages/dev/core/src/Shaders/pbr.fragment.fx @@ -104,6 +104,7 @@ void main(void) { , albedoTexture , vAlbedoInfos #endif + , vBaseWeight #ifdef OPACITY , opacityMap , vOpacityInfos @@ -138,7 +139,7 @@ void main(void) { #ifdef AMBIENT ambientOcclusionColorMap, vAmbientInfos - #endif + #endif ); #include @@ -257,7 +258,7 @@ void main(void) { #endif TBN, normalW, - viewDirectionW + viewDirectionW ); #endif diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx index da3bd45fd27..0f7112953c3 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -11,6 +11,7 @@ fn albedoOpacityBlock( ,albedoTexture: vec4f ,albedoInfos: vec2f #endif + , vBaseWeight: f32 #ifdef OPACITY ,opacityMap: vec4f ,vOpacityInfos: vec2f diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx index 575e575c1bc..04223907da2 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx @@ -22,6 +22,7 @@ uniform vTangentSpaceParams: vec2f; uniform reflectionMatrix: mat4x4f; uniform vReflectionColor: vec3f; uniform vAlbedoColor: vec4f; +uniform vBaseWeight: f32; uniform vLightingIntensity: vec4f; uniform vReflectionMicrosurfaceInfos: vec3f; uniform pointSize: f32; diff --git a/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx b/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx index b5d109e0945..d303658d2f5 100644 --- a/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx +++ b/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx @@ -89,6 +89,7 @@ fn main(input: FragmentInputs) -> FragmentOutputs { , albedoTexture , uniforms.vAlbedoInfos #endif + , uniforms.baseWeight #ifdef OPACITY , opacityMap , uniforms.vOpacityInfos diff --git a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx index 39134c32905..4f87e3448bf 100644 --- a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx +++ b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx @@ -273,6 +273,16 @@ export class PBRMaterialPropertyGridComponent extends React.Component + Date: Fri, 17 Jan 2025 17:11:44 +0100 Subject: [PATCH 02/11] Add Base Weight texture --- .../core/src/Materials/PBR/pbrBaseMaterial.ts | 45 +++++++++++++++++++ .../dev/core/src/Materials/PBR/pbrMaterial.ts | 4 ++ .../dev/core/src/Materials/materialFlags.ts | 16 +++++++ .../ShadersInclude/pbrBlockAlbedoOpacity.fx | 6 ++- .../ShadersInclude/pbrFragmentDeclaration.fx | 8 +++- .../pbrFragmentSamplersDeclaration.fx | 7 +-- .../ShadersInclude/pbrUboDeclaration.fx | 2 + .../ShadersInclude/pbrVertexDeclaration.fx | 14 +++++- packages/dev/core/src/Shaders/pbr.fragment.fx | 8 ++++ packages/dev/core/src/Shaders/pbr.vertex.fx | 2 + .../ShadersInclude/pbrBlockAlbedoOpacity.fx | 6 ++- .../pbrFragmentSamplersDeclaration.fx | 7 +-- .../ShadersInclude/pbrUboDeclaration.fx | 2 + .../dev/core/src/ShadersWGSL/pbr.fragment.fx | 12 ++++- .../dev/core/src/ShadersWGSL/pbr.vertex.fx | 2 + .../pbrMaterialPropertyGridComponent.tsx | 8 ++++ 16 files changed, 135 insertions(+), 14 deletions(-) diff --git a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts index f9917fdb8aa..5d1eb476920 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts @@ -100,6 +100,9 @@ export class PBRMaterialDefines extends MaterialDefines implements IImageProcess public ALBEDODIRECTUV = 0; public VERTEXCOLOR = false; + public BASEWEIGHT = false; + public BASEWEIGHTDIRECTUV = 0; + public BAKED_VERTEX_ANIMATION_TEXTURE = false; public AMBIENT = false; @@ -417,6 +420,8 @@ export abstract class PBRBaseMaterial extends PushMaterial { */ public _albedoTexture: Nullable = null; + public _baseWeightTexture: Nullable = null; + /** * AKA Occlusion Texture in other nomenclature. * @internal @@ -1113,6 +1118,12 @@ export abstract class PBRBaseMaterial extends PushMaterial { } } + if (this._baseWeightTexture && MaterialFlags.BaseWeightTextureEnabled) { + if (!this._baseWeightTexture.isReadyOrNotBlocking()) { + return false; + } + } + if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) { if (!this._ambientTexture.isReadyOrNotBlocking()) { return false; @@ -1425,6 +1436,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { "vFogColor", "pointSize", "vAlbedoInfos", + "vBaseWeightInfos", "vAmbientInfos", "vOpacityInfos", "vReflectionInfos", @@ -1440,6 +1452,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { "vLightmapInfos", "mBones", "albedoMatrix", + "baseWeightMatrix", "ambientMatrix", "opacityMatrix", "reflectionMatrix", @@ -1481,6 +1494,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { const samplers = [ "albedoSampler", + "baseWeightSampler", "reflectivitySampler", "ambientSampler", "emissiveSampler", @@ -1615,6 +1629,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { } if (scene.texturesEnabled) { defines.ALBEDODIRECTUV = 0; + defines.BASEWEIGHTDIRECTUV = 0; defines.AMBIENTDIRECTUV = 0; defines.OPACITYDIRECTUV = 0; defines.EMISSIVEDIRECTUV = 0; @@ -1636,6 +1651,12 @@ export abstract class PBRBaseMaterial extends PushMaterial { defines.ALBEDO = false; } + if (this._baseWeightTexture && MaterialFlags.BaseWeightTextureEnabled) { + PrepareDefinesForMergedUV(this._baseWeightTexture, defines, "BASEWEIGHT"); + } else { + defines.BASEWEIGHT = false; + } + if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) { PrepareDefinesForMergedUV(this._ambientTexture, defines, "AMBIENT"); defines.AMBIENTINGRAYSCALE = this._useAmbientInGrayScale; @@ -1984,6 +2005,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { // Order is important ! const ubo = this._uniformBuffer; ubo.addUniform("vAlbedoInfos", 2); + ubo.addUniform("vBaseWeightInfos", 2); ubo.addUniform("vAmbientInfos", 4); ubo.addUniform("vOpacityInfos", 2); ubo.addUniform("vEmissiveInfos", 2); @@ -1996,6 +2018,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { ubo.addUniform("vReflectionSize", 3); ubo.addUniform("vBumpInfos", 3); ubo.addUniform("albedoMatrix", 16); + ubo.addUniform("baseWeightMatrix", 16); ubo.addUniform("ambientMatrix", 16); ubo.addUniform("opacityMatrix", 16); ubo.addUniform("emissiveMatrix", 16); @@ -2111,6 +2134,11 @@ export abstract class PBRBaseMaterial extends PushMaterial { BindTextureMatrix(this._albedoTexture, ubo, "albedo"); } + if (this._baseWeightTexture && MaterialFlags.BaseWeightTextureEnabled) { + ubo.updateFloat2("vBaseWeightInfos", this._baseWeightTexture.coordinatesIndex, this._baseWeightTexture.level); + BindTextureMatrix(this._baseWeightTexture, ubo, "baseWeight"); + } + if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) { ubo.updateFloat4( "vAmbientInfos", @@ -2296,6 +2324,10 @@ export abstract class PBRBaseMaterial extends PushMaterial { ubo.setTexture("albedoSampler", this._albedoTexture); } + if (this._baseWeightTexture && MaterialFlags.BaseWeightTextureEnabled) { + ubo.setTexture("baseWeightSampler", this._baseWeightTexture); + } + if (this._ambientTexture && MaterialFlags.AmbientTextureEnabled) { ubo.setTexture("ambientSampler", this._ambientTexture); } @@ -2430,6 +2462,10 @@ export abstract class PBRBaseMaterial extends PushMaterial { results.push(this._albedoTexture); } + if (this._baseWeightTexture && this._baseWeightTexture.animations && this._baseWeightTexture.animations.length > 0) { + results.push(this._baseWeightTexture); + } + if (this._ambientTexture && this._ambientTexture.animations && this._ambientTexture.animations.length > 0) { results.push(this._ambientTexture); } @@ -2498,6 +2534,10 @@ export abstract class PBRBaseMaterial extends PushMaterial { activeTextures.push(this._albedoTexture); } + if (this._baseWeightTexture) { + activeTextures.push(this._baseWeightTexture); + } + if (this._ambientTexture) { activeTextures.push(this._ambientTexture); } @@ -2559,6 +2599,10 @@ export abstract class PBRBaseMaterial extends PushMaterial { return true; } + if (this._baseWeightTexture === texture) { + return true; + } + if (this._ambientTexture === texture) { return true; } @@ -2638,6 +2682,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { } this._albedoTexture?.dispose(); + this._baseWeightTexture?.dispose(); this._ambientTexture?.dispose(); this._opacityTexture?.dispose(); this._reflectionTexture?.dispose(); diff --git a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts index 62ad14b63d6..73c53182e70 100644 --- a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts @@ -92,6 +92,10 @@ export class PBRMaterial extends PBRBaseMaterial { @expandToProperty("_markAllSubMeshesAsTexturesDirty") public albedoTexture: Nullable; + @serializeAsTexture() + @expandToProperty("_markAllSubMeshesAsTexturesDirty") + public baseWeightTexture: Nullable; + /** * AKA Occlusion Texture in other nomenclature. */ diff --git a/packages/dev/core/src/Materials/materialFlags.ts b/packages/dev/core/src/Materials/materialFlags.ts index 50f94702866..6bb527f6db7 100644 --- a/packages/dev/core/src/Materials/materialFlags.ts +++ b/packages/dev/core/src/Materials/materialFlags.ts @@ -22,6 +22,22 @@ export class MaterialFlags { AbstractEngine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag); } + private static _BaseWeightTextureEnabled = true; + /** + * Are diffuse textures enabled in the application. + */ + public static get BaseWeightTextureEnabled(): boolean { + return this._BaseWeightTextureEnabled; + } + public static set BaseWeightTextureEnabled(value: boolean) { + if (this._BaseWeightTextureEnabled === value) { + return; + } + + this._BaseWeightTextureEnabled = value; + AbstractEngine.MarkAllMaterialsAsDirty(Constants.MATERIAL_TextureDirtyFlag); + } + private static _DetailTextureEnabled = true; /** * Are detail textures enabled in the application. diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx index 8e44993c183..aa7e748357b 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -12,6 +12,10 @@ albedoOpacityOutParams albedoOpacityBlock( ,in vec2 albedoInfos #endif , in float vBaseWeight +#ifdef BASEWEIGHT + , in vec4 baseWeightTexture + , in vec2 vBaseWeightInfos +#endif #ifdef OPACITY ,in vec4 opacityMap ,in vec2 vOpacityInfos @@ -80,7 +84,7 @@ albedoOpacityOutParams albedoOpacityBlock( #endif #if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL) - #ifdef ALPHATEST + #ifdef ALPHATEST #if DEBUGMODE != 88 if (alpha < ALPHATESTVALUE) discard; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx index 7b75f80b84b..9d913edf0f1 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx @@ -20,6 +20,10 @@ uniform vec3 vAmbientColor; uniform vec2 vAlbedoInfos; #endif +#ifdef BASEWEIGHT +uniform vec2 vBaseWeightInfos; +#endif + #ifdef AMBIENT uniform vec4 vAmbientInfos; #endif @@ -65,14 +69,14 @@ uniform mat4 view; #if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC) uniform vec3 vReflectionPosition; - uniform vec3 vReflectionSize; + uniform vec3 vReflectionSize; #endif #endif // Refraction #if defined(SS_REFRACTION) && defined(SS_USE_LOCAL_REFRACTIONMAP_CUBIC) uniform vec3 vRefractionPosition; - uniform vec3 vRefractionSize; + uniform vec3 vRefractionSize; #endif // Clear Coat diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.fx index 9e84627ff18..9aefe9443ed 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentSamplersDeclaration.fx @@ -1,4 +1,5 @@ #include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo) +#include(_DEFINENAME_,BASEWEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight) #include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient) #include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity) #include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive) @@ -42,7 +43,7 @@ #define sampleReflection(s, c) textureCube(s, c) uniform samplerCube reflectionSampler; - + #ifdef LODBASEDMICROSFURACE #define sampleReflectionLod(s, c, l) textureCubeLodEXT(s, c, l) #else @@ -88,7 +89,7 @@ #ifdef SS_REFRACTION #ifdef SS_REFRACTIONMAP_3D #define sampleRefraction(s, c) textureCube(s, c) - + uniform samplerCube refractionSampler; #ifdef LODBASEDMICROSFURACE @@ -99,7 +100,7 @@ #endif #else #define sampleRefraction(s, c) texture2D(s, c) - + uniform sampler2D refractionSampler; #ifdef LODBASEDMICROSFURACE diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx index 143ee0da107..3900e558843 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx @@ -24,6 +24,7 @@ layout(std140, column_major) uniform; uniform Material { vec2 vAlbedoInfos; + vec2 vBaseWeightInfos; vec4 vAmbientInfos; vec2 vOpacityInfos; vec2 vEmissiveInfos; @@ -36,6 +37,7 @@ uniform Material { vec3 vReflectionSize; vec3 vBumpInfos; mat4 albedoMatrix; + mat4 baseWeightMatrix; mat4 ambientMatrix; mat4 opacityMatrix; mat4 emissiveMatrix; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx index 65d44f24f0b..612b0f01908 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx @@ -2,13 +2,23 @@ uniform mat4 view; uniform mat4 viewProjection; #ifdef MULTIVIEW mat4 viewProjectionR; -#endif +#endif #ifdef ALBEDO uniform mat4 albedoMatrix; uniform vec2 vAlbedoInfos; #endif +#ifdef BASEWEIGHT +uniform mat4 baseWeightMatrix; +uniform vec2 vBaseWeightInfos; +#endif + +#ifdef BASEWEIGHT +uniform mat4 baseWeightMatrix; +uniform vec2 vBaseWeightInfos; +#endif + #ifdef AMBIENT uniform mat4 ambientMatrix; uniform vec4 vAmbientInfos; @@ -29,7 +39,7 @@ uniform vec2 vLightmapInfos; uniform mat4 lightmapMatrix; #endif -#ifdef REFLECTIVITY +#ifdef REFLECTIVITY uniform vec3 vReflectivityInfos; uniform mat4 reflectivityMatrix; #endif diff --git a/packages/dev/core/src/Shaders/pbr.fragment.fx b/packages/dev/core/src/Shaders/pbr.fragment.fx index ba44723e6de..fc13c953765 100644 --- a/packages/dev/core/src/Shaders/pbr.fragment.fx +++ b/packages/dev/core/src/Shaders/pbr.fragment.fx @@ -90,6 +90,10 @@ void main(void) { vec4 albedoTexture = texture2D(albedoSampler, vAlbedoUV + uvOffset); #endif +#ifdef BASEWEIGHT + vec4 baseWeightTexture = texture2D(baseWeightSampler, vBaseWeightUV + uvOffset); +#endif + #ifdef OPACITY vec4 opacityMap = texture2D(opacitySampler, vOpacityUV + uvOffset); #endif @@ -105,6 +109,10 @@ void main(void) { , vAlbedoInfos #endif , vBaseWeight + #ifdef BASEWEIGHT + , baseWeightTexture + , vBaseWeightInfos + #endif #ifdef OPACITY , opacityMap , vOpacityInfos diff --git a/packages/dev/core/src/Shaders/pbr.vertex.fx b/packages/dev/core/src/Shaders/pbr.vertex.fx index 464bd4a4689..2ad58a8687f 100644 --- a/packages/dev/core/src/Shaders/pbr.vertex.fx +++ b/packages/dev/core/src/Shaders/pbr.vertex.fx @@ -31,6 +31,7 @@ attribute vec4 color; #include #include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo) +#include(_DEFINENAME_,BASEWEIGHT,_VARYINGNAME_,BaseWeight) #include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) #include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) #include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) @@ -216,6 +217,7 @@ void main(void) { #include[3..7] #include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x) + #include(_DEFINENAME_,BASEWEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x) #include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) #include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) #include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx index 0f7112953c3..1e6cf59b52c 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -12,6 +12,10 @@ fn albedoOpacityBlock( ,albedoInfos: vec2f #endif , vBaseWeight: f32 +#ifdef BASEWEIGHT + , baseWeightTexture: vec4f + , vBaseWeightInfos: vec2f +#endif #ifdef OPACITY ,opacityMap: vec4f ,vOpacityInfos: vec2f @@ -80,7 +84,7 @@ fn albedoOpacityBlock( #endif #if !defined(SS_LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL) - #ifdef ALPHATEST + #ifdef ALPHATEST #if DEBUGMODE != 88 if (alpha < ALPHATESTVALUE) { discard; diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.fx index 63d8555f7f7..76275d8c2a4 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrFragmentSamplersDeclaration.fx @@ -1,4 +1,5 @@ #include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_SAMPLERNAME_,albedo) +#include(_DEFINENAME_,BASEWEIGHT,_VARYINGNAME_,BaseWeight,_SAMPLERNAME_,baseWeight) #include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_SAMPLERNAME_,ambient) #include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_SAMPLERNAME_,opacity) #include(_DEFINENAME_,EMISSIVE,_VARYINGNAME_,Emissive,_SAMPLERNAME_,emissive) @@ -43,7 +44,7 @@ #ifdef REFLECTIONMAP_3D var reflectionSamplerSampler: sampler; var reflectionSampler: texture_cube; - + #ifdef LODBASEDMICROSFURACE #else var reflectionLowSamplerSampler: sampler; @@ -93,7 +94,7 @@ #ifdef SUBSURFACE #ifdef SS_REFRACTION #ifdef SS_REFRACTIONMAP_3D - + var refractionSamplerSampler: sampler; var refractionSampler: texture_cube; @@ -105,7 +106,7 @@ var refractionHighSampler: texture_cube; #endif #else - + var refractionSamplerSampler: sampler; var refractionSampler: texture_2d; diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx index 04223907da2..99990c7cfb3 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx @@ -1,4 +1,5 @@ uniform vAlbedoInfos: vec2f; +uniform vBaseWeightInfos: vec2f; uniform vAmbientInfos: vec4f; uniform vOpacityInfos: vec2f; uniform vEmissiveInfos: vec2f; @@ -11,6 +12,7 @@ uniform vReflectionPosition: vec3f; uniform vReflectionSize: vec3f; uniform vBumpInfos: vec3f; uniform albedoMatrix: mat4x4f; +uniform baseWeightMatrix: mat4x4f; uniform ambientMatrix: mat4x4f; uniform opacityMatrix: mat4x4f; uniform emissiveMatrix: mat4x4f; diff --git a/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx b/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx index d303658d2f5..e22f6c97297 100644 --- a/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx +++ b/packages/dev/core/src/ShadersWGSL/pbr.fragment.fx @@ -75,6 +75,10 @@ fn main(input: FragmentInputs) -> FragmentOutputs { var albedoTexture: vec4f = textureSample(albedoSampler, albedoSamplerSampler, fragmentInputs.vAlbedoUV + uvOffset); #endif +#ifdef BASEWEIGHT + var baseWeightTexture: vec4f = textureSample(baseWeightSampler, baseWeightSamplerSampler, fragmentInputs.vBaseWeightUV + uvOffset); +#endif + #ifdef OPACITY var opacityMap: vec4f = textureSample(opacitySampler, opacitySamplerSampler, fragmentInputs.vOpacityUV + uvOffset); #endif @@ -90,6 +94,10 @@ fn main(input: FragmentInputs) -> FragmentOutputs { , uniforms.vAlbedoInfos #endif , uniforms.baseWeight + #ifdef BASEWEIGHT + , baseWeightTexture + , uniforms.vBaseWeightInfos + #endif #ifdef OPACITY , opacityMap , uniforms.vOpacityInfos @@ -124,7 +132,7 @@ fn main(input: FragmentInputs) -> FragmentOutputs { #ifdef AMBIENT ambientOcclusionColorMap, uniforms.vAmbientInfos - #endif + #endif ); #include @@ -243,7 +251,7 @@ fn main(input: FragmentInputs) -> FragmentOutputs { #endif TBN, normalW, - viewDirectionW + viewDirectionW ); #endif diff --git a/packages/dev/core/src/ShadersWGSL/pbr.vertex.fx b/packages/dev/core/src/ShadersWGSL/pbr.vertex.fx index 04446f38ec6..e83bc6068a2 100644 --- a/packages/dev/core/src/ShadersWGSL/pbr.vertex.fx +++ b/packages/dev/core/src/ShadersWGSL/pbr.vertex.fx @@ -27,6 +27,7 @@ attribute color: vec4f; #include #include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo) +#include(_DEFINENAME_,BASEWEIGHT,_VARYINGNAME_,BaseWeight) #include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail) #include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient) #include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity) @@ -212,6 +213,7 @@ fn main(input : VertexInputs) -> FragmentInputs { #include[3..7] #include(_DEFINENAME_,ALBEDO,_VARYINGNAME_,Albedo,_MATRIXNAME_,albedo,_INFONAME_,AlbedoInfos.x) + #include(_DEFINENAME_,BASEWEIGHT,_VARYINGNAME_,BaseWeight,_MATRIXNAME_,baseWeight,_INFONAME_,BaseWeightInfos.x) #include(_DEFINENAME_,DETAIL,_VARYINGNAME_,Detail,_MATRIXNAME_,detail,_INFONAME_,DetailInfos.x) #include(_DEFINENAME_,AMBIENT,_VARYINGNAME_,Ambient,_MATRIXNAME_,ambient,_INFONAME_,AmbientInfos.x) #include(_DEFINENAME_,OPACITY,_VARYINGNAME_,Opacity,_MATRIXNAME_,opacity,_INFONAME_,OpacityInfos.x) diff --git a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx index 4f87e3448bf..47a79124cf1 100644 --- a/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx +++ b/packages/dev/inspector/src/components/actionTabs/tabs/propertyGrids/materials/pbrMaterialPropertyGridComponent.tsx @@ -54,6 +54,14 @@ export class PBRMaterialPropertyGridComponent extends React.Component + Date: Fri, 17 Jan 2025 17:11:55 +0100 Subject: [PATCH 03/11] Use Base Weight in the shader --- .../src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx | 6 ++++++ .../src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx index aa7e748357b..4ab4ca13a2b 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -68,6 +68,12 @@ albedoOpacityOutParams albedoOpacityBlock( #define CUSTOM_FRAGMENT_UPDATE_ALBEDO + #if BASEWEIGHT + surfaceAlbedo *= baseWeightTexture.r; + #else + surfaceAlbedo *= vBaseWeight; + #endif + // _____________________________ Alpha Information _______________________________ #ifdef OPACITY #ifdef OPACITYRGB diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx index 1e6cf59b52c..d72c4985ad5 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -68,6 +68,12 @@ fn albedoOpacityBlock( #define CUSTOM_FRAGMENT_UPDATE_ALBEDO + #if BASEWEIGHT + surfaceAlbedo *= baseWeightTexture.r; + #else + surfaceAlbedo *= vBaseWeight; + #endif + // _____________________________ Alpha Information _______________________________ #ifdef OPACITY #ifdef OPACITYRGB From 731030e1782cbf96f3d3b3ca0de280cb70129091 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:45:18 +0100 Subject: [PATCH 04/11] Add visualization test --- .../ReferenceImages/openpbr-base-weight.png | Bin 0 -> 25725 bytes .../tools/tests/test/visualization/config.json | 5 +++++ 2 files changed, 5 insertions(+) create mode 100644 packages/tools/tests/test/visualization/ReferenceImages/openpbr-base-weight.png diff --git a/packages/tools/tests/test/visualization/ReferenceImages/openpbr-base-weight.png b/packages/tools/tests/test/visualization/ReferenceImages/openpbr-base-weight.png new file mode 100644 index 0000000000000000000000000000000000000000..a82410bc300b8acbfc3f4b48baa3aa8cc9ad5679 GIT binary patch literal 25725 zcmeFYPZ%5m3GVI?oS=idTL|tJ2Db#49}wK#-Gc@9!6E42gY)vd zciqqTA9z0XT3ubePVcp=dY^N4MW`yv;=Cby0{{SU*yR8@R#}*CGP(n`d>8ummB}P9RA;%L!Hs7;D3b! zMe8>+X1Ap`*|!Gp+tojZO!y3rNB5)Nq8Fo-?HdjL&)iKEMj3S@$Z53B&bxd+JD#FK z)_rH*6SvR9pBJ2TNl(jo5rguaY;i*!=Nn_?x_5KDo$%m=`#z(`Cdrm|?uU9ASDw(n zM^zrY%BklyMtAv524@hb#{o*`7&}X1R;NbW3CXVYH639s$M;VIypIEDRoAjrJ~6tj z{w@o24FY_4A^xp3{-(|DJ8oT1gII2j6BA>s6Re*mCL<|#J0>4bb2_($>^d&q8KI243mJ2Jc$)ImXr&Gfgw8KR z)Sa4^>rRN|OrA=bI-h3tb&uSt{06c|4bj~lQ(MZvPheQ0quMdn7Fxy(e6!dMf?ccy zTr|OjCLvC@yV?eReNApeCK?i2ftMR7fMBF*^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=E0cwsj z(N1z8lcF{QEMhZbmn3t#SDQ?`_vqV*Yx&MX`_|dM)8g;<Cmq;A7 zV=4-KC4;{)%APlJVz+dSa`7ShTRmlazTl$&;XJl+;iOF`e6_0GJ^d=6F%a8B)^7;m zF;oThE~LQg4#S5eB9^yJ2NB{F>-{w~zBR{oJ6Hq4R}Fpv{tPz0WNBDN*%g<5Nft zao)%0QKrSg#00%-H8B%Z@0^W!lmcJP9F6-m^6}3~XZRfTrVs~Ywac%ho{Z>O+N%!4 zu!1hq)B0DtD4o|u@*Lxt3BRBj_D6X<$E;e$q4w0y3asr-ztYz}T1ekIE#I*W-RF@} zjcL3%c-?u5Z%=K3foh>?fptJ-*>9S#1*_0SiGgVK%R`nA(idMF!IJp_yZm-R4f+4j zD{b8v(>uv1D#G0V6(o7v?i351Ub{RdK5`t?tLZL6|LuziY|<^Wy82;3>UQX0XrJdR zE&vH)6w&p~xJHB{G4HvX*QG!Y4ovW+nl83Ek`WW|B!`+wwPUVo)5MKZljr!{oNotR z^5y2=Rm;Dq9p5lgiD^vwOQX@9F)DBGQtCX(f0$g*Zf$I)_oLgZ)pzio8p6pc&B-{; zY5G4_9UI=mUH^j#vP{?()k`)h;S zFX4j)&9C-hG7{9EZpi1XL!8$eg_%9W|~=-JOh5hIK3tF6hu83x0#{jIm(4-}Sh z5gknp1MF#NuCn~+9|84YI8?F|UGSE4=r?i?B%yNeikz}^?pDTyO#b=b1D(Yh_ZN%> zu9KdHPjxZ;Ork3c)``5^Hvi<$U*|6bSiMP%QJ?g$tNqJwc>Tw$(AA}#f2gC5XbXc8 zukW50#_avw3VnS4;=vQfD>RSG3(v07(D-vlQhO~cQMEG~n!K31S84t={J*^d*Z-pV zILa7BLo)=su0ccd3wV`UociD4kIVl%GylcR{|g8%_!Z+bq-t;s9W>NUSIbbdPUA)7 F{{U{QPdNYp literal 0 HcmV?d00001 diff --git a/packages/tools/tests/test/visualization/config.json b/packages/tools/tests/test/visualization/config.json index 877653f6b74..35e5af8edfe 100644 --- a/packages/tools/tests/test/visualization/config.json +++ b/packages/tools/tests/test/visualization/config.json @@ -1,6 +1,11 @@ { "root": "https://cdn.babylonjs.com", "tests": [ + { + "title": "OpenPBR Base Weight", + "playgroundId": "#DT1XPP#4", + "referenceImage": "openpbr_base_weight.png" + }, { "title": "NME Glow Manual", "playgroundId": "#7QCYPB#320", From 85849b3718bcdff292209091760c679a30723497 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Fri, 17 Jan 2025 17:58:23 +0100 Subject: [PATCH 05/11] Hard code base_weight=1 in NME --- .../src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts b/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts index 529edbde2ca..d0d6096f260 100644 --- a/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts +++ b/packages/dev/core/src/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.ts @@ -974,10 +974,11 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock { ,vec4${state.fSuffix}(1.) ,vec2${state.fSuffix}(1., 1.) #endif + ,1. // Base Weight #ifdef OPACITY ,vec4${state.fSuffix}(${opacity}) ,vec2${state.fSuffix}(1., 1.) - #endif + #endif ); ${state._declareLocalVar("surfaceAlbedo", NodeMaterialBlockConnectionPointTypes.Vector3)} = albedoOpacityOut.surfaceAlbedo; From f5bdd5eba256b2edab92b3be499229ce14aada87 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Fri, 17 Jan 2025 20:58:18 +0100 Subject: [PATCH 06/11] Fix typo --- packages/dev/core/src/Materials/PBR/pbrMaterial.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts index 73c53182e70..ed09dfc4bbc 100644 --- a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts @@ -274,7 +274,7 @@ export class PBRMaterial extends PBRBaseMaterial { @expandToProperty("_markAllSubMeshesAsTexturesDirty") public albedoColor = new Color3(1, 1, 1); - @serializeAsColor3("baseWeight") + @serialize("baseWeight") @expandToProperty("_markAllSubMeshesAsTexturesDirty") public baseWeight = 1; From 8dab7fc28f5a323fccb124587eac6f9b665495bc Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Fri, 17 Jan 2025 21:07:04 +0100 Subject: [PATCH 07/11] Add code documentation --- packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts | 8 ++++++++ packages/dev/core/src/Materials/PBR/pbrMaterial.ts | 6 ++++++ packages/dev/core/src/Materials/materialFlags.ts | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts index 5d1eb476920..9a61bb14669 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts @@ -420,6 +420,10 @@ export abstract class PBRBaseMaterial extends PushMaterial { */ public _albedoTexture: Nullable = null; + /** + * OpenPBR Base Weight (multiplier to the diffuse and metal lobes). + * @internal + */ public _baseWeightTexture: Nullable = null; /** @@ -564,6 +568,10 @@ export abstract class PBRBaseMaterial extends PushMaterial { */ public _albedoColor = new Color3(1, 1, 1); + /** + * OpenPBR Base Weight (multiplier to the diffuse and metal lobes). + * @internal + */ public _baseWeight = 1; /** diff --git a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts index ed09dfc4bbc..df311aa1d02 100644 --- a/packages/dev/core/src/Materials/PBR/pbrMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrMaterial.ts @@ -92,6 +92,9 @@ export class PBRMaterial extends PBRBaseMaterial { @expandToProperty("_markAllSubMeshesAsTexturesDirty") public albedoTexture: Nullable; + /** + * OpenPBR Base Weight (multiplier to the diffuse and metal lobes). + */ @serializeAsTexture() @expandToProperty("_markAllSubMeshesAsTexturesDirty") public baseWeightTexture: Nullable; @@ -274,6 +277,9 @@ export class PBRMaterial extends PBRBaseMaterial { @expandToProperty("_markAllSubMeshesAsTexturesDirty") public albedoColor = new Color3(1, 1, 1); + /** + * OpenPBR Base Weight (multiplier to the diffuse and metal lobes). + */ @serialize("baseWeight") @expandToProperty("_markAllSubMeshesAsTexturesDirty") public baseWeight = 1; diff --git a/packages/dev/core/src/Materials/materialFlags.ts b/packages/dev/core/src/Materials/materialFlags.ts index 6bb527f6db7..af013512b86 100644 --- a/packages/dev/core/src/Materials/materialFlags.ts +++ b/packages/dev/core/src/Materials/materialFlags.ts @@ -24,7 +24,7 @@ export class MaterialFlags { private static _BaseWeightTextureEnabled = true; /** - * Are diffuse textures enabled in the application. + * Is the OpenPBR Base Weight texture enabled in the application. */ public static get BaseWeightTextureEnabled(): boolean { return this._BaseWeightTextureEnabled; From b30f78e75e4c89657dac50023e14f8412f5f5756 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Fri, 17 Jan 2025 22:24:00 +0100 Subject: [PATCH 08/11] Follow convention of multiplying the texture value by the uniform parameter --- .../core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx | 3 +-- .../src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx index 4ab4ca13a2b..89fc4a85a3c 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -68,10 +68,9 @@ albedoOpacityOutParams albedoOpacityBlock( #define CUSTOM_FRAGMENT_UPDATE_ALBEDO + surfaceAlbedo *= vBaseWeight; #if BASEWEIGHT surfaceAlbedo *= baseWeightTexture.r; - #else - surfaceAlbedo *= vBaseWeight; #endif // _____________________________ Alpha Information _______________________________ diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx index d72c4985ad5..3d4f1b15a9c 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -68,10 +68,9 @@ fn albedoOpacityBlock( #define CUSTOM_FRAGMENT_UPDATE_ALBEDO + surfaceAlbedo *= vBaseWeight; #if BASEWEIGHT surfaceAlbedo *= baseWeightTexture.r; - #else - surfaceAlbedo *= vBaseWeight; #endif // _____________________________ Alpha Information _______________________________ From 2cd92ca0db7c695cba5115cacc74dd6c35cb33ed Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:53:10 +0100 Subject: [PATCH 09/11] Address review comments --- .../dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx | 2 +- .../core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx index 3900e558843..b4184d15bb1 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx @@ -49,7 +49,7 @@ uniform Material { mat4 reflectionMatrix; vec3 vReflectionColor; vec4 vAlbedoColor; - float vBaseWeight; + float vBaseWeight; vec4 vLightingIntensity; vec3 vReflectionMicrosurfaceInfos; float pointSize; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx index 612b0f01908..d9142aaa417 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrVertexDeclaration.fx @@ -14,11 +14,6 @@ uniform mat4 baseWeightMatrix; uniform vec2 vBaseWeightInfos; #endif -#ifdef BASEWEIGHT -uniform mat4 baseWeightMatrix; -uniform vec2 vBaseWeightInfos; -#endif - #ifdef AMBIENT uniform mat4 ambientMatrix; uniform vec4 vAmbientInfos; From 6a04dfaba8876e99add1e4069095d508562e09b3 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Mon, 20 Jan 2025 14:53:29 +0100 Subject: [PATCH 10/11] Document shading details --- .../src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx | 6 ++++++ .../src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx index 89fc4a85a3c..b90bb3c494d 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -68,6 +68,12 @@ albedoOpacityOutParams albedoOpacityBlock( #define CUSTOM_FRAGMENT_UPDATE_ALBEDO + // According to OpenPBR: + // - for metals, base_weight is a factor to the base_color (F0, thus surfaceAlbedo in + // Babylons.js). + // - for dielectrics, base_weight is a factor to the diffuse BRDF (i.e. it should be + // applied in computeDiffuseLighting), but with the diffuse model *currently* used + // in Babylon.js, factoring it into the surfaceAlbedo is equivalent. surfaceAlbedo *= vBaseWeight; #if BASEWEIGHT surfaceAlbedo *= baseWeightTexture.r; diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx index 3d4f1b15a9c..14c7a4f1b57 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -68,6 +68,12 @@ fn albedoOpacityBlock( #define CUSTOM_FRAGMENT_UPDATE_ALBEDO + // According to OpenPBR: + // - for metals, base_weight is a factor to the base_color (F0, thus surfaceAlbedo in + // Babylons.js). + // - for dielectrics, base_weight is a factor to the diffuse BRDF (i.e. it should be + // applied in computeDiffuseLighting), but with the diffuse model *currently* used + // in Babylon.js, factoring it into the surfaceAlbedo is equivalent. surfaceAlbedo *= vBaseWeight; #if BASEWEIGHT surfaceAlbedo *= baseWeightTexture.r; From 5c5abfaf252ca842bb0609617668d3eb0e0d6f44 Mon Sep 17 00:00:00 2001 From: Julien Guertault <9511025+virtualzavie@users.noreply.github.com> Date: Wed, 22 Jan 2025 11:08:25 +0100 Subject: [PATCH 11/11] Rename float vBaseWeight to baseWeight --- packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts | 6 +++--- .../src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx | 4 ++-- .../src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx | 2 +- .../core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx | 2 +- packages/dev/core/src/Shaders/pbr.fragment.fx | 6 +++--- .../src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx | 4 ++-- .../src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts index 9a61bb14669..f4e20c0a0c4 100644 --- a/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts +++ b/packages/dev/core/src/Materials/PBR/pbrBaseMaterial.ts @@ -1434,7 +1434,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { "vLightsType", "vAmbientColor", "vAlbedoColor", - "vBaseWeight", + "baseWeight", "vReflectivityColor", "vMetallicReflectanceFactors", "vEmissiveColor", @@ -2039,7 +2039,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { ubo.addUniform("vReflectionColor", 3); ubo.addUniform("vAlbedoColor", 4); - ubo.addUniform("vBaseWeight", 1); + ubo.addUniform("baseWeight", 1); ubo.addUniform("vLightingIntensity", 4); ubo.addUniform("vReflectionMicrosurfaceInfos", 3); @@ -2308,7 +2308,7 @@ export abstract class PBRBaseMaterial extends PushMaterial { ubo.updateColor4("vAlbedoColor", this._albedoColor, this.alpha); } - ubo.updateFloat("vBaseWeight", this._baseWeight); + ubo.updateFloat("baseWeight", this._baseWeight); // Misc this._lightingInfos.x = this._directIntensity; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx index b90bb3c494d..67c32a6ad3a 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -11,7 +11,7 @@ albedoOpacityOutParams albedoOpacityBlock( ,in vec4 albedoTexture ,in vec2 albedoInfos #endif - , in float vBaseWeight + , in float baseWeight #ifdef BASEWEIGHT , in vec4 baseWeightTexture , in vec2 vBaseWeightInfos @@ -74,7 +74,7 @@ albedoOpacityOutParams albedoOpacityBlock( // - for dielectrics, base_weight is a factor to the diffuse BRDF (i.e. it should be // applied in computeDiffuseLighting), but with the diffuse model *currently* used // in Babylon.js, factoring it into the surfaceAlbedo is equivalent. - surfaceAlbedo *= vBaseWeight; + surfaceAlbedo *= baseWeight; #if BASEWEIGHT surfaceAlbedo *= baseWeightTexture.r; #endif diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx index 9d913edf0f1..342aee5a9d5 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrFragmentDeclaration.fx @@ -2,7 +2,7 @@ uniform vec4 vEyePosition; uniform vec3 vReflectionColor; uniform vec4 vAlbedoColor; -uniform float vBaseWeight; +uniform float baseWeight; // CUSTOM CONTROLS uniform vec4 vLightingIntensity; diff --git a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx index b4184d15bb1..dbef7e7c0a4 100644 --- a/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/Shaders/ShadersInclude/pbrUboDeclaration.fx @@ -49,7 +49,7 @@ uniform Material { mat4 reflectionMatrix; vec3 vReflectionColor; vec4 vAlbedoColor; - float vBaseWeight; + float baseWeight; vec4 vLightingIntensity; vec3 vReflectionMicrosurfaceInfos; float pointSize; diff --git a/packages/dev/core/src/Shaders/pbr.fragment.fx b/packages/dev/core/src/Shaders/pbr.fragment.fx index fc13c953765..999d047887d 100644 --- a/packages/dev/core/src/Shaders/pbr.fragment.fx +++ b/packages/dev/core/src/Shaders/pbr.fragment.fx @@ -108,7 +108,7 @@ void main(void) { , albedoTexture , vAlbedoInfos #endif - , vBaseWeight + , baseWeight #ifdef BASEWEIGHT , baseWeightTexture , vBaseWeightInfos @@ -154,7 +154,7 @@ void main(void) { #ifdef UNLIT vec3 diffuseBase = vec3(1., 1., 1.); -#else +#else // !UNLIT // _____________________________ Reflectivity _______________________________ vec3 baseColor = surfaceAlbedo; @@ -621,7 +621,7 @@ void main(void) { // _____________________________ Compute Final Lit Components ________________________ #include -#endif // UNLIT +#endif // !UNLIT #include diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx index 14c7a4f1b57..52c8c5b83e4 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrBlockAlbedoOpacity.fx @@ -11,7 +11,7 @@ fn albedoOpacityBlock( ,albedoTexture: vec4f ,albedoInfos: vec2f #endif - , vBaseWeight: f32 + , baseWeight: f32 #ifdef BASEWEIGHT , baseWeightTexture: vec4f , vBaseWeightInfos: vec2f @@ -74,7 +74,7 @@ fn albedoOpacityBlock( // - for dielectrics, base_weight is a factor to the diffuse BRDF (i.e. it should be // applied in computeDiffuseLighting), but with the diffuse model *currently* used // in Babylon.js, factoring it into the surfaceAlbedo is equivalent. - surfaceAlbedo *= vBaseWeight; + surfaceAlbedo *= baseWeight; #if BASEWEIGHT surfaceAlbedo *= baseWeightTexture.r; #endif diff --git a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx index 99990c7cfb3..b730d6beddf 100644 --- a/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx +++ b/packages/dev/core/src/ShadersWGSL/ShadersInclude/pbrUboDeclaration.fx @@ -24,7 +24,7 @@ uniform vTangentSpaceParams: vec2f; uniform reflectionMatrix: mat4x4f; uniform vReflectionColor: vec3f; uniform vAlbedoColor: vec4f; -uniform vBaseWeight: f32; +uniform baseWeight: f32; uniform vLightingIntensity: vec4f; uniform vReflectionMicrosurfaceInfos: vec3f; uniform pointSize: f32;