4 ms·
Implementing a tiny CPU rasterizer (2024)
- delta_p_delta_x 10mo agoThis is a great resource. Some others along the same lines: TinyRenderer: https://haqr.eu/tinyrenderer/ https://haqr.eu/tinyrenderer/ ScratchAPixel: https://www.scratchapixel.com/index.html https://www.scratchapixel.com/index.html 3D Computer Graphics Programming by Pikuma (paid): https://pikuma.com/courses/learn-3d-computer-graphics-programming https://pikuma.com/courses/learn-3d-computer-graphics-progra... Ray-tracing: Ray Tracing in One Weekend: https://raytracing.github.io/ https://raytracing.github.io/ Ray Tracing Gems: https://www.realtimerendering.com/raytracinggems/ https://www.realtimerendering.com/raytracinggems/ Physically Based Rendering, 4th Edition: https://pbr-book.org/ https://pbr-book.org/ Both: Computer Graphics from Scratch: https://gabrielgambetta.com/computer-graphics-from-scratch/ https://gabrielgambetta.com/computer-graphics-from-scratch/ I'll also link a comment[1] I made a while back about learning 3D graphics. There's no better teacher than manually implementing the rasterisation and ray-tracing pipelines. [1]: https://news.ycombinator.com/item?id=46410210#46416135 https://news.ycombinator.com/item?id=46410210#46416135
- ggambetta 10mo agoMay I add Computer Graphics From Scratch, which covers both rasterization and raytracing? https://gabrielgambetta.com/computer-graphics-from-scratch/index.html https://gabrielgambetta.com/computer-graphics-from-scratch/i... I have to admit I'm quite surprised by how eerily similar this website feels to my book. The chapter structure, the sequencing of the concepts, the examples and diagrams, even the "why" section (mine https://gabrielgambetta.com/computer-graphics-from-scratch/00-introduction.html#why-read-this https://gabrielgambetta.com/computer-graphics-from-scratch/0... - theirs https://lisyarus.github.io/blog/posts/implementing-a-tiny-cpu-rasterizer-part-1.html#section-but-why https://lisyarus.github.io/blog/posts/implementing-a-tiny-cp...) I don't know what to make of this. Maybe there's nothing to it. But I feel uneasy :(
- delta_p_delta_x 10mo agoAh yes, great book; thanks for pointing it out. Added to the list. As for similarity, I think the sections you've highlighted are broadly similar, but I can't detect any phrase-for-phrase copy-pasting that is typical of LLM or thesaurus find-replace. I feel that the topic layout and the motivations for any tutorial or course covering the same subject matter will eventually converge to the same broad ideas. The website's sequence of steps is also a bit different compared to your book's. And most telling, the code, diagrams, and maths in the website are all different (such assets are usually an instant giveaway of plagiarism). You've got pseudocode; the website uses the C++ standard library to a great extent. If it were me, I might rest a little easier :)
- lisyarus 10mo agoHi! Blog post author here. I have heard the "Computer Graphics from Scratch" book before, but I haven't read it myself, so it would be quite hard for me to plagiarize it. I guess some similarities are expected when talking about a well-established topic.
- globalnode 10mo agoits a standard pipeline, everything from everyone will look roughly similar. your book likely looks something like previous work. i wouldnt worry about it, ps i really loved your web tutorials back in the day
- gopla 10mo agoAn additional resource on rasterisation, using the scan conversion technique: https://kristoffer-dyrkorn.github.io/scanline-rasterizer/ https://kristoffer-dyrkorn.github.io/scanline-rasterizer/
- Levitating 10mo agoI can vouch for scratchapixel, it taught me the basics of 3d projection
- gustavopezzi 10mo agoThanks for mentioning pikuma. :-) The 3D software rendering is still the most popular lecture from our school even after all these years. And it really surprises me because we "spend a lot of time" talking about some old techniques (MS-DOS, Amiga, ST, Archimedes, etc.). But it's fun to see how much doing things manually help students understand the math and the data movement that the GPU helps automate and vectorize in modern systems.
- feelamee 10mo ago> Triangles are easy to rasterize sure, rasterizing triangle is not so hard, but.. you know, rasterizing rectangle is far far easier
- maximilianburke 10mo ago…as long as all points are co-planar.
- deleted 10mo ago[deleted]
- qingcharles 10mo agoRasterizing triangles is a nightmare, especially if performance is a goal. One of the biggest issues is getting abutting triangles to render so you don't have overlapping pixels or gaps. I did this stuff for a living 30 years ago. Just this week I had Deep Think create a 3D engine with triangle rasterizer in 16-bit x86 for the original IBM XT.
- nottorp 10mo ago> One of the biggest issues is getting abutting triangles to render so you don't have overlapping pixels or gaps. > I did this stuff for a living 30 years ago. So you did CAD or something like that? Since that matters far less in games.
- qingcharles 10mo agoIt still looks janky in games. Look at any old 8/16-bit pre-GPU games. Getting this stuff right is hard.
- nottorp 10mo agoIt does. But gamers accepted it and played the hell out of it. That's why I assumed you did CAD.
- nottorp 10mo agoWith the discrete GPUs pricing themselves out of the consumer space, we may actually need to switch back to software rendering :)
- cyber_kinetist 10mo agoThat's too much of a stretch, but I believe games of the next era will be optimized more towards integrated GPUs (such as AMD's iGPU in the Steam Deck and Steam Machine). When hardware is priced out for most consumers (along with a global supply chain collapse due to tariffs and a potential Taiwan invasion), a new era awaits where performance optimization is going to be critical again for games. I expect existing game engines like Unity and Unreal Engine falling out because of all the performance issues they have, and maybe we can return to a temporary "wild west" era where everyone has their own hacky solution to cram stuff into limited hardware.
- nottorp 10mo ago> everyone has their own hacky solution to cram stuff into limited hardware Limited hardware gave us a lot of classic titles and fundamental game mechanics. Off the top of my head: Metal Gear's stealth was born because they couldn't draw enough enemy sprites to make a shooting game. Instead they drew just a few and made you avoid them. Ico's and Silent Hill's foggy atmosphere is partially determined by their polygon budget. They didn't have the hardware to draw distant scenery so they hid it in fog.
- bool3max 10mo agoThat's wishful thinking. The reality is that your iGPU will be used to decode the video stream of an Unreal game running on a dedicated GPU on some cloud server which you pay a monthly subscription fee for.
- Sohcahtoa82 10mo agoI tried doing this in Python a bit ago. It did not go well and it really showed how SLOW Python really is. Even with just an 1280x720 window, setting every pixel to a single color by setting a value in a byte array and then using a PyGame function to just give it a full frame to draw, I maxed out at like 10 fps. I tried so many things and simply could not get any faster.
- phendrenad2 10mo agoI'm surprised more indie games don't use software rendering, just to get a more unique style. 640x400 aught to be enough for anybody!