Skip to content

TSL: hashBlur - added default uv #29614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions examples/jsm/tsl/display/hashBlur.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
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

export const hashBlur = /*#__PURE__*/ Fn( ( [ textureNode, bluramount = float( 0.1 ), repeats = float( 45 ) ] ) => {

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 ) ) );
Binary file modified examples/screenshots/webgpu_backdrop_area.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion examples/webgpu_backdrop_area.html
Original file line number Diff line number Diff line change
@@ -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