Skip to content

Commit

Permalink
change gltf emissive factors to ShaderLit interpretation
Browse files Browse the repository at this point in the history
  • Loading branch information
plojo committed Oct 8, 2024
1 parent 58d2116 commit 39af60f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Distribution/FudgeCore.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion Source/Core/Serialization/GLTF/GLTFLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -752,8 +752,10 @@ namespace FudgeCore {
// Influences how much the material's color affects the specular reflection. When metallic is higher, the specular reflection takes on the color of the material, creating a metallic appearance. Range from 0.0 to 1.0.
const metallic: number = gltfMetallicFactor;

const isLit: boolean = gltfEmissiveFactor[0] == 1 && gltfEmissiveFactor[1] == 1 || gltfEmissiveFactor[2] == 1;
const isLit: boolean = gltfEmissiveFactor[0] > 0 || gltfEmissiveFactor[1] > 0 || gltfEmissiveFactor[2] > 0;
const color: Color = new Color(...gltfBaseColorFactor);
if (isLit)
color.add(new Color(...gltfEmissiveFactor, 0));
const coat: Coat = gltfBaseColorTexture ?
isLit ? new CoatTextured(color, await this.getTexture(gltfBaseColorTexture.index)) :
gltfNormalTexture ?
Expand Down

0 comments on commit 39af60f

Please sign in to comment.