Skip to content

Commit

Permalink
Updated
Browse files Browse the repository at this point in the history
  • Loading branch information
deploy committed Nov 25, 2024
1 parent d09c969 commit 2368de8
Show file tree
Hide file tree
Showing 52 changed files with 125,343 additions and 44 deletions.
5,096 changes: 5,095 additions & 1 deletion [email protected]/FramerShaderGradient.mjs

Large diffs are not rendered by default.

3,864 changes: 3,863 additions & 1 deletion [email protected]/ShaderGradient/Controls/CameraControl.mjs

Large diffs are not rendered by default.

3,864 changes: 3,863 additions & 1 deletion [email protected]/ShaderGradient/Controls/Controls.mjs

Large diffs are not rendered by default.

3,864 changes: 3,863 additions & 1 deletion [email protected]/ShaderGradient/Controls/index.mjs

Large diffs are not rendered by default.

3,565 changes: 3,564 additions & 1 deletion [email protected]/ShaderGradient/Controls/useCameraAnimation.mjs

Large diffs are not rendered by default.

3,569 changes: 3,568 additions & 1 deletion [email protected]/ShaderGradient/Lights/Environment/EnvironmentMap.mjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import"../../../chunk-FLVFHPBB.mjs";var e={sunset:"venice_sunset_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",night:"dikhololo_night_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr",forest:"forest_slope_1k.hdr",apartment:"lebombo_1k.hdr",studio:"studio_small_03_1k.hdr",city:"potsdamer_platz_1k.hdr",park:"rooitou_park_1k.hdr",lobby:"st_fagans_interior_1k.hdr"};export{e as presetsObj};
var e={sunset:"venice_sunset_1k.hdr",dawn:"kiara_1_dawn_1k.hdr",night:"dikhololo_night_1k.hdr",warehouse:"empty_warehouse_01_1k.hdr",forest:"forest_slope_1k.hdr",apartment:"lebombo_1k.hdr",studio:"studio_small_03_1k.hdr",city:"potsdamer_platz_1k.hdr",park:"rooitou_park_1k.hdr",lobby:"st_fagans_interior_1k.hdr"};export{e as presetsObj};
3,569 changes: 3,568 additions & 1 deletion [email protected]/ShaderGradient/Lights/Environment/index.mjs

Large diffs are not rendered by default.

3,569 changes: 3,568 additions & 1 deletion [email protected]/ShaderGradient/Lights/Environment/useRGBELoader.mjs

Large diffs are not rendered by default.

3,569 changes: 3,568 additions & 1 deletion [email protected]/ShaderGradient/Lights/Lights.mjs

Large diffs are not rendered by default.

3,569 changes: 3,568 additions & 1 deletion [email protected]/ShaderGradient/Lights/index.mjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion [email protected]/ShaderGradient/Mesh/Geometry.mjs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import{a}from"../../chunk-NT2YB4PR.mjs";import"../../chunk-FLVFHPBB.mjs";export{a as Geometry};
import{Fragment as o,jsx as n,jsxs as r}from"react/jsx-runtime";function t({type:e}){return r(o,{children:[e==="plane"&&n("planeGeometry",{args:[10,10,1,192]}),e==="sphere"&&n("icosahedronGeometry",{args:[1,192/3]}),e==="waterPlane"&&n("planeGeometry",{args:[10,10,192,192]})]})}export{t as Geometry};
3,565 changes: 3,564 additions & 1 deletion [email protected]/ShaderGradient/Mesh/Materials.mjs

Large diffs are not rendered by default.

4,263 changes: 4,262 additions & 1 deletion [email protected]/ShaderGradient/Mesh/Mesh.mjs

Large diffs are not rendered by default.

4,263 changes: 4,262 additions & 1 deletion [email protected]/ShaderGradient/Mesh/index.mjs

Large diffs are not rendered by default.

4,099 changes: 4,098 additions & 1 deletion [email protected]/ShaderGradient/PostProcessing/PostProcessing.mjs

Large diffs are not rendered by default.

