That makes sense for the load. But you cant seem to be able to override then, like setting the sphericalPolynomial = new BABYLON.SpericalPolynomials() i would expect to BLACK or ZERO them out… Or is that not the expexted behavior ?
Yo @sebavan… Found a workaround. It seems if you pass null for irrandiance in the json… I think it forces the creation of polynomials for .env files:
babylonTexture.forceSphericalPolynomialsRecompute();
But I found a worka rounnd to pass all black irradiance, and then i can reset later with Unity SH:
My ENVPacker JSON encoder now default black when i want to override
// Build a simple manifest string matching EnvironmentTextureInfo v2 used by BabylonJS
// We'll set irradiance to black (zero) spherical harmonics and include specular.mipmaps array + lodGenerationScale
var sb = new StringBuilder();
sb.Append('{');
sb.Append("\"version\":2,");
sb.AppendFormat("\"width\":{0},", baseSize);
sb.AppendFormat("\"imageType\":\"{0}\",", imageType);
// Add black spherical harmonics (9 SH coefficient types: x, y, z, xx, yy, zz, yz, zx, xy; each with 3 RGB values)
sb.Append("\"irradiance\":{");
sb.Append("\"x\":[0,0,0],");
sb.Append("\"y\":[0,0,0],");
sb.Append("\"z\":[0,0,0],");
sb.Append("\"xx\":[0,0,0],");
sb.Append("\"yy\":[0,0,0],");
sb.Append("\"zz\":[0,0,0],");
sb.Append("\"yz\":[0,0,0],");
sb.Append("\"zx\":[0,0,0],");
sb.Append("\"xy\":[0,0,0]");
sb.Append("},");
sb.Append("\"specular\":{");
// mipmaps
sb.Append("\"mipmaps\":[");
for (int i = 0; i < specularArray.Count; i++)
{
var d = specularArray[i];
sb.Append('{');
sb.AppendFormat("\"length\":{0},\"position\":{1}", d["length"], d["position"]);
sb.Append('}');
if (i + 1 < specularArray.Count) sb.Append(',');
}
sb.Append("],");
sb.AppendFormat("\"lodGenerationScale\":{0},", lodGenerationScale.ToString(System.Globalization.CultureInfo.InvariantCulture));
sb.AppendFormat("\"lodGenerationOffset\":{0}", lodGenerationOffset.ToString(System.Globalization.CultureInfo.InvariantCulture));
sb.Append("}");
sb.Append('}');
1 Like