Live data from Hacker News

Scratchapixel: Computer Graphics Programming from Scratch

scratchapixel.com

21–30 of 73 posts

Re: Scratchapixel: Computer Graphics Programming from Scratch

#21
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

I recently gave an internal tech talk at our company about just that, and my main goal was exactly that: no matrices whatsoever. Basic trig and points and lines on a canvas tag. Eventually, I switch over to OpenGL.

Video and audio quality aren't great, but you might enjoy it.

https://www.youtube.com/watch?v=v8jUNC5WdYE

Re: Scratchapixel: Computer Graphics Programming from Scratch

#22
post #13

Earlier quoted context omitted.

Sadly if you're actually implementing Bresenham's algorithm today you're doing something very wrong (or don't care about performance). Drawing lines and shapes is all a matter of pumping the desired geometry and shaders into your GPU today and letting it take care of the rasterization--running Bresenham's algorithm on your CPU will be many orders of magnitude slower.

There are still uses for software 3d rendering. Some modern game engines for example use it for lighting or culling purposes.

[deleted]

Re: Scratchapixel: Computer Graphics Programming from Scratch

#23
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

I remember doing something similar (ignoring matrix transforms and hand-calculating everything with trig because I wasn't comfortable with it). It works fine, and it's great for a theoretical understanding of how rasterization works. I like starting from the basics that way too, then building on it.

I think that most tutorials and such have a more practical focus though, with the goal of getting you to practical use of a 3D programming API (or at least skipping to the more-efficient combined transformations that matrices allow). I know that I found enough resources that covered the low-level view of things when I was teaching myself about this stuff, but I had to sift through a lot, and I ended up mostly dropping it.

Recently, I've been looking for info on doing UV mapping in software. That's pretty hard to find practical information on too.

Re: Scratchapixel: Computer Graphics Programming from Scratch

#24

Maybe I missed it, but I didn't see any discussion of the Bresenham family of algorithms. I realize this is always done for you nowadays, but if you're really teaching pixels from scratch, it seems like drawing lines and circles from raw pixels needs to be covered.

Bresenham algorithms replaced expensive (at the time) floating point computation with fast (at the time) flow control. Nowadays it's exactly opposite: float is cheap and control is expensive so they only have historical value.

Re: Scratchapixel: Computer Graphics Programming from Scratch

#25
post #5

Earlier quoted context omitted.

Fair enough.

99% of the computer graphics you see on your screen everyday are made of simple lines, circles, curves, and text in 2D. 3D is useful mostly for games, movies, and CAD software. I don't understand this over focus on 3D. I think the latest edition of "Computer Graphics: principles and practice" does not even teach bresenham anymore. This seems wrong to me.

Our current CPU-based 2D vector graphics rendering pipelines are completely unmatched to modern hardware. They’re lumbering decades-old dinosaurs with poor render quality (full of nasty visual artifacts) and ridiculously slow speed compared to the possibilities on a GPU (or even compared to better-cache-optimized CPU algorithms, frankly).

I really wish everyone would move toward something like this instead: http://w3.impa.br/~diego/projects/GanEtAl14/

Re: Scratchapixel: Computer Graphics Programming from Scratch

#26
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

What you are wanting is this book: "Tricks of the 3D Game Programming Gurus" by Andre LaMothe. The book teaches you how to write a 3D software rasterizer from first principles. The first part of the book is nothing but a well written linear algebra primer. The book then assumes you have nothing but a C++ compiler and a pointer to the frame buffer like you might get using SDL. Unfortunately the book appears to be out…

That sounds like a perfect way to satisfy my curiosity! I've been considering writing a software rasterizer for the fun of it. Thanks for the recommendation; I'll keep a look out for it too.

Re: Scratchapixel: Computer Graphics Programming from Scratch

#27
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

I tried to do that here

http://webglfundamentals.org/webgl/lessons/webgl-2d-matrices...

It expands to 3d in the following article

Re: Scratchapixel: Computer Graphics Programming from Scratch

#28
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

We learned basic vector arithmetic back in highschool doing our own gamedev stuff, and it's pretty straightforward. The use of matrices as "mapping" one space to another likewise so.

Any approach that ignores the relevant parts of linear algebra, though, is probably going to collapse under its own weight as things get more complicated--experiencing that collapse may be interesting from a learning perspective, but I suspect it is not needed.

The real problem is that the useful parts of linear algebra--for graphics anyways--may never be seen before college, and even then they may be presented in the abstract form which prevents their utility from being realized.

Really, any 3D primer should just assume no familiarity with the subject, and then teach exactly those bits which are relevant to computer graphics.

Re: Scratchapixel: Computer Graphics Programming from Scratch

#29
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

They don't assume anything here and they even provide the required learning in the intro, themselves walking through everything you wanted. http://scratchapixel.com/lessons/mathematics-physics-for-com...

Re: Scratchapixel: Computer Graphics Programming from Scratch

#30
post #6

What I don't get is why nearly all resources on 3D graphics assume the reader is familiar with matrices and linear algebra. For those who don't speak that language, what you're doing is plotting numbers into a magic box, doing a magic multiply, and hey presto, we got 3D! Magic. Meanwhile a teenager could easily get an intuitive grasp of 3D graphics if you just explained how translation is nothing besides addition, an…

I tried to do that here http://webglfundamentals.org/webgl/lessons/webgl-2d-matrices... It expands to 3d in the following article

I still have this one labelled as my all-time favorite intro to matrices.
Post reply on HN