A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(render): a lit mesh had its specular lobe switched off, not turned down
esengine849ace46b203
diff --git a/src/esengine/data/shaders/mesh.esshader b/src/esengine/data/shaders/mesh.esshaderindex 8600d6ae8..a89bf1ea0 100644--- a/src/esengine/data/shaders/mesh.esshader+++ b/src/esengine/data/shaders/mesh.esshader@@ -160,10 +160,12 @@ void main() {#ifdef NORMAL_MAPN = perturbNormal(N, v_worldPos, v_texCoord, sampleNormal(u_normalMap, v_texCoord));#endif- // The general form at a 2D surface's own parameters, but with the position it- // really has: a shadow is cast on a point in space, and xy is not one.+ // A rough dielectric, and the position it really has: a shadow is cast on a+ // point in space, and xy is not one. Specular stays ON — switching it off is+ // not a cheaper PBR, it is a different surface, and a mesh whose material+ // says nothing must still be lit the way the same mesh out of a glTF is.fragColor = vec4(applyLightingPBR(base.rgb, N, v_worldPos, viewDirection(v_worldPos),- 0.0, 1.0, 0.0, 1.0), base.a);+ 0.0, 1.0, 1.0, 1.0), base.a);#elsefragColor = base;#endif@@ -302,10 +304,12 @@ struct VSOut {#ifdef NORMAL_MAPN = perturbNormal(N, v.v_worldPos, v.v_texCoord, sampleNormal(t1, s1, v.v_texCoord));#endif- // The general form at a 2D surface's own parameters, but with the position it- // really has: a shadow is cast on a point in space, and xy is not one.+ // A rough dielectric, and the position it really has: a shadow is cast on a+ // point in space, and xy is not one. Specular stays ON — switching it off is+ // not a cheaper PBR, it is a different surface, and a mesh whose material+ // says nothing must still be lit the way the same mesh out of a glTF is.return vec4f(applyLightingPBR(base.rgb, N, v.v_worldPos, viewDirection(v.v_worldPos),- 0.0, 1.0, 0.0, 1.0), base.a);+ 0.0, 1.0, 1.0, 1.0), base.a);#elsereturn base;#endifdiff --git a/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp b/src/esengine/renderer/rhi/ShaderEmbeds.generated.hppindex 15c65d1a1..3bbe94a74 100644--- a/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp+++ b/src/esengine/renderer/rhi/ShaderEmbeds.generated.hpp@@ -435,10 +435,12 @@ void main() {#ifdef NORMAL_MAPN = perturbNormal(N, v_worldPos, v_texCoord, sampleNormal(u_normalMap, v_texCoord));#endif- // The general form at a 2D surface's own parameters, but with the position it- // really has: a shadow is cast on a point in space, and xy is not one.+ // A rough dielectric, and the position it really has: a shadow is cast on a+ // point in space, and xy is not one. Specular stays ON — switching it off is+ // not a cheaper PBR, it is a different surface, and a mesh whose material+ // says nothing must still be lit the way the same mesh out of a glTF is.fragColor = vec4(applyLightingPBR(base.rgb, N, v_worldPos, viewDirection(v_worldPos),- 0.0, 1.0, 0.0, 1.0), base.a);+ 0.0, 1.0, 1.0, 1.0), base.a);#elsefragColor = base;#endif@@ -577,10 +579,12 @@ struct VSOut {#ifdef NORMAL_MAPN = perturbNormal(N, v.v_worldPos, v.v_texCoord, sampleNormal(t1, s1, v.v_texCoord));#endif- // The general form at a 2D surface's own parameters, but with the position it- // really has: a shadow is cast on a point in space, and xy is not one.+ // A rough dielectric, and the position it really has: a shadow is cast on a+ // point in space, and xy is not one. Specular stays ON — switching it off is+ // not a cheaper PBR, it is a different surface, and a mesh whose material+ // says nothing must still be lit the way the same mesh out of a glTF is.return vec4f(applyLightingPBR(base.rgb, N, v.v_worldPos, viewDirection(v.v_worldPos),- 0.0, 1.0, 0.0, 1.0), base.a);+ 0.0, 1.0, 1.0, 1.0), base.a);#elsereturn base;#endif