Even after 10 years I still have anxiety looking at OpenGL code. I still don't understand why we needed to write ray-tracing during a BSc course starting from a blinking cursor. The professor tried to defend that at the time, but I firmly believe that it is the wrong curriculum for a 20 year old CS student. Computer graphics were and are niche programming, and should not be taught main-stream. Out of 100 graduates ma…
Rendering my (billiard) balls in a fragment shader
71–80 of 88 posts
Re: Rendering my (billiard) balls in a fragment shader
#72I happened to notice that PI is #define'd to 3.1415926538, which isn't the correctly rounded off value of 3.14159265358... Seems like they missed a '5'.
Interesting point if it had been apparent it would have been an issue, at what point does a poor Pi become an issue? What would a Pi of 3.0 do?
Re: Rendering my (billiard) balls in a fragment shader
#73Even after 10 years I still have anxiety looking at OpenGL code. I still don't understand why we needed to write ray-tracing during a BSc course starting from a blinking cursor. The professor tried to defend that at the time, but I firmly believe that it is the wrong curriculum for a 20 year old CS student. Computer graphics were and are niche programming, and should not be taught main-stream. Out of 100 graduates ma…
Not that I can relate. I dropped out of uni well before I encountered anything that would discourage me from going into software :)
Re: Rendering my (billiard) balls in a fragment shader
#74Even after 10 years I still have anxiety looking at OpenGL code. I still don't understand why we needed to write ray-tracing during a BSc course starting from a blinking cursor. The professor tried to defend that at the time, but I firmly believe that it is the wrong curriculum for a 20 year old CS student. Computer graphics were and are niche programming, and should not be taught main-stream. Out of 100 graduates ma…
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...
Re: Rendering my (billiard) balls in a fragment shader
#75Earlier quoted context omitted.
Fixed.
Not to pee on your party, but I wouldn't want to the users who click on that title expecting...something else, to be disappointed. Therefore I have made the minimum viable edit. (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.)
Re: Rendering my (billiard) balls in a fragment shader
#76Very nice! not sure if you've heard of [1] ShaderToy, but it's pretty good for sharing/viewing shaders online. [1] https://www.shadertoy.com/
Re: Rendering my (billiard) balls in a fragment shader
#77Re: Rendering my (billiard) balls in a fragment shader
#78Here 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.
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... )
Re: Rendering my (billiard) balls in a fragment shader
#79I'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…
Re: Rendering my (billiard) balls in a fragment shader
#80Good timing - I was procrastinating on HN instead of trying to fix my phucked-up phong; you've helped me do both.