roavatar-renderer 1.6.6 → 1.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +27 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -47113,7 +47113,8 @@ class MaterialDesc {
47113
47113
  if (normalTexture || roughnessTexture || metalnessTexture || emissiveTexture) {
47114
47114
  material = new MeshStandardMaterial({
47115
47115
  ...textureTemplate,
47116
- emissiveIntensity: hasEmissive ? 1 / Math.sqrt(40) * Math.sqrt(this.emissiveStrength) : 0,
47116
+ emissiveIntensity: hasEmissive ? this.emissiveStrength : 0,
47117
+ //1/Math.sqrt(40) * Math.sqrt(this.emissiveStrength) : 0,
47117
47118
  emissive: hasEmissive ? new Color(this.emissiveTint.R, this.emissiveTint.G, this.emissiveTint.B) : new Color(0, 0, 0),
47118
47119
  transparent: hasTransparency,
47119
47120
  opacity: 1 - this.transparency,
@@ -47126,6 +47127,26 @@ class MaterialDesc {
47126
47127
  polygonOffsetUnits: this.isDecal ? 0.05 : 0,
47127
47128
  depthWrite: this.transparency > 0 ? false : true
47128
47129
  });
47130
+ material.onBeforeCompile = ((shader) => {
47131
+ shader.fragmentShader = shader.fragmentShader.replace(
47132
+ `#include <emissivemap_fragment>`,
47133
+ `#ifdef USE_EMISSIVEMAP
47134
+
47135
+ vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
47136
+
47137
+ #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
47138
+
47139
+ // use inline sRGB decode until browsers properly support SRGB8_ALPHA8 with video textures (#26516)
47140
+
47141
+ emissiveColor = sRGBTransferEOTF( emissiveColor );
47142
+
47143
+ #endif
47144
+
47145
+ totalEmissiveRadiance *= emissiveColor.rgb * diffuseColor.rgb;
47146
+
47147
+ #endif`
47148
+ );
47149
+ });
47129
47150
  } else {
47130
47151
  material = new MeshPhongMaterial({
47131
47152
  ...textureTemplate,
@@ -47376,11 +47397,11 @@ class MaterialDesc {
47376
47397
  if (surfaceAppearance) {
47377
47398
  surfaceAppearanceAlphaMode = surfaceAppearance.Prop("AlphaMode");
47378
47399
  }
47400
+ const partColor = child.Prop("Color").toColor3();
47379
47401
  if (surfaceAppearance && surfaceAppearanceAlphaMode === AlphaMode.Transparency) {
47380
47402
  this.transparent = true;
47381
47403
  } else {
47382
47404
  if (affectedByHumanoid || surfaceAppearance && surfaceAppearanceAlphaMode === AlphaMode.Overlay || meshPartTexture.length < 1 && !surfaceAppearance) {
47383
- const partColor = child.Prop("Color").toColor3();
47384
47405
  const colorLayer = new ColorLayer(partColor);
47385
47406
  this.layers.push(colorLayer);
47386
47407
  } else if (this.transparency === 0) {
@@ -47399,6 +47420,10 @@ class MaterialDesc {
47399
47420
  if (surfaceAppearanceLayer.emissive && surfaceAppearanceLayer.emissive.length > 0) {
47400
47421
  if (surfaceAppearance.HasProperty("EmissiveStrength")) {
47401
47422
  this.emissiveStrength = surfaceAppearance.Prop("EmissiveStrength");
47423
+ if (this.emissiveStrength > 0) {
47424
+ const colorLayer = new ColorLayer(partColor, void 0, "emissive");
47425
+ this.layers.push(colorLayer);
47426
+ }
47402
47427
  }
47403
47428
  if (surfaceAppearance.HasProperty("EmissiveTint")) {
47404
47429
  this.emissiveTint = surfaceAppearance.Prop("EmissiveTint");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "roavatar-renderer",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "A renderer for Roblox avatars, used by the RoAvatar extension.",
5
5
  "author": "steinan",
6
6
  "type": "module",