Home › Forums › WebGL & WebXR Troubleshooting › Failure to view the Blend file after publish
- This topic has 1 reply, 2 voices, and was last updated 2 years, 10 months ago by Yuri Kovelenov.
-
AuthorPosts
-
2022-02-14 at 10:17 am #49354yiweiParticipant
Hi,
I am facing this issue after publish online. Anyone can help here?
Basically I am overwriting using my existing blend file.
Here’s my steps:-
#1 Create new test app.
#2 Open through Blend.
#3 Overwrite the .blend.
#4 Export new .glb & new .gltf.
#5 Save & Publish online.v3d.WebGLShader: gl.getShaderInfoLog() fragment
1: #version 300 es
2: #define varying in
3: out highp vec4 pc_fragColor;
4: #define gl_FragColor pc_fragColor
5: #define gl_FragDepthEXT gl_FragDepth
6: #define texture2D texture
7: #define textureCube texture
8: #define texture2DProj textureProj
9: #define texture2DLodEXT textureLod
10: #define texture2DProjLodEXT textureProjLod
11: #define textureCubeLodEXT textureLod
12: #define texture2DGradEXT textureGrad
13: #define texture2DProjGradEXT textureProjGrad
14: #define textureCubeGradEXT textureGrad
15: precision highp float;
16: precision highp int;
17: #define HIGH_PRECISION
18: #define SHADER_NAME ShaderPass
19: #define MAP_TEXELS 0
20: #define COMPAT_USE_SPEC_ENV_BLENDER_APPROX
21: #define COMPAT_SIMPLIFIED_SRGB
22: #define GAMMA_FACTOR 2
23: #define PHYSICALLY_CORRECT_LIGHTS
24: #define UNITS_SCALE_FACTOR 1.0
25: uniform mat4 viewMatrix;
26: uniform vec3 cameraPosition;
27: uniform bool isOrthographic;
28: #define TONE_MAPPING
29: #ifndef saturate
30: #define saturate(a) clamp(a, 0.0, 1.0)
31: #endif
32: #ifndef PI
33: #define PI 3.14159265359
34: #endif
35: uniform float toneMappingExposure;
36: uniform float toneMappingMidTones;
37: uniform float toneMappingPhysicalScale;
38: uniform float toneMappingBrightness;
39: uniform float toneMappingContrast;
40: uniform bool toneMappingChromaticAdaptation;
41: uniform vec3 toneMappingWhiteColor;
42: uniform bool toneMappingColorDifferentiation;
43: uniform bool toneMappingExteriorDaylight;
44: uniform vec3 toneMappingWhiteBalance;
45: uniform float toneMappingHighlights;
46: uniform float toneMappingShadows;
47: uniform float toneMappingSaturation;
48: uniform float toneMappingAperture;
49: uniform float toneMappingShutter;
50: uniform float toneMappingISO;
51: uniform float toneMappingVignetting;
52: uniform vec2 toneMappingResolution;
53: const float FILMIC_BLENDER_LOG_MIN = -12.473931188;
54: const float FILMIC_BLENDER_LOG_MAX = 12.526068812;
55: const float FILMIC_BLENDER_EXPOSURE_LATITUDE_RATIO = 0.66;
56: vec3 LinearToneMapping(vec3 color) {
57: return toneMappingExposure * color;
58: }
59: vec3 ReinhardToneMapping(vec3 color) {
60: color *= toneMappingExposure;
61: return saturate(color / (vec3(1.0) + color));
62: }
63: vec3 OptimizedCineonToneMapping(vec3 color) {
64: color *= toneMappingExposure;
65: color = max(vec3(0.0), color – 0.004);
66: return pow((color * (6.2 * color + 0.5)) / (color * (6.2 * color + 1.7) + 0.06), vec3(2.2));
67: }
68: vec3 RRTAndODTFit(vec3 v) {
69: vec3 a = v * (v + 0.0245786) – 0.000090537;
70: vec3 b = v * (0.983729 * v + 0.4329510) + 0.238081;
71: return a / b;
72: }
73: vec3 ACESFilmicToneMapping(vec3 color) {
74: const mat3 ACESInputMat = mat3(
75: vec3(0.59719, 0.07600, 0.02840),
76: vec3(0.35458, 0.90834, 0.13383),
77: vec3(0.04823, 0.01566, 0.83777)
78: );
79: const mat3 ACESOutputMat = mat3(
80: vec3( 1.60475, -0.10208, -0.00327),
81: vec3(-0.53108, 1.10813, -0.07276),
82: vec3(-0.07367, -0.00605, 1.07602)
83: );
84: color *= toneMappingExposure / 0.6;
85: color = ACESInputMat * color;
86: color = RRTAndODTFit(color);
87: color = ACESOutputMat * color;
88: return saturate(color);
89: }
90: vec3 CustomToneMapping(vec3 color) { return color; }
91: #define ORDERS_OF_MAG 5.0
92: float toneCalcBrightness(in vec3 color)
93: {
94: return (abs(color.r) * 0.263 + abs(color.g) * 0.655 + abs(color.b) * 0.082);
95: }
96: float toneApproximateScotopicLuminance(vec3 color)
97: {
98: return (0.062 * color.r + 0.608 * color.g + 0.330 * color.b);
99: }
100: vec3 LogarithmicMaxToneMapping(vec3 color) {
101: float inputScaleFactor = toneMappingPhysicalScale / PI;
102: float brightness = (toneMappingBrightness < 0.0) ? 0.0 : (toneMappingBrightness * 0.7);
103: float powerBot = toneMappingExteriorDaylight ? 4.0 : 2.0;
104: float res = 100.0 / ORDERS_OF_MAG;
105: float mag = floor((50.0 / res));
106: float power = ((brightness / 20.0 – ORDERS_OF_MAG) – powerBot) + mag;
107: float stepsize = 9.0 / res;
108: float step = 50.0 – (mag * res);
109: float param_c = (0.02 * toneMappingContrast) * 2.0;
110: float param_b = pow(10.0, power) * (1.0 + (stepsize * step));
111: float param_a = param_b * (1.0 + param_c);
112: param_c /= pow(2.0, toneMappingMidTones – 1.0);
113: param_b *= PI;
114: vec3 whiteConstancyFactor = toneMappingWhiteColor;
115: if (toneMappingChromaticAdaptation) {
116: float luminance = toneCalcBrightness(whiteConstancyFactor);
117: whiteConstancyFactor.r = (whiteConstancyFactor.r > 0.001) ? luminance / whiteConstancyFactor.r : luminance / 0.001;
118: whiteConstancyFactor.g = (whiteConstancyFactor.g > 0.001) ? luminance / whiteConstancyFactor.g : luminance / 0.001;
119: whiteConstancyFactor.b = (whiteConstancyFactor.b > 0.001) ? luminance / whiteConstancyFactor.b : luminance / 0.001;
120: }
121: vec3 outColor = inputScaleFactor * color;
122: if (toneMappingChromaticAdaptation) {
123: outColor *= whiteConstancyFactor.rgb;
124: }
125: float luminance = toneCalcBrightness(outColor);
126: if (toneMappingColorDifferentiation && (luminance < 5.62)) {
127: float sLuminance = toneApproximateScotopicLuminance(outColor);
128: if (luminance <= 5.62e-3) {
129: outColor = vec3(sLuminance);
130: } else {
131: float w = (luminance – 5.62e-3) / 5.61438;
132: outColor = outColor * w + sLuminance * (1.0 – w);
133: }
134: }
135: outColor = outColor * (param_a / (param_b * outColor + param_c));
136: return outColor;
137: }
138: float maxExposurePhotographic(in vec4 color1, in vec4 color2)
139: {
140: return ((color1.r * color2.r) + (color1.g * color2.g)) + (color1.b * color2.b);
141: }
142: vec3 PhysicalMaxToneMapping(vec3 color) {
143: float vignettingInfluence = 1.0;
144: if (toneMappingVignetting > 0.0) {
145: vec3 vignettingCoords = vec3(0.0, 0.0, 0.0);
146: float aspect = toneMappingResolution.x / toneMappingResolution.y;
147: vignettingCoords.x = gl_FragCoord.x / toneMappingResolution.x – 0.5;
148: vignettingCoords.y = (gl_FragCoord.y / toneMappingResolution.y – 0.5) / aspect;
149: vignettingCoords.z = 1.0;
150: vignettingCoords = normalize(vignettingCoords);
151: vignettingInfluence = pow(vignettingCoords.z, toneMappingVignetting);
152: }
153: float inputScaleFactor = toneMappingPhysicalScale / PI;
154: float filmISO = toneMappingISO;
155: float camShutter = 1.0 / toneMappingShutter;
156: float fNumber = toneMappingAperture;
157: float cm2 = 1.0;
158: float burnHighlights = toneMappingHighlights;
159: float crushBlacks = toneMappingShadows;
160: float saturation = toneMappingSaturation;
161: vec3 whitePointInfluence = toneMappingWhiteBalance;
162: if (whitePointInfluence.r > 0.0) {
163: whitePointInfluence.r = 1.0 / whitePointInfluence.r;
164: } else {
165: whitePointInfluence.r = 1.0;
166: }
167: if (whitePointInfluence.g > 0.0) {
168: whitePointInfluence.g = 1.0 / whitePointInfluence.g;
169: } else {
170: whitePointInfluence.g = 1.0;
171: }
172: if (whitePointInfluence.b > 0.0) {
173: whitePointInfluence.b = 1.0 / whitePointInfluence.b;
174: } else {
175: whitePointInfluence.b = 1.0;
176: }
177: vec4 lumFactor = vec4(0.212671, 0.715160, 0.072169, 0.0);
178: float whiteLumFactor = maxExposurePhotographic(lumFactor, vec4(whitePointInfluence, 0.0));
179: whitePointInfluence.r /= whiteLumFactor;
180: whitePointInfluence.g /= whiteLumFactor;
181: whitePointInfluence.b /= whiteLumFactor;
182: float isoInfluence = 0.0;
183: float camShutterInv = 1.0 / camShutter;
184: if (filmISO > 0.0) {
185: isoInfluence = ((cm2 * 0.169811) * (filmISO * camShutterInv)) / ((15.4 * fNumber) * fNumber);
186: } else {
187: isoInfluence = cm2;
188: }
189: vec3 outColor = inputScaleFactor * color;
190: outColor.r = outColor.r * whitePointInfluence.r * isoInfluence * vignettingInfluence;
191: outColor.g = outColor.g * whitePointInfluence.g * isoInfluence * vignettingInfluence;
192: outColor.b = outColor.b * whitePointInfluence.b * isoInfluence * vignettingInfluence;
193: outColor.r = (outColor.r * (1.0 + (outColor.r * burnHighlights))) / (1.0 + outColor.r);
194: outColor.g = (outColor.g * (1.0 + (outColor.g * burnHighlights))) / (1.0 + outColor.g);
195: outColor.b = (outColor.b * (1.0 + (outColor.b * burnHighlights))) / (1.0 + outColor.b);
196: float lumFactor2 = maxExposurePhotographic(lumFactor, vec4(outColor, 0.0));
197: float tmpFloat = 1.0 – saturation;
198: outColor.r = outColor.r * saturation + lumFactor2 * tmpFloat;
199: outColor.g = outColor.g * saturation + lumFactor2 * tmpFloat;
200: outColor.b = outColor.b * saturation + lumFactor2 * tmpFloat;
201: outColor = max(vec3(0.0), outColor);
202: float crushBlacksFac = crushBlacks * 2.0 + 1.0;
203: float crushBlacksFac2 = pow(maxExposurePhotographic(lumFactor, vec4(outColor, 0.0)), 0.5);
204: tmpFloat = (1.0 – crushBlacksFac2);
205: if (crushBlacksFac2 < 1.0) {
206: outColor.r = outColor.r * crushBlacksFac2 + pow(outColor.r, crushBlacksFac) * tmpFloat;
207: outColor.g = outColor.g * crushBlacksFac2 + pow(outColor.g, crushBlacksFac) * tmpFloat;
208: outColor.b = outColor.b * crushBlacksFac2 + pow(outColor.b, crushBlacksFac) * tmpFloat;
209: }
210: return outColor;
211: }
212: float filmicBlenderDesaturationMinIntensity(vec3 color) {
213: float maxChannel = max(color.r, max(color.g, color.b));
214: float x = max(maxChannel, 0.6251);
215: return (1.2192868 * x – 0.63221059)
216: * ((x – 0.65069831) / (abs(x – 0.65069831) + 0.00952982) + 0.73015231);
217: }
218: vec3 filmicBlenderDesaturationTransform(vec3 color) {
219: const float CURVE_SMOOTHNESS = 0.03;
220: float minIntensity = filmicBlenderDesaturationMinIntensity(color);
221: vec4 x = vec4(color, 1.0) – minIntensity;
222: x = pow(x, vec4(2.0)) / (abs(x) + CURVE_SMOOTHNESS);
223: return (x.rgb – x.a + color + 1.0) / 2.0;
224: }
225: vec3 filmicBlenderDynamicRangeTransform(vec3 color) {
226: return pow(
227: (0.28882259 * color – 0.15880336)
228: / (pow(color – 0.6229693, vec3(2.0)) + 0.16965022)
229: + 0.20453365 * color + 0.37847142,
230: vec3(3.0)
231: );
232: }
233: vec3 FilmicBlenderToneMapping(vec3 color) {
234: color *= toneMappingExposure;
235: color = max(color, 0.000175);
236: color = clamp((log2(color) – FILMIC_BLENDER_LOG_MIN)
237: / (FILMIC_BLENDER_LOG_MAX – FILMIC_BLENDER_LOG_MIN), 0.0, 1.0);
238: color = filmicBlenderDesaturationTransform(color);
239: color = clamp(color / FILMIC_BLENDER_EXPOSURE_LATITUDE_RATIO, 0.0, 1.0);
240: color = filmicBlenderDynamicRangeTransform(color);
241: return color;
242: }
243: vec3 toneMapping(vec3 color) { return FilmicBlenderToneMapping(color); }
244:
245: vec4 LinearToLinear(in vec4 value) {
246: return value;
247: }
248: vec4 GammaToLinear(in vec4 value, in float gammaFactor) {
249: value = max(value, vec4(0.0));
250: return vec4(pow(value.rgb, vec3(gammaFactor)), value.a);
251: }
252: vec4 LinearToGamma(in vec4 value, in float gammaFactor) {
253: value = max(value, vec4(0.0));
254: return vec4(pow(value.rgb, vec3(1.0 / gammaFactor)), value.a);
255: }
256: vec4 sRGBToLinear(in vec4 value) {
257: #ifdef COMPAT_SIMPLIFIED_SRGB
258: return vec4(pow(value.rgb, vec3(2.2)), value.a);
259: #else
260: value = max(value, vec4(0.0));
261: return vec4(mix(pow(value.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), value.rgb * 0.0773993808, vec3(lessThanEqual(value.rgb, vec3(0.04045)))), value.a);
262: #endif
263: }
264: vec4 LinearTosRGB(in vec4 value) {
265: #ifdef COMPAT_SIMPLIFIED_SRGB
266: return vec4(pow(value.rgb, vec3(1.0/2.2)), value.a);
267: #else
268: value = max(value, vec4(0.0));
269: return vec4(mix(pow(value.rgb, vec3(0.41666)) * 1.055 – vec3(0.055), value.rgb * 12.92, vec3(lessThanEqual(value.rgb, vec3(0.0031308)))), value.a);
270: #endif
271: }
272: vec4 RGBEToLinear(in vec4 value) {
273: return vec4(value.rgb * exp2(value.a * 255.0 – 128.0), 1.0);
274: }
275: vec4 LinearToRGBE(in vec4 value) {
276: float maxComponent = max(max(value.r, value.g), value.b);
277: float fExp = clamp(ceil(log2(maxComponent)), -128.0, 127.0);
278: return vec4(value.rgb / exp2(fExp), (fExp + 128.0) / 255.0);
279: }
280: vec4 RGBMToLinear(in vec4 value, in float maxRange) {
281: return vec4(value.rgb * value.a * maxRange, 1.0);
282: }
283: vec4 LinearToRGBM(in vec4 value, in float maxRange) {
284: float maxRGB = max(value.r, max(value.g, value.b));
285: float M = clamp(maxRGB / maxRange, 0.0, 1.0);
286: M = ceil(M * 255.0) / 255.0;
287: return vec4(value.rgb / (M * maxRange), M);
288: }
289: vec4 RGBDToLinear(in vec4 value, in float maxRange) {
290: return vec4(value.rgb * ((maxRange / 255.0) / value.a), 1.0);
291: }
292: vec4 LinearToRGBD(in vec4 value, in float maxRange) {
293: float maxRGB = max(value.r, max(value.g, value.b));
294: float D = max(maxRange / maxRGB, 1.0);
295: D = clamp(floor(D) / 255.0, 0.0, 1.0);
296: return vec4(value.rgb * (D * (255.0 / maxRange)), D);
297: }
298: const mat3 cLogLuvM = mat3(0.2209, 0.3390, 0.4184, 0.1138, 0.6780, 0.7319, 0.0102, 0.1130, 0.2969);
299: vec4 LinearToLogLuv(in vec4 value) {
300: vec3 Xp_Y_XYZp = cLogLuvM * value.rgb;
301: Xp_Y_XYZp = max(Xp_Y_XYZp, vec3(1e-6, 1e-6, 1e-6));
302: vec4 vResult;
303: vResult.xy = Xp_Y_XYZp.xy / Xp_Y_XYZp.z;
304: float Le = 2.0 * log2(Xp_Y_XYZp.y) + 127.0;
305: vResult.w = fract(Le);
306: vResult.z = (Le – (floor(vResult.w * 255.0)) / 255.0) / 255.0;
307: return vResult;
308: }
309: const mat3 cLogLuvInverseM = mat3(6.0014, -2.7008, -1.7996, -1.3320, 3.1029, -5.7721, 0.3008, -1.0882, 5.6268);
310: vec4 LogLuvToLinear(in vec4 value) {
311: float Le = value.z * 255.0 + value.w;
312: vec3 Xp_Y_XYZp;
313: Xp_Y_XYZp.y = exp2((Le – 127.0) / 2.0);
314: Xp_Y_XYZp.z = Xp_Y_XYZp.y / value.y;
315: Xp_Y_XYZp.x = value.x * Xp_Y_XYZp.z;
316: vec3 vRGB = cLogLuvInverseM * Xp_Y_XYZp.rgb;
317: return vec4(max(vRGB, 0.0), 1.0);
318: }
319: vec4 linearToOutputTexel(vec4 value) { return LinearTosRGB(value); }
320: #define ESM_DISTANCE_SCALE 1.0
321:
322: uniform sampler2D tDiffuse;
323: uniform float opacity;
324: varying vec2 vUv;
325: void main() {
326: vec4 texel = (texture2D(tDiffuse, vUv));
327: #if MAP_TEXELS == 1
328: texel = mapTexelToLinear(texel);
329: #endif
330: gl_FragColor = opacity * texel;
331: #if MAP_TEXELS == 1
332: #if defined(TONE_MAPPING)
333: gl_FragColor.rgb = toneMapping(gl_FragColor.rgb);
334: #endif
335: gl_FragColor = linearToOutputTexel(gl_FragColor);
336: #endif
337: }Regards,
YW2022-02-14 at 3:08 pm #49363Yuri KovelenovStaff -
AuthorPosts
- You must be logged in to reply to this topic.