News for hackers. Stuff that matters.
Re:Zdog – Pseudo-3D JavaScript engine for Canvas and SVG by soylentgraham on Wednesday May 29, 2019 @04:32AM (#20037920)
Are you suggesting ray marching the object instead of drawing 2D shapes?
Re:Zdog – Pseudo-3D JavaScript engine for Canvas and SVG by overgard on Wednesday May 29, 2019 @07:59PM (#20046990)
Yes, if you don't want z-fighting. If you don't care then this is perfectly fine. But since both approaches can be expressed in a very similar way (primitives that can easily be mathematically modeled), and rendered in the same style, I figured it's an interesting way of achieving the same thing if you want the same style and scalability while allowing for intersecting objects. The trade-off is that ray marching is more expensive.
Re:Zdog – Pseudo-3D JavaScript engine for Canvas and SVG by zalo on Friday May 31, 2019 @01:54PM (#20063301)
Perhaps if you want to stay truer to the spirit of the system, then you might have zDog generate faux depth buffers for each of its shapes (using gradients when necessary).

Then you might still take advantage of Chrome’s “optimized” SVG rasterization, but also use the GPU to do depth compositing on the color buffer afterward. As a bonus, depth-fade intersection shaders could work (which are tricky with raymarching).