4,099 changes: 4,098 additions & 1 deletion [email protected]/ShaderGradient/PostProcessing/index.mjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import"../../../../chunk-FLVFHPBB.mjs";var E={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18};export{E as BlendFunction};
var E={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18};export{E as BlendFunction};
4,066 changes: 4,065 additions & 1 deletion [email protected]/ShaderGradient/PostProcessing/lib/pp/HalftonePass.mjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1,331 @@
import{a}from"../../../../chunk-VJZMGGI7.mjs";import"../../../../chunk-FLVFHPBB.mjs";export{a as HalftoneShader};
var e={uniforms:{tDiffuse:{value:null},shape:{value:1},radius:{value:2},rotateR:{value:Math.PI/12*1},rotateG:{value:Math.PI/12*2},rotateB:{value:Math.PI/12*3},scatter:{value:1},width:{value:20},height:{value:20},blending:{value:1},blendingMode:{value:1},greyscale:{value:!1},disable:{value:!1}},vertexShader:`
varying vec2 vUV;
varying vec3 vPosition;
void main() {
vUV = uv;
vPosition = position;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
}`,fragmentShader:`
#define SQRT2_MINUS_ONE 0.41421356
#define SQRT2_HALF_MINUS_ONE 0.20710678
#define PI2 6.28318531
#define SHAPE_DOT 1
#define SHAPE_ELLIPSE 2
#define SHAPE_LINE 3
#define SHAPE_SQUARE 4
#define BLENDING_LINEAR 1
#define BLENDING_MULTIPLY 2
#define BLENDING_ADD 3
#define BLENDING_LIGHTER 4
#define BLENDING_DARKER 5
uniform sampler2D tDiffuse;
uniform float radius;
uniform float rotateR;
uniform float rotateG;
uniform float rotateB;
uniform float scatter;
uniform float width;
uniform float height;
uniform int shape;
uniform bool disable;
uniform float blending;
uniform int blendingMode;
varying vec2 vUV;
varying vec3 vPosition;
uniform bool greyscale;
const int samples = 8;
float blend( float a, float b, float t ) {
// linear blend
return a * ( 1.0 - t ) + b * t;
}
float hypot( float x, float y ) {
// vector magnitude
return sqrt( x * x + y * y );
}
float rand( vec2 seed ){
// get pseudo-random number
return fract( sin( dot( seed.xy, vec2( 12.9898, 78.233 ) ) ) * 43758.5453 );
}
float distanceToDotRadius( float channel, vec2 coord, vec2 normal, vec2 p, float angle, float rad_max ) {
// apply shape-specific transforms
float dist = hypot( coord.x - p.x, coord.y - p.y );
float rad = channel;
if ( shape == SHAPE_DOT ) {
rad = pow( abs( rad ), 1.125 ) * rad_max;
} else if ( shape == SHAPE_ELLIPSE ) {
rad = pow( abs( rad ), 1.125 ) * rad_max;
if ( dist != 0.0 ) {
float dot_p = abs( ( p.x - coord.x ) / dist * normal.x + ( p.y - coord.y ) / dist * normal.y );
dist = ( dist * ( 1.0 - SQRT2_HALF_MINUS_ONE ) ) + dot_p * dist * SQRT2_MINUS_ONE;
}
} else if ( shape == SHAPE_LINE ) {
rad = pow( abs( rad ), 1.5) * rad_max;
float dot_p = ( p.x - coord.x ) * normal.x + ( p.y - coord.y ) * normal.y;
dist = hypot( normal.x * dot_p, normal.y * dot_p );
} else if ( shape == SHAPE_SQUARE ) {
float theta = atan( p.y - coord.y, p.x - coord.x ) - angle;
float sin_t = abs( sin( theta ) );
float cos_t = abs( cos( theta ) );
rad = pow( abs( rad ), 1.4 );
rad = rad_max * ( rad + ( ( sin_t > cos_t ) ? rad - sin_t * rad : rad - cos_t * rad ) );
}
return rad - dist;
}
struct Cell {
// grid sample positions
vec2 normal;
vec2 p1;
vec2 p2;
vec2 p3;
vec2 p4;
float samp2;
float samp1;
float samp3;
float samp4;
};
vec4 getSample( vec2 point ) {
// multi-sampled point
vec4 tex = texture2D( tDiffuse, vec2( point.x / width, point.y / height ) );
float base = rand( vec2( floor( point.x ), floor( point.y ) ) ) * PI2;
float step = PI2 / float( samples );
// float dist = radius * 0.66;
float dist = radius * 0.0;
for ( int i = 0; i < samples; ++i ) {
float r = base + step * float( i );
vec2 coord = point + vec2( cos( r ) * dist, sin( r ) * dist );
tex += texture2D( tDiffuse, vec2( coord.x / width, coord.y / height ) );
}
tex /= float( samples ) + 1.0;
return tex;
}
float getDotColour( Cell c, vec2 p, int channel, float angle, float aa ) {
// get colour for given point
float dist_c_1, dist_c_2, dist_c_3, dist_c_4, res;
if ( channel == 0 ) {
c.samp1 = getSample( c.p1 ).r;
c.samp2 = getSample( c.p2 ).r;
c.samp3 = getSample( c.p3 ).r;
c.samp4 = getSample( c.p4 ).r;
} else if (channel == 1) {
c.samp1 = getSample( c.p1 ).g;
c.samp2 = getSample( c.p2 ).g;
c.samp3 = getSample( c.p3 ).g;
c.samp4 = getSample( c.p4 ).g;
} else {
c.samp1 = getSample( c.p1 ).b;
c.samp3 = getSample( c.p3 ).b;
c.samp2 = getSample( c.p2 ).b;
c.samp4 = getSample( c.p4 ).b;
}
dist_c_1 = distanceToDotRadius( c.samp1, c.p1, c.normal, p, angle, radius );
dist_c_2 = distanceToDotRadius( c.samp2, c.p2, c.normal, p, angle, radius );
dist_c_3 = distanceToDotRadius( c.samp3, c.p3, c.normal, p, angle, radius );
dist_c_4 = distanceToDotRadius( c.samp4, c.p4, c.normal, p, angle, radius );
res = ( dist_c_1 > 0.0 ) ? clamp( dist_c_1 / aa, 0.0, 1.0 ) : 0.0;
// res = 0.0;
res += ( dist_c_2 > 0.0 ) ? clamp( dist_c_2 / aa, 0.0, 1.0 ) : 0.0;
res += ( dist_c_3 > 0.0 ) ? clamp( dist_c_3 / aa, 0.0, 1.0 ) : 0.0;
res += ( dist_c_4 > 0.0 ) ? clamp( dist_c_4 / aa, 0.0, 1.0 ) : 0.0;
res = clamp( res, 0.0, 1.0 );
return res;
// return 2
}
Cell getReferenceCell( vec2 p, vec2 origin, float grid_angle, float step ) {
// get containing cell
Cell c;
// calc grid
vec2 n = vec2( cos( grid_angle ), sin( grid_angle ) );
float threshold = step * 0.5;
float dot_normal = n.x * ( p.x - origin.x ) + n.y * ( p.y - origin.y );
float dot_line = -n.y * ( p.x - origin.x ) + n.x * ( p.y - origin.y );
vec2 offset = vec2( n.x * dot_normal, n.y * dot_normal );
float offset_normal = mod( hypot( offset.x, offset.y ), step );
float normal_dir = ( dot_normal < 0.0 ) ? 1.0 : -1.0;
float normal_scale = ( ( offset_normal < threshold ) ? -offset_normal : step - offset_normal ) * normal_dir;
float offset_line = mod( hypot( ( p.x - offset.x ) - origin.x, ( p.y - offset.y ) - origin.y ), step );
float line_dir = ( dot_line < 0.0 ) ? 1.0 : -1.0;
float line_scale = ( ( offset_line < threshold ) ? -offset_line : step - offset_line ) * line_dir;
// get closest corner
c.normal = n;
c.p1.x = p.x - n.x * normal_scale + n.y * line_scale;
c.p1.y = p.y - n.y * normal_scale - n.x * line_scale;
// scatter
if ( scatter != 0.0 ) {
float off_mag = scatter * threshold * 0.5;
float off_angle = rand( vec2( floor( c.p1.x ), floor( c.p1.y ) ) ) * PI2;
c.p1.x += cos( off_angle ) * off_mag;
c.p1.y += sin( off_angle ) * off_mag;
}
// find corners
float normal_step = normal_dir * ( ( offset_normal < threshold ) ? step : -step );
float line_step = line_dir * ( ( offset_line < threshold ) ? step : -step );
c.p2.x = c.p1.x - n.x * normal_step;
c.p2.y = c.p1.y - n.y * normal_step;
c.p3.x = c.p1.x + n.y * line_step;
c.p3.y = c.p1.y - n.x * line_step;
c.p4.x = c.p1.x - n.x * normal_step + n.y * line_step;
c.p4.y = c.p1.y - n.y * normal_step - n.x * line_step;
return c;
}
float blendColour( float a, float b, float t ) {
// blend colours
if ( blendingMode == BLENDING_LINEAR ) {
return blend( a, b, 1.0 - t );
} else if ( blendingMode == BLENDING_ADD ) {
return blend( a, min( 1.0, a + b ), t );
} else if ( blendingMode == BLENDING_MULTIPLY ) {
return blend( a, max( 0.0, a * b ), t );
} else if ( blendingMode == BLENDING_LIGHTER ) {
return blend( a, max( a, b ), t );
} else if ( blendingMode == BLENDING_DARKER ) {
return blend( a, min( a, b ), t );
} else {
return blend( a, b, 1.0 - t );
}
}
void main() {
if ( ! disable ) {
// setup
vec2 p = vec2( vUV.x * width, vUV.y * height ) - vec2(vPosition.x, vPosition.y) * 3.0; // - position values to remove black borders.
vec2 origin = vec2( 0, 0 );
float aa = ( radius < 2.5 ) ? radius * 0.5 : 1.25;
// float aa = 0.0;
// get channel samples
Cell cell_r = getReferenceCell( p, origin, rotateR, radius );
Cell cell_g = getReferenceCell( p, origin, rotateG, radius );
Cell cell_b = getReferenceCell( p, origin, rotateB, radius );
float r = getDotColour( cell_r, p, 0, rotateR, aa );
float g = getDotColour( cell_g, p, 1, rotateG, aa );
float b = getDotColour( cell_b, p, 2, rotateB, aa );
// blend with original
vec4 colour = texture2D( tDiffuse, vUV );
// add masking before blendColour
if (colour.r == 0.0) {
r = 0.0;
} else {
r = blendColour( r, colour.r, blending );
}
if (colour.g == 0.0) {
g = 0.0;
} else {
g = blendColour( g, colour.g, blending );
}
if (colour.b == 0.0) {
b = 0.0;
} else {
b = blendColour( b, colour.b, blending );
}
if ( greyscale ) {
r = g = b = (r + b + g) / 3.0;
}
// add alpha channel to each r, g, b colors
vec4 vR;
vec4 vG;
vec4 vB;
// apply transparent to outside of mesh
if (r == 0.0 && colour.r == 0.0) {
vR = vec4( 0, 0, 0, 0 );
} else {
vR = vec4( r, 0, 0, 1 );
}
if (g == 0.0 && colour.g == 0.0) {
vG = vec4( 0, 0, 0, 0 );
} else {
vG = vec4( 0, g, 0, 1 );
}
if (b == 0.0 && colour.b == 0.0) {
vB = vec4( 0, 0, 0, 0 );
} else {
vB = vec4( 0, 0, b, 1 );
}
// gl_FragColor = vec4( r, g, b, 1.0 );
gl_FragColor = vR + vG + vB;
} else {
gl_FragColor = texture2D( tDiffuse, vUV );
}
}`};export{e as HalftoneShader};
3,554 changes: 3,553 additions & 1 deletion [email protected]/ShaderGradient/PostProcessing/lib/pp/Pass.mjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1 @@
import{a}from"../../../../../chunk-E7V5LYA3.mjs";import"../../../../../chunk-FLVFHPBB.mjs";export{a as BlendFunction};
var E={SKIP:0,ADD:1,ALPHA:2,AVERAGE:3,COLOR_BURN:4,COLOR_DODGE:5,DARKEN:6,DIFFERENCE:7,EXCLUSION:8,LIGHTEN:9,MULTIPLY:10,DIVIDE:11,NEGATION:12,NORMAL:13,OVERLAY:14,REFLECT:15,SCREEN:16,SOFT_LIGHT:17,SUBTRACT:18};export{E as BlendFunction};
3,732 changes: 3,731 additions & 1 deletion [email protected]/ShaderGradient/PostProcessing/lib/pp/blending/BlendMode.mjs

