Quellcode durchsuchen

TSL: `hashBlur` - added default `uv` (#29614)

* `hashBlur` - added default `uv`

* improve light intensity
sunag vor 1 Jahr
Ursprung
Commit
65c13da78a

+ 2 - 4
examples/jsm/tsl/display/hashBlur.js

@@ -1,4 +1,4 @@
-import { float, Fn, vec2, sin, rand, degrees, cos, Loop, vec4 } from 'three/tsl';
+import { float, Fn, vec2, uv, sin, rand, degrees, cos, Loop, vec4 } from 'three/tsl';
 
 // https://www.shadertoy.com/view/4lXXWn
 
@@ -6,11 +6,9 @@ export const hashBlur = /*#__PURE__*/ Fn( ( [ textureNode, bluramount = float( 0
 
 	const draw = ( uv ) => textureNode.uv( uv );
 
-	const targetUV = textureNode.uvNode;
+	const targetUV = textureNode.uvNode || uv();
 	const blurred_image = vec4( 0. ).toVar();
 
-	//const map = textureNode.value;
-
 	Loop( { start: 0., end: repeats, type: 'float' }, ( { i } ) => {
 
 		const q = vec2( vec2( cos( degrees( i.div( repeats ).mul( 360. ) ) ), sin( degrees( i.div( repeats ).mul( 360. ) ) ) ).mul( rand( vec2( i, targetUV.x.add( targetUV.y ) ) ).add( bluramount ) ) );

BIN
examples/screenshots/webgpu_backdrop_area.jpg


+ 1 - 1
examples/webgpu_backdrop_area.html

@@ -50,7 +50,7 @@
 
 				clock = new THREE.Clock();
 
-				const ambient = new THREE.AmbientLight( 0xffffff, 2 );
+				const ambient = new THREE.AmbientLight( 0xffffff, 2.5 );
 				scene.add( ambient );
 			
 				// model

粤ICP备19079148号