Better HN
topnewbestaskshowjobs
Log inSign up

lisyarus

116 karma · joined Oct 17, 2022 (4y ago) · 25 submissions

Submissions

comment 9mo ago · link · parent

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.

comment 1y ago · link · parent

Yep, it literally says that in the article

comment 1y ago · link · parent

Amazing resource, thank you!

comment 1y ago · link · parent

Amazing!

comment 1y ago · link · parent

Yeah I've seen it, no worries! :)

comment 1y ago · link · parent

Very cool! Based on the video you're also doing some hierarchical subdivisions?

comment 1y ago · link · parent

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.

comment 1y ago · link · parent

Interesting, thanks! Is it kinda like the Gibbs phenomenon?

comment 1y ago · link · parent

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).

comment 1y ago · link · parent

See my answer to artemonster above.

comment 1y ago · link · parent

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.

comment 1y ago · link · parent

> 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.

comment 1y ago · link · parent

Nope, this project is desktop-only

14.

Show HN: I've made a Monte-Carlo raytracer for glTF scenes in WebGPU(github.com ↗)

131 points · by lisyarus · 1y ago · 37 comments

comment 2y ago · link · parent

Joker_vD obviously talks about the far plane, not the near plane

comment 2y ago · link · parent

Yep, I've seen this problem when testing locally on chrome, but I've no idea what that is. Reloading the page usually works.

comment 2y ago · link · parent

I will cover triangle clipping in part 5, and it's much less scary than it seems to be!

comment 4y ago · link · parent

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/...

comment 4y ago · link · parent

True! But also my use case it quite different compared to GStreamer, and I don't really need all that metadata & introspection.

comment 4y ago · link · parent

It pretty much may be!

comment 4y ago · link · parent

Indeed, thanks!

comment 4y ago · link · parent

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.

comment 4y ago · link · parent

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.

comment 4y ago · link · parent

Adding a whole new language (meaning compiler, packaging, libs, ecosystem) into my engine just for the audio lib which I _wanted_ to implement myself in the first place? No, thanks.