10 ms·
Learning Modern 3D Graphics Programming (2012)
- dang 4y agoRelated: Learning Modern 3D Graphics Programming - https://news.ycombinator.com/item?id=7746192 https://news.ycombinator.com/item?id=7746192 - May 2014 (11 comments) Learning Modern 3D Graphics Programming - https://news.ycombinator.com/item?id=3294840 https://news.ycombinator.com/item?id=3294840 - Nov 2011 (51 comments) Learning Modern 3D Graphics Programming with OpenGL 3 - https://news.ycombinator.com/item?id=2528740 https://news.ycombinator.com/item?id=2528740 - May 2011 (16 comments)
- synergy20 4y agoall dead links? The one from 2012 seems great, in the meantime it is 10 years old, is there newer version on the same topic somewhere else?
- tmpburning 4y ago[flagged]
- dang 4y agoThose 'related' lists are mostly so people can look at the old comment threads, which are not dead, and hopefully won't be for a long time. archive.org has copies of most URLs that have been submitted to HN over the years, and one of these days (years) we should try to take advantage of that more formally. In the meantime you have to look them up manually or write code to do that.
- gfxgirl 4y agoGiven that OpenGL is basically deprecated at this point this arguably is no longer "modern 3D graphics programming" If you still want to learn OpenGL there's https://learnopengl.com https://learnopengl.com
- pjmlp 4y agoKind of, GL 4.6 is still much easier to deal with than Vulkan. Also it took a decade for good enough WebGL support, and WebGPU is yet a year away to make its 1.0 release on Chrome, let alone other browsers.
- dinkumthinkum 4y agoStill much easier? They is a truly massive understatement.
- synergy20 4y agoThis is also like 10 years old. OpenGL did not die easily, the new replacements are at wars and I have yet to see an universal API/library replaces OpenGL.
- pjmlp 4y agoOpenGL was never universal on game consoles, despite urban myths of support.
- luxuryballs 4y agoSo wait MonoGame 2D cross platform… isn’t that using OpenGL?
- pjmlp 4y agoAlongside DirectX, and LibGNMX.
- bmitc 4y agoIs OpenGL really deprecated? I know Apple wants to kill it, but isn’t there a ton of software that is written on top of OpenGL?
- soup10 4y ago
- pjmlp 4y agoNot so modern after a decade. For OpenGL, there is DSA and SPIR-V support. And then there is Metal, Vulkan and DX 12, alongside NVN and LibGNM/GNMX.
- synergy20 4y agoEvery big players are running their own 3D graphic APIs these days, wish they all agreed on something like Vulkan.
- pjmlp 4y agoKhronos keeps not having an idea how to make APIs not full of extensions and low level SDK tooling. Big players have always used their own 3D APIs since the dawn of 3D graphics.
- psychphysic 4y agoI don't think it's entirely khronos support as basically each vendor what's to embrace, extend and extinguish it constantly. CUDA is kind of winning it for nvidea.
- pjmlp 4y agoSure it is, not even LunarG's SDK is at the same level as proprietary API SDKs in frameworks, debugging, IDE integration, beyond the basics. CUDA is winning on compute exactly because of that as well.
- dinkumthinkum 4y agoYou think the big players don’t (didn’t) use OpenGL, Vulkan, DX, etc?
- pjmlp 4y agoSony definitely not, Nintendo to some extent after GX, Apple only after adopting NeXTSTEP (QuickDraw 3D was their thing), Microsoft alongside NVidia and AMD design first for DX, then the features get ported into GL/Vulkan as extensions,...
- andsoitis 4y agoThe most popular modern graphics (GPU) APIs are DirectX 12 (Microsoft), Metal (Apple), and Vulkan (Khronos Group). Targeting all three can be tough, hence WebGPU which lets you write to a single API. Support on non-web runtimes have been appearing as well, so you're not necessarily limited to the browser (e.g. https://github.com/samdauwe/webgpu-native-examples https://github.com/samdauwe/webgpu-native-examples). Good read: https://surma.dev/things/webgpu/ https://surma.dev/things/webgpu/ Tutorial for learning Vulkan: https://www.vulkan.org/learn#vulkan-tutorials https://www.vulkan.org/learn#vulkan-tutorials
- vegabook 4y agoworth mentioning that Vulkan is the only API that runs on all three major platforms. Natively on Windows and Linux, via MoltenVK on MacOS.
- pjmlp 4y agoMiddleware runs on more platforms, with more friendly tooling.
- slimsag 4y agoVulkan has a lot going for it these days, but IMO the problem with its future is that (a) it's too verbose to use without an abstraction on top and (b) vendors won't stop pushing their native APIs as a competitive advantage (Microsoft still pushing DirectX - often getting features a year or two ahead of Vulkan, Apple is pushing Metal, GNM[X] from Sony, etc.) I think this means the future of graphics APIs is software abstractions around the truly native APIs (DirectX, Metal, etc.) - things like WebGPU, sokol_gfx, SDL's new GPU abstraction, and Sebastian Aaltonen's stuff.
- cshenton 4y agoI know you mean major desktop platforms, but in terms of market share for real time 3D applications, mobile and console dwarf Mac and Linux.
- tmtvl 4y ago
- keepquestioning 4y agoOutdated. Learn VULKAN
- synergy20 4y agoare all big players supporting it? is there a good document. while this is all about graphics, I wonder how GPGPU will end up in the future. OpenCL did not get much love, CUDA still rules the market(leaves Intel's OneAPI and AMD's ROCm and the legendary OpenMP etc in the dust). Apple's Metal does both graphics and GPGPU, Vulkan is also said to do both graphics and GPGPU, not sure about Microsoft's, does it even have a GPGPU API considering it is the only player without its own hardware.
- psychphysic 4y agoWhat really killed them (as in not CUDA) is no easy way to use them. OpenCl pretty much broken on mesa so really amd is no better than Nvidia on Linux. And Nvidia killing it with CUDA where it works.
- raphlinus 4y agoDirectX12 has ok compute capabilities, but is increasingly being left in the dust by Vulkan. It doesn't have pointers or a memory model, but it does have device scoped barriers (which Metal lacks), so you can do things like single-pass prefix sum (monoid scan) operations, which Metal and WebGPU can't. Also, the Nvidia "cooperative matrix" operations (which access the "tensor cores") exist in CUDA and Vulkan but not DirectX12. Programming GPU compute outside CUDA is still quite painful; the developer experience of tools is terrible and the ecosystem has a lot of catching up to do. I'm most bullish on WebGPU going forward, but there are definite growing pains.
- dagmx 4y agoCould you elaborate on how device scoped barriers are benefficial? I’m not sure I follow where that would help for your example, but I’m definitely curious (and Google searches have become increasingly useless of late)
- overgard 4y agohttps://vkguide.dev/ https://vkguide.dev/ Might be a better alternative for 2022
- hactually 4y agoI'd recommend taking a look at either https://vkguide.dev https://vkguide.dev or my preferred https://vulkan-tutorial.com/ https://vulkan-tutorial.com/ I remember learning "modern" OpenGL back in 2005
- bobharris 4y agoThankYou. Are these the learnopengl.com of vulkan?
- dinkumthinkum 4y agoDid you have a time machine? OpenGL 3.3 came out in 2010.
- edflsafoiewq 4y agoOpenGL 2.0 came out in 2004 with a pipeline that still looks quite modern, using buffers and shader programs with GLSL, as opposed to 1.0-style immediate mode rendering. Both 3.0 and 4.0 were comparatively quite minor updates.
- aappleby 4y agoOld graphics dev here who has mentored new hires in basic rendering tech. Learn JavaScript+WebGL to the point where you can render simple models with textures, shaders, and a basic camera controller. Then, if you enjoy it and want to go further, do the same but in your favorite language + Vulkan.
- aappleby 4y ago(Or WebGPU, I keep forgetting that one exists...)
- pjmlp 4y agoNo wonder, they are years away of doing 1.0 MVP.
- bialpio 4y agoIf all goes well, looks like it'll be shipping enabled by default in Chrome M113 (scheduled to go out at the beginning of May). https://groups.google.com/a/chromium.org/g/blink-dev/c/VomzPhvJCxI/m/SUhU9Z0vAgAJ https://groups.google.com/a/chromium.org/g/blink-dev/c/VomzP...
- pjmlp 4y agoIt is serious this time? It was going to be early Summer 2022.
- bobharris 4y agoInspiring. Thanks. I noticed you said WebGL. Is threeJS too high level?
- _the_inflator 4y agoI agree. You can start with https://threejs.org/ https://threejs.org/ to get things rolling.
- 4y ago
- bmitc 4y agoIf you were designing a new application from scratch, meant to be cross-platform on Windows, macOS, and Linux, what 2D graphics library would you use? I have been operating under the assumption that Skia is that library but would like to hear thoughts. What about 3D? This is all assuming one wants something packaged and does not want to write OpenGL or Vulkan code.
- pak9rabid 4y agoMaybe check out QT?
- 0xfeba 4y agoLibGDX - https://libgdx.com/ https://libgdx.com/ I used that a few years ago -- not sure how it's held up.
- gilmore606 4y agoI just started another libGDX project a few months ago (2D only), in Kotlin; it still works as well as it ever did. Have had no issues running on Win/Mac/Linux. Could not find any reason not to use openGL. I have a feeling GLSL shaders will never die and I'll be writing them when I'm 80.
- cshenton 4y agoFor 3D, use a game engine. Unity, Unreal, maybe Godot depending on your perf requirements.
- bmitc 4y agoThanks. That seems to be the case. My project is currently on top of .NET, so Godot and Stride have been the two I've looked at, although Stride is the only one supporting .NET Core (i.e., .NET 5+). Godot and Unity require Mono still.
- hutzlibu 4y ago"meant to be cross-platform on Windows, macOS, and Linux, what 2D graphics library would you use? " It really depends what you want to do, but in general I would say: the HTML Canvas and the web in general. WebGL for 3D, or rather a framework like threejs or babylonjs. Doing it not on the web, but still cross-platform makes only sense, if you need the maximum performance, or if you already have a working toolchain you are familiar with. But since you don't want to write OpenGL or Vulkan code and you are not familiar with it - I think you are up for great adventures by diving into Skia and co. There is a reason the web became sort of standard for cross platform despite its numerous flaws - the alternative is likely more pain. But maybe not, depending on your skill set. But since you did not mention Qt, I would assume you are new in the area in general? Then I really recommend the web.
- attheicearcade 4y agoFor anyone wishing to get a taste of very modern graphics programming with Vulkan, I enjoyed Arseny Kapoulkine’s YouTube series [0]. Although he focuses somewhat on mesh shading, he does also build a more traditional pipeline alongside it. I found it much nicer to follow along with this than grind through the first X hours via written tutorials. [0] https://youtube.com/playlist?list=PL0JVLUVCkk-l7CWCn3-cdftR0oajugYvd https://youtube.com/playlist?list=PL0JVLUVCkk-l7CWCn3-cdftR0...
- sacnoradhq 4y agoI suggest learning and doing the hard way(tm) without acceleration from very primitive rendering techniques moving from basic to advanced, and old to new, gradually Step -1. Math - Learn about quaternions, frustums, camera matrix, and transformation matrixes. Step 0. Pixels - Draw pixels / scan lines to a window or display Step 1. "Triangles" - Draw scan-line aligned trapezoids with a W-/Z-buffer painter's algorithm (back to front). Multiple or single trapezoids in 2D are the results of projected triangles in 3D. Step 2. Constructive Solid Geometry - Generate triangles given additive and/or subtractive shapes - Cube minus sphere intersecting Step 3. Lighting and shading - The old school Phong and Gouraud materials and lighting Step 4. Texture mapping - The math to map a raster image onto triangles Step 5. Simple MIP mapping - The math to map various resolutions of raster images onto triangles Step 6. Isotropic (bilinear and trilinear) filtering Step 7. Anisotropic filtering Step 8. Bump mapping - Perturb the normals Step 9. Oversampling (FSAA) - Render on an N-times bigger virtual canvas, apply a kernel reduction matrix (possibly mean average), and copy to the real display area Step 10. Clipping and culling - Octrees, quadtrees, AABBtree, BVH, BSP, and k-d trees Step 11. Get fancy with animation
- jalino23 4y agothank you so much for this! this is invaluable
- dmarcos 4y agoI agree. Any materials you recommend to guide people in each of the steps? Maybe a software 3D renderer that is well written and documented?
- slmjkdbtl 4y agohttps://github.com/ssloy/tinyrenderer/wiki/Lesson-0:-getting-started https://github.com/ssloy/tinyrenderer/wiki/Lesson-0:-getting...
- sacnoradhq 4y agoCool. Here's a list of more resources: https://web.archive.org/web/20170705193028/http://graphics.cs.ucdavis.edu:80/~joy/ecs175/Lectures/Lectures.html https://web.archive.org/web/20170705193028/http://graphics.c... v-- Vector, matrix, point, color, material, and lighting classes for C++9x, easy to port to C++11 onwards --v https://web.archive.org/web/20150305000047/http://graphics.idav.ucdavis.edu/education/CppNotes/homepage.html https://web.archive.org/web/20150305000047/http://graphics.i...
- moth-fuzz 4y agoI’ve begun to learn Vulkan recently, and honestly, the API is not the best. But I feel like it’s the best long-term option - it’s really more about the mental model: buffers, pipelines, commands and queues, all exist in one way or another in Vulkan, Metal, and DX12. OpenGL is the odd one out as it’s a global state machine. That said, you can build a vulkan-like abstraction atop of OpenGL (I’ve tried). The problem however, is compatibility. We’re in a very weird transitional era for graphics. Things aren’t unified anymore. Modern OpenGL features that aren’t difficult to implement are held back by drivers since most of that work is done by drivers in the first place. It’s not like the GPU can or can’t do these things, it’s that the vendors don’t expose that functionality. Vulkan is not available on my ivy bridge thinkpad (unless I run Linux and an open source driver). OpenGL greater than 4.1 is not available on MacOS because apple writes the drivers and they chose to stop writing them. Vulkan is not available natively on MacOS, except, with MoltenVK you can enable it, since at the end of the chain a GPU is just a GPU and it doesn’t care what API you use. Microsoft, in their commitment to legacy compatibility, allows DX12 to run on any windows machine made in the last decade, the catch is it’s windows only. So all the options have their ups and downs and pitfalls whereas it felt like 10 years ago OpenGL was ‘the’ answer. Honestly, the state of graphics programming is a mess. To be compatible, you have to stick to some narrow versions of OpenGL that are uncomfortable and outdated, because computers or drivers are either too old or too new or both, or you have to write individual abstractions for every platform you target. I hate the state of it but I get why indie devs are all just using Unity now. When I was growing up it was SDL2+OpenGL, and then it was XNA, but it seems coding at all is too much now. And I don’t really blame them, the problem domain has expanded significantly and the knowledge required has expanded along with it. Libraries can’t just be libraries to solve one task, they have to be frameworks or engines or entire graphical editors because all this is just too much for one person to figure out anymore. I just wanna write some code that draws some shapes, man.
- kaveh808 4y agoWe do seem to be in an odd transitionary period as you say. I got basic 3D graphics for my Common Lisp system up and running rather quickly using early OpenGL calls which I was familiar with. I first used GL from SGI in the mid-80's. We are now looking to move to Vulkan across all three desktop platforms, and it's a major undertaking. Installation and dependencies especially are a concern of mine. Our system is open source, and having painless onboarding is important to me.
- deleted 4y ago[deleted]
- deleted 4y ago[deleted]
- legends2k 4y agoHere's my curated list of CG resources for self-study: https://legends2k.github.io/note/cg_resources/ https://legends2k.github.io/note/cg_resources/ After learning Vulkan, OpenGL or the next shiny API: it doesn't matter. Computer graphics and 3D math concepts don't change across APIs. The concepts you learn and make GPU do things is the same. Just the language or dialect differs. I started with OpenGL, but I now program in D3D, WebGL, etc. Learn the basics, avoid the religious wars. In fact when learning something not as complex as Vulkan will help, since lots of noise (boilerplate) to hide the signal (cg concepts). Cheers!
- 3tigerooozan3 4y agoThis vector tutorial really helped me: https://chortle.ccsu.edu/VectorLessons/index.html https://chortle.ccsu.edu/VectorLessons/index.html
- FarhadG 4y ago(Shameless Plug) If you're interested in learning about 2/3D graphics and then applying it to build a 3D graphics engine—similar to something like THREE—check out my book: https://www.amazon.com/Real-Time-Graphics-WebGL-interactive-applications/dp/1788629698 https://www.amazon.com/Real-Time-Graphics-WebGL-interactive-...
- deleted 4y ago[deleted]