Live data from Hacker News

Rendering my (billiard) balls in a fragment shader

getlazarus.org

81–88 of 88 posts

Re: Rendering my (billiard) balls in a fragment shader

#82
post #27
post #22

Earlier quoted context omitted.

Cool, I recently started with GLSL, and it’s interesting there are many roads that lead to a similar solution (how I draw circles or make a center is tad different) Where or how did you learn GLSL?

I was around and writing OpenGL when we started getting the first programmable cards. Nvidia shot out first with their Cg language, but I held back and waited for the "Orange Book" to come up. I bought it right away and learned from it and by looking at other peoples shaders. https://duckduckgo.com/?q=opengl+orange+book Also the quick reference card helps https://duckduckgo.com/?q=glsl+quick+reference&t=h_&ia=web

Small correction, NVidia Cg was only the first on PC.

We had Renderman on NeXT, TI TMS34010, and a couple of other attempts outside the PC world.

Re: Rendering my (billiard) balls in a fragment shader

#86
post #2

Here is a summary I wrote on my attempt to render balls using only a fragment shader. I am pretty happy with the result, and I've included a breakdown of the creation process.

Great article! I would be interested in more info about the physics and ball path mapping that you mentioned in the beginning.

Over the last few months, I’ve started competing in billiards, and the roll vs slide, english, tangent lines, and even forced follow to be incredibly interesting.

Is any of that involved in the physics simulations that you’ve worked out? If it is, I would really like to know more.

Re: Rendering my (billiard) balls in a fragment shader

#87
post #37

Fyi. "Rendering my balls" says something very different to "rendering balls". Although the hair would be impressive if you managed to do it. (Testicles btw)

(Testes btw)

I like how you can confidently correct me over the hyper precise term 'balls'.

Even though the term 'balls' generally includes the sack (and hair) which neither of us accounted for.

Re: Rendering my (billiard) balls in a fragment shader

#88
post #50
post #30

I'm just getting my feet wet with shaders myself. Could this fragment shader be used in a "real" 3D game? At the moment, the sphere is orthographicly projected onto the screen so the sphere will always appear as a circle rather than an ellipse. How easy would it be to use this shader in place of a spherical mesh as you might find in a typical geometry based 3D render? I.e. could you use the same technique and render…

I'm also new to shaders, so I might be wrong: Camera distortion (/perspective) is done in the vertex shader, this post here presents a fragment shader. So if you take a quad, in the vertex shader then rotate it so it'll face the camera (i.e. all vertices have same z/depth value in clip space), you can then probably use this fragment shader to render the ball. You have to rotate the quad to face the camera, since it h…

> You have to rotate the quad to face the camera

Or you only run the center point through the camera transform, and then render the quad in screen space. Should be cheaper in terms of compute.

Post reply on HN