Now we need to run these on a small spherical display like the Gakken Worldeye https://youtu.be/85rs0WHnUy0?feature=shared&t=53 Here's an animated eyeball (hat tip chatgpt): uniform float time; varying vec2 vUv; vec3 lighting(vec3 normal, vec3 eyeDirection, vec3 lightDirection) { float diffuse = max(dot(normal, lightDirection), 0.0); vec3 reflected = reflect(-lightDirection, normal); float specular = pow(max(dot(refl…
Write shaders for the (sim) Vegas sphere
71–80 of 91 posts
Re: Write shaders for the (sim) Vegas sphere
#72Re: Write shaders for the (sim) Vegas sphere
#73Earlier quoted context omitted.
> cone For physical tiles, clearly not as the curvature would be wrong. I'm sure there remain interesting questions, but it's not sufficiently obvious to me what projection makes sense that I'm able to get further into the problem.
A cone has the same curvature as the plane.
Re: Write shaders for the (sim) Vegas sphere
#74Re: Write shaders for the (sim) Vegas sphere
#75Never played with shaders before, made a spinning watermelon. uniform float time; varying vec2 vUv; void main() { vec2 st = vUv.xy; float f1 = length(abs(2.0*st)/2.0 - .1*time); float stripe = fract(f1*10.0); float stripe2 = stripe*stripe*stripe; float stripe3 = fract(-f1*10.0); float stripe4 = stripe3*stripe3*stripe3; float f2 = length(abs(4.0*st)/2.0 - .2*time); float stripe5 = fract(f2*10.0); float stripe6 = strip…
The inputs provided are defined by the programmer, and in this case, they are an uniform float (same value given to every fragment) called time, and a varying vec2 (different value given to each fragment, the vertex shader outputs a value for this at every vertex, and when the fragments are created, a value is linearly interpolated between the three relevant vertexes based on the position of the fragment on the triangle) called vUv, which is just the co-ordinates of a pixel on the sphere.
gl_FragColor is the single output, a rgba vector that represents color that is applied for that fragment.
The only things missing from the more typical shaders used in all games and, for example, google earth is texturing and lighting -- normally you provide the fragment shader a texture handle, which it then uses with texture co-ordinates provided from the vertex shader to sample the texture, and for lighting the vertex shader provides a surface normal, which you can use with an uniform argument for the location of the light source to correctly shade the fragment.
If the idea of running a program for each and every separate pixel individually sounds inefficient, it would be, but the programming model here is actually SIMT. That is, you give the program as if you are working on a single pixel, but it is converted to actually work on a wide SIMD array, doing 32 (NVidia) or 64 (AMD) pixels at the same time. The cost of this is that all conditional branches are essentially converted into conditional operations, meaning that as a first approximation, you always execute both sides of any if statement.
Re: Write shaders for the (sim) Vegas sphere
#76Here's a static penrose tiling. https://gist.github.com/vjeranc/265db912d4004c7c0b0f16ae5fda... Interestingly, sphere is not infinite so having this aperiodic tiling is pointless (still looks nice). Although, I never found out if there's a similar set of tiles (or a monotile) that can tile an infinite cone.
> cone For physical tiles, clearly not as the curvature would be wrong. I'm sure there remain interesting questions, but it's not sufficiently obvious to me what projection makes sense that I'm able to get further into the problem.
Re: Write shaders for the (sim) Vegas sphere
#77Also check out the shaders at https://www.glslsandbox.com But beware there's often idiot children posting NSFW shaders there, the mods don't monitor it very closely.
Re: Write shaders for the (sim) Vegas sphere
#78This reminds me of when Matt Parker let his viewers control his Christmas tree lights: https://youtu.be/v7eHTNm1YtU?si=GqK6oSZVHBJkjcib
How does this have anything to do with that?
Re: Write shaders for the (sim) Vegas sphere
#79Re: Write shaders for the (sim) Vegas sphere
#80Earlier quoted context omitted.
How does this have anything to do with that?
It's also a way for the public to try visualizations in a 3D space. If you're interested in trying out some shaders and seeing what other people have created it's another vector to explore.
By this definition, someone flipping their light switches on and off is a "visualization in 3D space".