Live data from Hacker News

Write shaders for the (sim) Vegas sphere

whenistheweekend.com

81–90 of 91 posts

Re: Write shaders for the (sim) Vegas sphere

#81

Also 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.

Building up a body with a few hundred lines of GLSL is one thing, but constructing an orgy with just 11 is something else entirely. I wonder what the Komoglorov complexity of "NSFW GLSL Content" is. float orgy(vec2 p) { float pl=0., expsmo=0.; float t=sin(time*8.); float a=-.35+t*.02; p*=mat2(cos(a),sin(a),-sin(a),cos(a)); p=p*.07+vec2(.728,-.565)+t*.017+vec2(0.,t*.014); for (int i=0; i https://www.glslsandbox.com/e#…

> what the Komoglorov complexity of "NSFW GLSL Content" is

can you explain what you mean by above?

Re: Write shaders for the (sim) Vegas sphere

#82
post #38

Never 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 GPU takes model space objects (a long list of vertexes representing the 3 corners of triangles), a camera position and a vertex shader that transforms them into screen space. Then it splits the triangles into fragments (pixels), and runs the provided fragment shader (also called pixel shader in dx-land) on each fragment. The inputs provided are defined by the programmer, and in this case, they are an uniform floa…

Thanks, that helped! The idea of massively parallel computations like that was kind of what I was leveraging, I was like “I guess I treat this vec2 as a NumPy array of vectors?”—but it's cool that the job gets batched behind the scenes

Re: Write shaders for the (sim) Vegas sphere

#83

Earlier quoted context omitted.

Building up a body with a few hundred lines of GLSL is one thing, but constructing an orgy with just 11 is something else entirely. I wonder what the Komoglorov complexity of "NSFW GLSL Content" is. float orgy(vec2 p) { float pl=0., expsmo=0.; float t=sin(time*8.); float a=-.35+t*.02; p*=mat2(cos(a),sin(a),-sin(a),cos(a)); p=p*.07+vec2(.728,-.565)+t*.017+vec2(0.,t*.014); for (int i=0; i https://www.glslsandbox.com/e#…

> what the Komoglorov complexity of "NSFW GLSL Content" is can you explain what you mean by above?

The smallest GLSL program that generates content generally regarded as NSFW.

It's among the more interesting of concepts in computer science: https://en.wikipedia.org/wiki/Kolmogorov_complexity

Though it probably greatly benefits from a good lecturer if you do not have the background... https://people.csail.mit.edu/rrw/6.045-2020/

Re: Write shaders for the (sim) Vegas sphere

#84

Earlier 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.

I now realized I wanted to say cylinder, not cone haha.

That's also interesting!

Assuming it's possible at all, I think scale winds up mattering in a way that it doesn't for a plane, because you have to accommodate "meeting yourself" again some fixed distance away.

Re: Write shaders for the (sim) Vegas sphere

#87
I am learning to write shaders. I came across the Las Vegas Sphere thread on X and I love the instant feedback that Alexandre Devaux has created on his site. My attempt to create the Amiga BOING! resulted in a full sphere instead of being cut off at the base like all the other examples. Can someone clue me into why this has occurred and how to fix it? My code is very "hacky" and I only partially understand what I've done here. Any help would be appreciated.

    uniform float time;
    varying vec2 vUv;
    varying vec3 vNormal;

    float rows = 20.0,
          cols = 10.0;
  
    float direction = -1.0;
   
    vec4 colorOne = vec4(1.0,1.0,1.0,0.1),
         colorTwo = vec4(1.0,0.0,0.0,0.1);
    vec4 amiga =  vec4(1.0,0.0,0.0,0.1);

    vec4 amigaMe (vec2 uv, vec4 colorOne, vec4 colorTwo);

    void main()
        {
        vec2 uv = vUv + (direction *(5.0*sin(time) * 0.1));
        amiga = amigaMe (uv, colorOne, colorTwo);
        gl_FragColor  = vec4(amiga.x,amiga.y,amiga.z,0.1);
        }
 
    vec4 amigaMe (vec2 uv, vec4 colorOne, vec4 colorTwo) 
       {    
       vec4 finalColor;
       float patternX = floor(uv.x*rows),
             patternY = floor(uv.y*cols);
       if(mod(patternX + patternY, 2.0) == 0.0)
            {
            finalColor = colorTwo;
            }  
        else 
            {
            finalColor = colorOne + colorTwo ;
            }
        return finalColor;
       }

Re: Write shaders for the (sim) Vegas sphere

#88
post #56

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…

Thank you for introducing me to the world eye, this will be the 5th discontinued japanese electronic doodad i've bought off ebay due to FOMO.

Re: Write shaders for the (sim) Vegas sphere

#90

Earlier quoted context omitted.

Credits: ChatGPT Please do not Anyone on HN who wants to see GPT code is able to do it themselves. Using it to get attention from other people who are expecting to see your thoughts/experience/advice is not cool, any more than answering people's questions with cut-n-pasted search engine results would be.

I'm missing the part where the OP (and the rest of us) asked you.

I've made this quest 8 or 10 times and it gets more positive than negative votes each time, so I think I'm on to something. I don't mind someone referencing chat GPT but using it create whole comments is information pollution, unless it's unusually funny.
Post reply on HN