BVH debug-mode also works well 🙂
3D Line drawing now account for the depth buffer appropriately, with perspective-corrected depth interpolation, and with antialiasing 🙂
The entire code for this demo 🙂 (and yes, that's a JavaScript pixel shader there, fancy that...)
Bi-Linear filtering in pure TypeScript (I'm honestly impressed by how well JavaScript performs...)
Let there be lights! 😄
Hosted interactively using GitHub pages: https://hardcorecodin.github.io/RenderEngine3D (double-click then WASD + mouse)
CPU Rasterizer: Pixel Shaders and Vertex attribute interpolation in Clipping and Rasterization (perspective-corrected barycentrics):
Got back to my old software-rasterizer (implemented from scratch in TypeScript - will port to C soon'ish...). Just finished: Culling, clipping, rasterisation (w/ persp. corrected interpolation) and materials with mesh/pixel shaders:
Added the perspective projection visualization to SlimEngine in the examples section: https://github.com/HardCoreCodin/SlimEngine
Line drawing: Anti-aliasing, depth sorting and proper alpha blending:
Added basic file reading and writing to SlimApp (using win32 in that platform layer). Also improved the examples and README a bunch: https://github.com/HardCoreCodin/SlimApp
Finally got tired enough of re-compiling for light tweaking, so wrote my own light and color controlls 😋 The stored values are in Linear, but the swatches are displayed in sRGB (gamma corrected). I think it makes it more intuitive to explore the gamut this way, as the colors you pick more closely represent how they impact the scene. And the colors in the picker show how there's more gamut space taken by the lower-ends of the values.
And this time it runs just fine on the GPU (using CUDA) at 1080p(!) 😇 (Even though it still uses recursion)
...and if triangles are possible on tetrahedra, then quads on cubes are also, because why the not..? 😋
Tetrahedra are now dynamically resizable & rotatable. Acceleration structure mix: Screen-space bounds for culling primary ray intersections BVH for culling shadow ray intersections Ray/tetrahedron intersection checks now default to happen in tangent-space for a ~20% performance boost :)
New and improved way of generating screeen-space bounds for visibility masking! Derived the new approach myself: Gets perfect perspective projection of spheres onto a rectangular 2D bounds, at any FOV, without needing any AABBs, or a projection matrix, and doesn't use any trig.
Much more accurate and very robust to even the most extreme FOV(!) The old way was breaking down completely there (as can be seen around the end)
Red = Old Yellow = New
BVH FTW!!!
(...or NOT in this case...) 😆 SSB = ScreenSpace Bounds check
Turns out that for such a simple scene it's better to just have one node as both root and leaf...😇
CPU vs. GPU : Can now be toggled dynamically at run-time! 😋 Even while interacting with the camera, togeling debug-render modes, etc. Also switched to showing micro-seconds per-frame in the HUD
Got ray/triangle intersection working 😇
Still no acceleration structure, so still slow...
Though came up with an in/out-testing approach for tetrahedral-triangles that's ~30% faster
(doing it in tangent-space instead of world-space):
y > 0 && y < x*SQRT3 && y < (1 - x)*SQRT3
Donno it it's a common thing I've re-invented or not, but works very nicely 😎
Recursive Ray-Tracing is sooooo much fun!😇 (when it works...😋 ) Initial material system:
Double-sided glass (with air inside): Refraction + Reflection with fresnel 😎
Real time Ray-Traced reflections! On a single threaded CPU (without SIMD) Because hey, why the hell not...? 😎
Per-geometry material: Lamber walls and a small ball Phong ball Blinn ball Chrome ball (Blinn-based)
...aaaaand we got shadows 😇 Wasn't even that difficult to add (take that rasterization... 😋 ), and not even that expensive
"I got walls!" 😋 Fps deffinitly taking a dive now at higher resolutions, especially with Blinn Still real-time at lower res. though 😇 Not too much to optimize for simple ray/plane intersections... Onto shadows and reflections next! 😁
...aaaand now some old-school shading, just for fun 😋 (Lamvert, Phong and Blinn, with Ambient + 3-point lighting with quadratic-atteniuation) Really digging this new per. 🤘
Got back to my CPU RayTracer (single-threaded, no SIMD) applying a very simplified "Acceleration Structure", and got a MASSIVE performace boost. Not a BVH or anything (yet), but works very well for spheres 😇 Debug-mode shows how it works: Just doing an orthographic projection of each sphere onto a projection plane set at a distance of the sphere's center (appropriately scaled, accounting for the focal length), then taking a screen-space bounding-rectangle. Additionally, pre-emptively filtering-out spheres that can be easilly rejected as being out of view. The HUD show's how many "active" spheres are being considered, as well as what overall percentage of the screen's pixels get a ray traced for them 😁 With these kind of FPSes, gonna start doing some shading now.