Live data from Hacker News

Write shaders for the (sim) Vegas sphere

whenistheweekend.com

51–60 of 91 posts

Re: Write shaders for the (sim) Vegas sphere

#52
post #27

Offtopic but what fascinates me is how big of an actual engineering project The Sphere is. From the structure itself to the syncing thousands of LED panels inside the sphere and outside the sphere, while keeping them cooled in Vegas while keeping it cool enough and ventilated inside for a seating capacity of 18 000 people. There are run-of-the mill office buildings which fail to provide adequate ventilation.

All that effort, all those resources, just to get more eyeballs on ads.

Cmon it’s more than that.

It’s true innovation.

Re: Write shaders for the (sim) Vegas sphere

#53

Here'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.

A cone has the same curvature as the plane.

Re: Write shaders for the (sim) Vegas sphere

#54

[flagged]

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.

Re: Write shaders for the (sim) Vegas sphere

#55
Got the matrix working.

I tried adjusting the UV so we could see the top of the sphere, but I gave up. For what it's worth, the threejs uniforms "projectionMatrix" and "modelViewMatrix" can be referenced in the GLSL as long as you declare them up top.

  #define PI 3.14159265359
  #define SQRT_2 1.4142135623730951
  #define SQRT_5 2.23606797749979
  
  //uniform mat4 projectionMatrix, modelViewMatrix;
  uniform float time;
  varying vec2 vUv;
  varying vec3 vNormal;
  
  highp float randomFloat( const in vec2 uv ) {
    const highp float a = 12.9898, b = 78.233, c = 43758.5453;
    highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
    return fract(sin(sn) * c);
  }
  
  float wobble(float x) {
    return x + 0.3 * sin(SQRT_2 * x) + 0.2 * sin(SQRT_5 * x);
  }
  
  float getRainBrightness(float simTime, vec2 glyphPos) {
    float columnTimeOffset = randomFloat(vec2(glyphPos.x, 0.)) * 1000.;
    float columnSpeedOffset = randomFloat(vec2(glyphPos.x + 0.1, 0.)) * 0.5 + 0.5;
    float columnTime = columnTimeOffset + simTime * columnSpeedOffset;
    float rainTime = (glyphPos.y * 0.01 + columnTime) * 350.0;
    
    rainTime = wobble(rainTime);
    
    return 1.0 - fract(rainTime);
  }
  
  void main(){
  
    float t = fract(time / 14.487);
    vec2 animatedUv = fract(vUv + vec2(t * 0.002, 0));
  
    vec2 gridSize = vec2(3.14 / 2.0, 1.0) * 100.0;
  
    vec2 glyphUv = fract(animatedUv * gridSize);
    vec2 gridCoord = floor(animatedUv * gridSize) / gridSize;
  
    float brightness = getRainBrightness(t * 0.1, gridCoord);
  
    brightness = clamp(0.0, 1.0, brightness * 1.6 - 1.2);
  
    float coverage = 1.3 - length(glyphUv - 0.5) * 3.0;
  
    gl_FragColor = vec4(brightness * coverage * vec3(0.2, 1.0, 0.05), 1);
  
  }

Re: Write shaders for the (sim) Vegas sphere

#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(reflected, eyeDirection), 0.0), 16.0);
    return vec3(0.1) + diffuse * vec3(0.5) + specular * vec3(0.3);
    }
    void main() {
    float theta = vUv.x * 2.0 * 3.14159265359;
    float phi = (1.0 - vUv.y) * 3.14159265359;
    vec3 sphereCoord = vec3(sin(phi) * cos(theta), cos(phi), sin(phi) * sin(theta));
    vec2 irisPosition = vec2(sin(time * 0.5) * 0.1, cos(time * 0.7) * 0.1);
    float irisDistance = length(sphereCoord.xy - irisPosition);
    float irisRadius = 0.25;
    float pupilRadius = 0.1;
    float irisEdgeSoftness = 0.02;
    vec3 color;
    if (irisDistance 

Re: Write shaders for the (sim) Vegas sphere

#58

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.

A cone has the same curvature as the plane.

Not for any definition of curvature that springs to mind. There may well be definitions for which that's true (let me know, I'm curious!), but they're not what I meant. As I said, I was considering covering a cone with physical tiles. My point was that the same tile cannot be placed at different heights along the cone, because a slice along the tile will have to conform to ever larger circles.

Re: Write shaders for the (sim) Vegas sphere

#59

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#…

Yeah if you’re making an orgy with shaders they should just let it stay up out of pure respect.

Also warning for the future reader: the link in the parent comment is NSFW.

Re: Write shaders for the (sim) Vegas sphere

#60

Earlier quoted context omitted.

A cone has the same curvature as the plane.

Not for any definition of curvature that springs to mind. There may well be definitions for which that's true (let me know, I'm curious!), but they're not what I meant. As I said, I was considering covering a cone with physical tiles. My point was that the same tile cannot be placed at different heights along the cone, because a slice along the tile will have to conform to ever larger circles.

The Gaussian curvature is the same. That is the curvature that can be measured "from within" the surface.

What you wrote is of course right as well

Post reply on HN