Large diffs are not rendered by default.

3,732 changes: 3,731 additions & 1 deletion [email protected]/ShaderGradient/PostProcessing/lib/pp/blending/index.mjs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
import{a}from"../../../../../../chunk-LHZKBITZ.mjs";import"../../../../../../chunk-FLVFHPBB.mjs";export{a as CopyShader};
var e={uniforms:{tDiffuse:{value:null},opacity:{value:1}},vertexShader:`
varying vec2 vUv;
void main() {
vUv = uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,fragmentShader:`
uniform float opacity;
uniform sampler2D tDiffuse;
varying vec2 vUv;
void main() {
vec4 texel = texture2D( tDiffuse, vUv );
gl_FragColor = opacity * texel;
}`};export{e as CopyShader};
5,096 changes: 5,095 additions & 1 deletion [email protected]/ShaderGradient/ShaderGradient.mjs

Large diffs are not rendered by default.

5,096 changes: 5,095 additions & 1 deletion [email protected]/ShaderGradient/index.mjs

Large diffs are not rendered by default.

3,856 changes: 3,855 additions & 1 deletion [email protected]/ShaderGradientCanvas.mjs

Large diffs are not rendered by default.

5,095 changes: 5,095 additions & 0 deletions [email protected]/StoreShaderGradient/StoreShaderGradient.mjs

Large diffs are not rendered by default.

5,117 changes: 5,117 additions & 0 deletions [email protected]/StoreShaderGradient/index.mjs

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions [email protected]/StoreShaderGradient/store/index.mjs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
var t={base:{title:"Base",color:"white",props:{positionX:0,positionY:0,positionZ:0,rotationX:0,rotationY:0,rotationZ:0,uAmplitude:2,color1:"#ff5005",color2:"#dbba95",color3:"#d0bce1"}},halo:{title:"Halo",color:"white",props:{type:"plane",uAmplitude:1,uDensity:1.3,uSpeed:.4,uStrength:4,uTime:0,uFrequency:5.5,range:"enabled",rangeStart:0,rangeEnd:40,frameRate:10,destination:"onCanvas",format:"gif",axesHelper:"off",brightness:1.2,cAzimuthAngle:180,cDistance:3.6,cPolarAngle:90,cameraZoom:1,color1:"#ff5005",color2:"#dbba95",color3:"#d0bce1",embedMode:"off",envPreset:"city",gizmoHelper:"hide",grain:"on",lightType:"3d",pixelDensity:1,fov:45,positionX:-1.4,positionY:0,positionZ:0,reflection:.1,rotationX:0,rotationY:10,rotationZ:50,shader:"defaults",animate:"on",wireframe:!1}},pensive:{title:"Pensive",color:"white",props:{range:"enabled",rangeStart:0,rangeEnd:40,frameRate:10,destination:"onCanvas",format:"gif",animate:"on",axesHelper:"off",brightness:1.5,cAzimuthAngle:250,cDistance:1.5,cPolarAngle:140,cameraZoom:12.5,color1:"#809bd6",color2:"#910aff",color3:"#af38ff",embedMode:"off",envPreset:"city",gizmoHelper:"hide",grain:"on",lightType:"3d",pixelDensity:1,fov:45,positionX:0,positionY:0,positionZ:0,reflection:.5,rotationX:0,rotationY:0,rotationZ:140,shader:"defaults",type:"sphere",uAmplitude:7,uDensity:.8,uFrequency:5.5,uSpeed:.3,uStrength:.4,uTime:0,wireframe:!1}},mint:{title:"Mint",color:"white",props:{range:"enabled",rangeStart:0,rangeEnd:40,frameRate:10,destination:"onCanvas",format:"gif",animate:"on",axesHelper:"off",brightness:1.2,cAzimuthAngle:170,cDistance:4.4,cPolarAngle:70,cameraZoom:1,color1:"#94ffd1",color2:"#6bf5ff",color3:"#ffffff",embedMode:"off",envPreset:"city",gizmoHelper:"hide",grain:"off",lightType:"3d",pixelDensity:1,fov:45,positionX:0,positionY:.9,positionZ:-.3,reflection:.1,rotationX:45,rotationY:0,rotationZ:0,shader:"defaults",type:"waterPlane",uAmplitude:0,uDensity:1.2,uFrequency:0,uSpeed:.2,uStrength:3.4,uTime:0,wireframe:!1}},interstella:{title:"Interstella",color:"white",props:{range:"enabled",rangeStart:0,rangeEnd:40,frameRate:10,destination:"onCanvas",format:"gif",animate:"on",axesHelper:"off",brightness:.8,cAzimuthAngle:270,cDistance:.5,cPolarAngle:180,cameraZoom:15.1,color1:"#73bfc4",color2:"#ff810a",color3:"#8da0ce",embedMode:"off",envPreset:"city",gizmoHelper:"hide",grain:"on",lightType:"env",pixelDensity:1,fov:45,positionX:-.1,positionY:0,positionZ:0,reflection:.4,rotationX:0,rotationY:130,rotationZ:70,shader:"defaults",type:"sphere",uAmplitude:3.2,uDensity:.8,uFrequency:5.5,uSpeed:.3,uStrength:.3,uTime:0,wireframe:!1}}};var g=Object.values(t);var y=0,c=p(t),b=c[0].url;function p(r){return Object.entries(r).map(([d,n])=>{let{title:i,color:a,props:s}=n,l=new URLSearchParams(Object.entries(s).reduce((o,[f,e])=>(o[f]=String(e),o),{})).toString();return{title:i,color:a,url:`?${l}`}})}export{b as DEFAUlT_PRESET,c as PRESETS,y as initialActivePreset};
Loading

0 comments on commit 2368de8

Please sign in to comment.