1
0
Эх сурвалжийг харах

Fixed smoothstep usage failing to compile in Chrome Beta. (#29265)

mrdoob 1 жил өмнө
parent
commit
480092d86a

+ 3 - 3
examples/webgpu_tsl_coffee_smoke.html

@@ -29,7 +29,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { mix, mul, positionLocal, smoothstep, texture, timerLocal, rotateUV, Fn, uv, vec2, vec3, vec4 } from 'three/tsl';
+			import { mix, mul, oneMinus, positionLocal, smoothstep, texture, timerLocal, rotateUV, Fn, uv, vec2, vec3, vec4 } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
 			import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
@@ -115,9 +115,9 @@
 
 
 						// edges fade
 						// edges fade
 						smoothstep( 0, 0.1, uv().x ),
 						smoothstep( 0, 0.1, uv().x ),
-						smoothstep( 1, 0.9, uv().x ),
+						smoothstep( 0, 0.1, oneMinus( uv().x ) ),
 						smoothstep( 0, 0.1, uv().y ),
 						smoothstep( 0, 0.1, uv().y ),
-						smoothstep( 1, 0.9, uv().y )
+						smoothstep( 0, 0.1, oneMinus( uv().y ) )
 
 
 					);
 					);
 
 

+ 6 - 6
examples/webgpu_tsl_vfx_tornado.html

@@ -27,7 +27,7 @@
 		<script type="module">
 		<script type="module">
 
 
 			import * as THREE from 'three';
 			import * as THREE from 'three';
-			import { luminance, cos, float, min, timerLocal, atan2, uniform, pass, bloom, PI, PI2, color, positionLocal, sin, texture, Fn, uv, vec2, vec3, vec4 } from 'three/tsl';
+			import { luminance, cos, float, min, timerLocal, atan2, uniform, pass, bloom, PI, PI2, color, positionLocal, oneMinus, sin, texture, Fn, uv, vec2, vec3, vec4 } from 'three/tsl';
 
 
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
 			import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
@@ -143,7 +143,7 @@
 					// outer fade
 					// outer fade
 					const distanceToCenter = uv().sub( 0.5 ).toVar();
 					const distanceToCenter = uv().sub( 0.5 ).toVar();
 					const outerFade = min(
 					const outerFade = min(
-						distanceToCenter.length().smoothstep( 0.5, 0.1 ),
+						oneMinus( distanceToCenter.length() ).smoothstep( 0.5, 0.9 ),
 						distanceToCenter.length().smoothstep( 0, 0.2 )
 						distanceToCenter.length().smoothstep( 0, 0.2 )
 					);
 					);
 
 
@@ -198,7 +198,7 @@
 					// outer fade
 					// outer fade
 					const outerFade = min(
 					const outerFade = min(
 						uv().y.smoothstep( 0, 0.1 ),
 						uv().y.smoothstep( 0, 0.1 ),
-						uv().y.smoothstep( 1, 0.6 )
+						oneMinus( uv().y ).smoothstep( 0, 0.4 )
 					);
 					);
 
 
 					// effect
 					// effect
@@ -249,7 +249,7 @@
 					// outer fade
 					// outer fade
 					const outerFade = min(
 					const outerFade = min(
 						uv().y.smoothstep( 0, 0.2 ),
 						uv().y.smoothstep( 0, 0.2 ),
-						uv().y.smoothstep( 1, 0.6 )
+						oneMinus( uv().y ).smoothstep( 0, 0.4 )
 					);
 					);
 
 
 					// effect
 					// effect
@@ -322,7 +322,7 @@
 			}
 			}
 
 
 			async function animate() {
 			async function animate() {
-			
+
 				controls.update();
 				controls.update();
 
 
 				postProcessing.render();
 				postProcessing.render();
@@ -331,4 +331,4 @@
 
 
 		</script>
 		</script>
 	</body>
 	</body>
-</html>
+</html>

粤ICP备19079148号