This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vec3 addGlitchEffect(vec3 render, vec2 uv, vec4 mouseFluid) { | |
vec2 st = uv; | |
vec2 offset = vec2(0.); | |
float strength = uFluidStrength*0.7-uLetterBox*0.3; | |
addFisheyeEffect(st, strength*0.5); | |
vec2 glitchUv = st*vec2(3., 6.)-uTime*0.01; | |
glitchUv = floor(glitchUv*15.)/15.; | |
glitchUv *= vec2(0.08, 0.1); | |
vec2 glitchUv2 = st*vec2(2., 5.)+uTime*0.03; | |
glitchUv2 = floor(glitchUv2*vec2(10., 15.))/vec2(10., 15.); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float intensity(in vec4 c) { | |
return sqrt((c.x*c.x)+(c.y*c.y)+(c.z*c.z)); | |
} | |
float sobel(float step, vec2 res, vec2 center, sampler2D tex) { | |
float stepX = step/res.x*uDpr; | |
float stepY = step/res.y*uDpr; | |
float tLeft = intensity(texture(tex, center+vec2(-stepX, stepY))); | |
float left = intensity(texture(tex, center+vec2(-stepX, 0))); | |
float bLeft = intensity(texture(tex, center+vec2(-stepX, -stepY))); | |
float top = intensity(texture(tex, center+vec2(0, stepY))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from 'three'; | |
const { cos, sin, PI } = Math; | |
const TEXTURE_OFFSET = -1.855; | |
export const latlong2xyz = (R, longitude, latitude)=> { | |
let lon = longitude * PI / 180 + 1.87; | |
const lat = latitude * PI / 180; | |
lon = -lon; | |
const x = R * cos(lat) * cos(lon); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// from https://mameson.com/experiment/glsl/proven_2/proven_2.html | |
function mm_hash12( iw){ //★ x, y とも 0〜2,000,000 の整数入力。 | |
const w = iw.mul( 0.000303) //★ 入力の 6 ケタとも活かす。 | |
.add( fract( iw.mul( 0.707))); //★ 入力の上位ケタは捨てて下位ケタ拾い上げ。 | |
const a = w.x.add( w.y.mul( 0.3)); //★ 斜めにする。 | |
//★ 最近気に入っているフェイク sin。 | |
a.assign( fract( a)); | |
a.assign( a.sub( a.mul( a))); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rotate2D = Fn(({pos,angle})=>{ | |
const s = sin(angle); | |
const c = cos(angle); | |
const m = mat2(c, s, s.mul(-1), c); | |
return m.mul(pos); | |
}) | |
const rotate3D = Fn(({pos,axis,angle})=>{ | |
const axisNorm = normalize(axis); | |
const s = sin(angle); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as THREE from "three/webgpu"; | |
import { | |
Fn, | |
positionLocal, | |
sin, | |
positionWorld | |
} from "three/tsl"; | |
import { OrbitControls } from "three/examples/jsm/Addons.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PI 3.1415926538 | |
const float EPS = 0.001; | |
vec4 mod289(vec4 x) { | |
return x - floor(x * (1.0 / 289.0)) * 289.0; | |
} | |
float mod289(float x) { | |
return x - floor(x * (1.0 / 289.0)) * 289.0; | |
} | |
vec4 permute(vec4 x) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float fixedpow(float a, float x) | |
{ | |
return pow(abs(a), x) * sign(a); | |
} | |
float cbrt(float a) | |
{ | |
return fixedpow(a, 0.3333333333); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// GLSL textureless classic 3D noise "cnoise", | |
// with an RSL-style periodic variant "pnoise". | |
// Author: Stefan Gustavson ([email protected]) | |
// Version: 2011-10-11 | |
// | |
// Many thanks to Ian McEwan of Ashima Arts for the | |
// ideas for permutation and gradient selection. | |
// | |
// Copyright (c) 2011 Stefan Gustavson. All rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
move(orientation, position) { | |
this.isAnimated = true; | |
let temp = new THREE.Vector3(); | |
let start = new THREE.Spherical().setFromVector3(this.camera.position); | |
let finish = new THREE.Spherical().setFromVector3(position); | |
if(Math.abs(start.theta-finish.theta)>Math.PI){ | |
if( Math.abs(start.theta-finish.theta - 2*Math.PI) <Math.abs(start.theta-finish.theta + 2*Math.PI)){ | |
finish.theta +=2*Math.PI | |
} else{ | |
finish.theta -=2*Math.PI |
NewerOlder