News for hackers. Stuff that matters.

lisyarus

Re:Implementing a Tiny CPU Rasterizer on Friday January 30, 2026 @12:38PM (#46827288)
Hi! 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.
Re:Simulating Water over Terrain on Friday February 07, 2025 @04:13AM (#42970790)
Yep, it literally says that in the article
Re:Simulating Water over Terrain on Thursday February 06, 2025 @09:32PM (#42968638)
Amazing resource, thank you!
Re:Simulating Water over Terrain on Thursday February 06, 2025 @09:23PM (#42968597)
Amazing!
Re:Simulating Water over Terrain on Thursday February 06, 2025 @09:23PM (#42968596)
Yeah I've seen it, no worries! :)
Re:Simulating Water over Terrain on Thursday February 06, 2025 @05:19PM (#42967092)
Very cool! Based on the video you're also doing some hierarchical subdivisions?
Re:Simulating Water over Terrain on Thursday February 06, 2025 @02:54PM (#42965881)
It's true that it makes it more complicated on the GPU side in general, but specifically in this scenario everything works out just fine, mostly because all updates effectively ping-pong between flow & water height buffers, and you never change both in the same kernel.
Re:Simulating Water over Terrain on Thursday February 06, 2025 @02:17PM (#42965537)
Interesting, thanks! Is it kinda like the Gibbs phenomenon?
It's not as much about experience as it is about trade-offs. I've worked a lot with Vulkan and it's an incredible API, but when you're working alone and you don't have the goal of squeezing 250% performance out of your GPU on dozens of different GPU architectures, your performance becomes pretty much independent of a specific graphics API (unless your API doesn't support some stuff like multi-draw-indirect, etc).
See my answer to artemonster above.
I'm using WebGPU as a nice modern graphics API that is at the same time much more user-friendly and easier to use compared to e.g. Vulkan. I'm using a desktop implementation of WebGPU called wgpu, via it's C bindings called wgpu-native.

My browser doesn't support WebGPU properly yet, so I don't really care about running this thing in browser.

> It's a mega-kernel, so you'll get poor occupancy past the first bounce

Sure! If you look into the to-do list, there's a "wavefront path tracer" entry :)

> new origin should be along the reflected ray

I've found that doing it the way I'm doing it works better for preventing self-intersections. Might be worth investigating, though.

Nope, this project is desktop-only

Show HN: I've made a Monte-Carlo raytracer for glTF scenes in WebGPU

https://github.com/lisyarus/webgpu-raytracer

This is a GPU "software" raytracer (i.e. using manual ray-scene intersections and not RTX) written using the WebGPU API that renders glTF scenes. It supports many materials, textures, material & normal mapping, and heavily relies on multiple importance sampling to speed up convergence.

( Read More... | 37 comments | 62 points | on HN )
Re:Implementing a Tiny CPU Rasterizer on Monday November 04, 2024 @03:32AM (#42039645)
Joker_vD obviously talks about the far plane, not the near plane
Re:Implementing a Tiny CPU Rasterizer on Saturday November 02, 2024 @07:01AM (#42025574)
Yep, I've seen this problem when testing locally on chrome, but I've no idea what that is. Reloading the page usually works.
Re:Implementing a Tiny CPU Rasterizer on Saturday November 02, 2024 @06:58AM (#42025551)
I will cover triangle clipping in part 5, and it's much less scary than it seems to be!
Re:C++ audio mixing library design on Tuesday October 18, 2022 @05:21AM (#33244808)
That's for efficiency reasons: most streams have way more logic than just filling the array, which can hardly be represented in terms of "getting the next value", and loops are good for optimization by compiler, etc. In fact, the actual sine wave implementation looks exactly the way you describe: it handles a generating function to a helper class that just fills the array https://bitbucket.org/lisyarus/psemek/src/master/libs/audio/...
Re:C++ audio mixing library design on Monday October 17, 2022 @02:59PM (#33238056)
True! But also my use case it quite different compared to GStreamer, and I don't really need all that metadata & introspection.
Re:C++ audio mixing library design on Monday October 17, 2022 @09:03AM (#33232887)
It pretty much may be!
Re:C++ audio mixing library design on Monday October 17, 2022 @03:51AM (#33230824)
std::vector would definitely be the wrong choice, since I typically want to pass random subsections of random arrays to be filled by audio samples. std::span would be a good choice, though (I actually have my own span in the engine, from before C++20). Why didn't I use it? No idea, just didn't come to my mind. Guess it might be the influence of the book I was reading, or of SDL_Mixer interface, etc. I may do some refactoring in the future and use spans instead.
Re:C++ audio mixing library design on Monday October 17, 2022 @03:45AM (#33230786)
The alternative that my older code used was int16, and it has way bigger precision issues (32-bit float has 23 bits of precision, and in16 has 15). Fundamentally audio samples are just numbers; the fact that they have to be in the [-1..1] range in the end is a hardware technical limitation (the speakers' membranes can only vibrate so much), but there's nothing in the audio itself that says it should be constrained to some range. So, floating-points are a nice fit. Fixed-point math like 16.16 might be a good alternative, but floats have hardware support, so here we go.