3 ms·
No, not really. It's not hard to write a graphics pipeline emulator. Those who believe a software rasterizer is difficult simply haven't spent much time trying
by sillysaurus3 9y ago
No, not really. It's not hard to write a graphics pipeline emulator. Those who believe a software rasterizer is difficult simply haven't spent much time trying to write one.
Making it correct is much more difficult than making it at all. I'd be shocked if their emulator got the basics correct in every detail. Example: Texture wrapping occurs by taking the UV texcood modulo the texture size. But since a texcoord can be negative, your modulo operation has to account for that at the boundary between positive and negative, or else you end up with truncated texels.
It doesn't sound like they were really writing a rasterizer, but it's the same concept.
- chris_wot 9y agoI guess I'm one of those :-) I still have massive respect for these guys.
- sillysaurus3 9y agoYeah, I didn't mean to minimize the achievement. I just meant if you're interested, you should try it! It's fun.
- mrspeaker 9y agoAnd if you do want to try it, I recommend this as a starting point: https://github.com/ssloy/tinyrenderer/ https://github.com/ssloy/tinyrenderer/ - straightforward and satisfying to get a 3D model up on screen. It really helped me start building an understanding of how the a pipeline might be implemented.
- TazeTSchnitzel 9y ago> But since a texcoord can be negative, your modulo operation has to account for that Is that the fmod(fmod(a, b) + b, b) thing, or something else? I still wish that was the default behaviour in more languages…
- sillysaurus3 9y agoIf you like this kind of thing, http://chrishecker.com/Miscellaneous_Technical_Articles http://chrishecker.com/Miscellaneous_Technical_Articles is an excellent resource. It points out all of the fiendish corner cases lurking in a standard rasterizer. http://chrishecker.com/images/9/97/Gdmtex2.pdf http://chrishecker.com/images/9/97/Gdmtex2.pdf page 21 has a correct FloorDivMod function.