[HN Gopher] Ask HN: How to self-learn graphics programming?
___________________________________________________________________
Ask HN: How to self-learn graphics programming?
My background: 1st year CS student with knowledge in Python, C and
some Rust. I have been wanting to learn graphics programming for a
while, so I picked up Computer Graphics from Scratch [0] today, but
found the math confusing. Can you recommend me some primer books on
graphics programming which do not assume much mathematical
background? What are some concepts which are absolutely necessary
to know? Can you point me to some resources which might be helpful?
Thanks! [0] https://www.gabrielgambetta.com/computer-graphics-
from-scratch/
Author : Flex247A
Score : 30 points
Date : 2021-02-16 18:02 UTC (5 hours ago)
| flipcoder wrote:
| As far as the math is concerned, 3D Math Primer is the book I
| always recommend starting with:
|
| https://www.amazon.com/Math-Primer-Graphics-Game-Development...
| pcestrada wrote:
| This is an excellent book, and real breaks down the math into
| bite-sized chunks that can be easily consumed.
| superbcarrot wrote:
| > Can you recommend me some primer books on graphics programming
| which do not assume much mathematical background?
|
| Why not get the math background first? You're at university, now
| is the best time to take some math classes.
| hgs3 wrote:
| You might like this video series [0] which explains how to write
| a simple 3D software renderer with only basic algebra and
| trigonometry.
|
| [0] https://www.youtube.com/watch?v=Y_vvC2G7vRo&list=PLEETnX-
| uPt...
| max_ wrote:
| Been wanting to get sometime & finally publish a graphics project
| too.
|
| I think in 2021 if your looking to get in to graphics, your
| expected to at least know some ray tracing.
|
| There is this ray tracing series I would recommend [0]
|
| [0]: https://raytracing.github.io/
| zffr wrote:
| Linear algebra is really important for graphics programming, but
| there's really only a handful of concepts you need to get started
| (vectors, matrix operations (rotation, translation, scale)). This
| course is relatively short and should give you a good background
| on these topics:
| https://www.youtube.com/playlist?list=PLZHQObOWTQDPD3MizzM2x... .
| For me, I learned more from the course than my college level
| linear algebra class.
|
| Other important things to learn are what Vector and Fragment
| shaders are. I think this course is a good intro for it:
| https://github.com/ssloy/tinyrenderer
|
| Lastly, when you are ready to start writing real graphics code,
| you might want to consider using something like Metal if you are
| on macOS. I have found it to have a much better API than OpenGL.
| Here's a good book on the topic:
| https://gumroad.com/l/metalbyexample . I haven't used DirectX,
| but I imagine its probably much better than OpenGL too.
|
| If you do want to use OpenGL, I found these to be good resources:
| https://open.gl and http://learnopengl.com/
| Flex247A wrote:
| Thanks!
| threatofrain wrote:
| IMO 3B1B's course for linear algebra is not good for Learning
| linear algebra, but it is great for Augmenting your geometric
| intuition. I don't believe his course ever claims any
| different.
|
| I'd recommend instead Gilbert Strang, who teaches a full and
| well reputed course over at MIT.
|
| https://www.youtube.com/watch?v=Cx5Z-OslNWE&list=PLUl4u3cNGP...
| 100-xyz wrote:
| I was in a similar journey while working on my startup
| ToonClip.com which deals heavily with graphics.
|
| There are 2 different areas. One is the geometry and the math.
| Second is the libraries that make the graphics.
|
| What was fun for me, was thinking of an idea eg. make a circle
| move along a given path. Then evaluating the different libraries
| to see how to achieve it. Then, when the libraries themselves
| needed modification, jump into the mathematics, geometry and
| algebra. I did not read books but just looked up articles and
| videos that cover the topics of interest.
|
| Its a lot of fun that combines math, art and programming.
|
| Wish you lotsa success and fun :-)
| Flex247A wrote:
| Thanks!
| neonological wrote:
| Wait a bit until your done with mechanics in physics and you've
| finished Calculus and Linear Algebra. Then you will have the
| necessary foundational background required to pick up the math
| from just reading that cg book.
|
| Don't worry about "getting the math background" these courses
| should be required at any university for any engineering major,
| so you'll be getting the necessary math regardless of your
| interest.
| tkinom wrote:
| It is ok to interleave programming with Math class.
|
| By play some Unity Game tutorial along with Geometry, Trig
| classes, you will likely see math come alive in front of your
| eyes.
|
| You will want to know more on how and why.
| ear7h wrote:
| As others have mentioned, having some formal math knowledge is
| good, in particular linear algebra and multivariable calculus
| (usually calc 3). Though that's not very practical...
|
| I find that the hardest part of graphics programming is
| understanding all the boilerplate, setting up GPUs, buffers, etc.
| So I'd recommend skipping this part as you're learning since it's
| hardly rewarding. If you just want to draw pixels on a screen
| there's a few libs that do the heavy lifting and give a frame
| buffer to write to:
|
| https://crates.io/crates/pixels https://crates.io/crates/minifb
|
| Writing to a pixel buffer is the most low level way to do
| graphics programming, but it can also be the slowest in
| comparison to sophisticated libraries or using a GPU. I'd
| recommend doing some sort of experiment on a frame buffer to get
| familiar with it since it never goes away, just abstracted.
|
| The next step up in complexity would be using a 2d or 3d
| rendering library. These provide primatives like circles or
| spheres that you can put together to make a larger scene. Here's
| some I've used:
|
| http://raylib.com/ https://crates.io/crates/tiny-skia
|
| You can put things together pretty easily with these libs. And
| they also let you skip the gpu boilerplate (I should note that
| tiny-skia works only in the CPU).
|
| Lastly, you have shader programming (OpenGL, Vulkan, etc.). If
| you're writing "production code" you'll have to do some setting
| up of the GPU, and the actual graphics code will be in a separate
| shader language. Shader languages are similar to C but with
| restrictions that allow for a high level of parallism, making it
| extremely fast. If you want to get started with this I'd
| recommend playing around on a site like shadertoy[1] where you
| can start writing shaders right away. I haven't done much of this
| myself but as far as Rust goes I've seen a lot of references to
| the gfx crate:
|
| https://crates.io/crates/gfx
|
| I hope this helps
|
| [1] https://www.shadertoy.com/
| bogwog wrote:
| The math is the main hurdle for this kind of thing for most
| people, but luckily it's not _that_ hard. You don 't need to be a
| mathematician, and can survive with a working knowledge of it.
| Also, the math you use in graphics programming is what you need
| to know anyways for most other game programming.
|
| Ray tracing is a good way to start IMO, because it's easier to
| understand than rasterization, it's easy to write your own simple
| ray tracer, and it relies almost entirely on the math. So I
| definitely recommend finding some tutorials for that.
|
| Peter Shirley's "ray tracing in one weekend" book is a popular
| one.
|
| You could also look into doing ray marching instead of ray
| tracing, which is slightly more complicated, but fundamentally
| the same, you can actually see them in realtime on most hardware,
| even on mobile (examples: https://www.shadertoy.com/)
| jonsen wrote:
| I see you love computers. Falling in love with computer graphics
| implies loving some math too.
| Flex247A wrote:
| This made me smile :)
| giomasce wrote:
| After all, computer science is basically a branch of
| mathematics.
| theandrewbailey wrote:
| I was sort of at the same place at one time. I found a
| presentation years ago that would have helped, so here you go:
|
| Steven Wittens: Making WebGL Dance
| https://www.youtube.com/watch?v=GNO_CYUjMK8
|
| It doesn't actually get into the math until about 12 minutes in,
| but it might be illuminating. Matrixes, vectors, and how they are
| multiplied with each other are the fundamental magic of 3D
| graphics.
| kilojool wrote:
| It's possible you'd benefit from the GameDev.tv course on Math
| for Video Games. Available on Humblebundle at the EUR1 tier for
| 24 more hours. ;) https://www.humblebundle.com/software/learn-
| unity-game-devel...
| atoav wrote:
| For a very low level entry (in the sense of maybe you never even
| programmed before) I'd totally recommend going through nature of
| code [1] and also playing around with the processing.org
| examples.
|
| Once that reaches it's limits I'd go to something closer to the
| metal. A lot of the lessons/intuitions learned will be useful
| here as well.
|
| [1]: https://natureofcode.com/
| sxp wrote:
| You can start from the bottom up or the top down. You will need a
| good math background for bottom up work, but you could also try
| learning graphics by starting from a high level framework and
| getting lower in the stack.
|
| E.g, learn an open source 3D framework like three.js and build
| stuff with it. Once you get good building 3D scenes and apps,
| learn how to extend three.js with custom functionality. Then
| learn the low level WebGL APIs the three.js is built on top of
| and implement your own graphics framework. Since three.js is open
| source, you can learn quite a bit by just examining the code.
|
| You could also do something similar with the Godot Engine or any
| other open source 2D/3D framework.
___________________________________________________________________
(page generated 2021-02-16 23:02 UTC)