// the find
skywind3000/RenderHelp
:zap: 可编程渲染管线实现,帮助初学者学习渲染
A single-header C++ software rasterizer that implements a Direct3D-style programmable pipeline with vertex/pixel shaders as C++ lambdas. Built as a teaching tool for understanding how rasterization actually works under the hood, not as something you'd ship in a real renderer. Comments are almost entirely in Chinese, so it's really aimed at that audience learning the fundamentals.
Gets the fiddly details right that most 'learn software rendering' projects get wrong: pixel centers instead of corners for sampling, correct shared-edge handling between adjacent triangles via edge equations, perspective-correct texture mapping via 1/w interpolation, and rounded (not truncated) texture coordinate lookups. Core DrawPrimitive loop is ~200 lines and genuinely readable — each formula in the code has a citation back to where it comes from, which is rare. The shader-as-std::function design lets you set breakpoints inside a 'GPU shader' with a normal C++ debugger, which is a nice trick for teaching.
ShaderContext stores varyings in std::map<int, Vec4f> etc., meaning every pixel does tree lookups for interpolated values — fine for a 200x600 demo image, useless as a reference for actual performance characteristics of a rasterizer. No tests, no CI, and the build instructions are a shrug ('might need -std=c++17 on Mac, not sure, don't have the environment to check'). It's archived-in-spirit: last push over a year ago, seven fixed sample programs and no indication of further feature work. Also only handles a single triangle rasterization path — no clipping against near/far planes beyond homogeneous clip space, no depth/stencil tricks, so it teaches the core loop but stops well short of anything resembling a real pipeline.