What is Nostr?
Row /
npub1u3s…xaql
2025-01-07 06:47:11

Row on Nostr: How about some glsl shaders on nostr? Watch this post on #glostr ...

How about some glsl shaders on nostr?
Watch this post on #glostr
https://rowdaboat.github.io/glostr/#npub1u3svk99639mcdfn43s2nawg4a2j4ejmgrq2n63l4t67wzqdmtnks2uxaql

```glsl
#version 300 es
precision mediump float;

// Original shader:
// fractal pyramid by bradjamesgrant
// www.shadertoy.com/view/tsXBzS

uniform vec2 u_resolution;
uniform float u_time;

out vec4 fragColor;

vec3 palette(float d){
return mix(vec3(0.2,0.7,0.9),vec3(1.,0.,1.),d);
}

vec2 rotate(vec2 p,float a){
float c = cos(a);
float s = sin(a);
return p*mat2(c,s,-s,c);
}

float map(vec3 p){
for( int i = 0; i<8; ++i){
float t = u_time*0.2;
p.xz =rotate(p.xz,t);
p.xy =rotate(p.xy,t*1.89);
p.xz = abs(p.xz);
p.xz-=.5;
}
return dot(sign(p),p)/5.;
}

vec4 rm (vec3 ro, vec3 rd){
float t = 0.;
vec3 col = vec3(0.);
float d;
for(float i =0.; i<64.; i++){
vec3 p = ro + rd*t;
d = map(p)*.5;
if(d<0.02){
break;
}
if(d>100.){
break;
}
//col+=vec3(0.6,0.8,0.8)/(400.*(d));
col+=palette(length(p)*.1)/(400.*(d));
t+=d;
}
return vec4(col, 1.);//1./(d*100.));
}
void main()
{
vec2 uv = (gl_FragCoord.xy - (u_resolution.xy/2.)) / u_resolution.x;
vec3 ro = vec3(0.,0.,-50.);
ro.xz = rotate(ro.xz,u_time);
vec3 cf = normalize(-ro);
vec3 cs = normalize(cross(cf,vec3(0.,1.,0.)));
vec3 cu = normalize(cross(cf,cs));

vec3 uuv = ro+cf*3. + uv.x*cs + uv.y*cu;
vec3 rd = normalize(uuv-ro);
vec4 col = rm(ro,rd);

fragColor = col;
}
```
Author Public Key
npub1u3svk99639mcdfn43s2nawg4a2j4ejmgrq2n63l4t67wzqdmtnks2uxaql