|
@@ -835,9 +835,9 @@ export class PBRMetallicRoughnessBlock extends NodeMaterialBlock {
|
|
state.compilationString += `vec3 viewDirectionW = normalize(${this.cameraPosition.associatedVariableName} - ${"v_" + worldPos.associatedVariableName}.xyz);\r\n`;
|
|
state.compilationString += `vec3 viewDirectionW = normalize(${this.cameraPosition.associatedVariableName} - ${"v_" + worldPos.associatedVariableName}.xyz);\r\n`;
|
|
}
|
|
}
|
|
|
|
|
|
- state.compilationString += `vec3 geometricNormalW = ${this.worldNormal.associatedVariableName}.xyz;\r\n`;
|
|
|
|
|
|
+ state.compilationString += `vec3 geometricNormalW = normalize(${this.worldNormal.associatedVariableName}.xyz);\r\n`;
|
|
|
|
|
|
- state.compilationString += `vec3 normalW = ${normalShading.isConnected ? normalShading.associatedVariableName + ".xyz" : "geometricNormalW"};\r\n`;
|
|
|
|
|
|
+ state.compilationString += `vec3 normalW = ${normalShading.isConnected ? "normalize(" + normalShading.associatedVariableName + ".xyz)" : "geometricNormalW"};\r\n`;
|
|
|
|
|
|
state.compilationString += state._emitCodeFromInclude("pbrBlockNormalFinal", comments, {
|
|
state.compilationString += state._emitCodeFromInclude("pbrBlockNormalFinal", comments, {
|
|
replaceStrings: [
|
|
replaceStrings: [
|