In understanding how the rotation was implemented, it took me longer than it probably should have to realize that the normal map (which I think of in terms of lighting) is actually a radial position on the sphere.
I had to go back and forth with the final and original code a few times, and finally noted that "n" gets renamed to "point" when it becomes an argument to colorLookup.
This dual usage of the normal for lighting brightness calculation and as a radial position on the sphere surface for looking up the color makes sense in retrospect but is also a somewhat subtle aspect that you might want to address more explicitly in your text instead of just silently renaming the variable in the code.
It might also be simpler to do your rotations without a matrix, for the learners ( just expand out the functions, e.g. https://github.com/magcius/sw3dv/blob/gh-pages/b_vert.glsl#L... )
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.
Where or how did you learn GLSL?
https://duckduckgo.com/?q=opengl+orange+book
Also the quick reference card helps
Well played
Edit: I’ll take the downvotes, the author edited the thing for silly innuendo, it’s silly, I’ll have fun too and take my lashes.
Here is the only image I could find of the RenderMan Shading Language VIDI SPORTS SHADERS Makina Works sold at the time (you got no source, just bytecode understood by Pixar's implementation at the time, AFAIK):
https://web.cs.wpi.edu/~matt/courses/cs563/talks/renderman/S...
What is interesting here is that the shaders did everything on a sphere primitive. All RenderMan implementations at the time (there were more than just Pixar's) were micropolygon renderers. I.e. displacement was almost free in terms of compute overhead.
Even the football operated on a sphere that the shader deformed into the resp. shape. All patterns, stripes etc. were procedurally generated. Each shader had texture slots to apply custom logos.
https://web.archive.org/web/20130913033312/http://www.voofoo...
Also he is placing his balls in a 3D environment with nice shadows that really help to sell the illusion.
That's a good find and an interesting read. Thank you.
You have to rotate the quad to face the camera, since it has to cover the area where the ball may render (imagine the extreme case: if the quad is perpendicular to the camera, it looks like a line to the camera, you could only render the ball within that line, it wouldn't protrude to the left or right).
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.
As far as I know there shouldn't be any distortion issues. A sphere will always look like a circle from any perspective. Well that is unless it's really really big or your are really really tiny and you give the size difference you are relatively close to its surface. At that perspective it just look like a flat plane.
Furthermore, depending on the GPU and the exact workload, it can be that vertex and fragment shading can run in parallel. In that case, it is better to spread the load over both, instead of letting the fragment shaders do everything.
The same goes for texturing. Instead of calculating most of the ball's color pattern in the fragment shader, and only using texture lookups for the number itself, if you just have a texture covering the whole ball, you basically offload a lot of computation to the texture units.
That said, for a pool game where the balls are one of the most important items on the screen, it's probably worth it to get the perfect smoothness and lighting, as you mentioned.
I've found a mechanism that uses the "interleaved attribs" feature of transform feedbacks to spit out 4 verts at a time (as six to draw two GL_TRIANGLES) into a buffer that a quad-drawing shader program consumes.
Using GL_POINTS/gl_PointCoord is probably better though just for teaching children fundamentals, I just wish that it actually worked properly in practice.
There are problems with the curriculum though, one of them that it plays catch-up with the state of the world. IT in particular moves very fast. Graphics programming is not one of these things however. For example, if you've done the courses, and experiences just how hard it is to crate anything in 3d, you can better appreciate the work that goes into modern 3d engines. Look at this beautiful breakdown of the inner workings of the GTA V engine:
http://www.adriancourreges.com/blog/2015/11/02/gta-v-graphic...
Not that I can relate. I dropped out of uni well before I encountered anything that would discourage me from going into software :)
Seems like they missed a '5'.
I won, with 35 digits memorized (he gave up early; that's also around where the first '0' occurs in pi).
I don't miss any opportunities to test that I still remember them correctly, to this day. ;)
What would a Pi of 3.0 do?
https://media.ccc.de/v/mch2022-236-non-euclidean-doom-what-h...
- https://en.wikipedia.org/wiki/Indiana_Pi_Bill
- https://www.straightdope.com/21341975/did-a-state-legislatur...
The correct title is Rendering Pool Balls, not "Rendering my balls in a fragment shader".
(For anyone wondering: the submitted title was "Rendering my balls in a fragment shader" and the article title was changed from "Rendering pool balls" to that.)
I'll be referencing this in the future.
I was, let's say, really scared when tapping the link with the current title.
"Rendering my balls" says something very different to "rendering balls".
Although the hair would be impressive if you managed to do it.
(Testicles btw)
Even though the term 'balls' generally includes the sack (and hair) which neither of us accounted for.