Live data from Hacker News

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

github.com

1–10 of 43 posts

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

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

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

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

#4
This is a completely side question, but just because it always astonishes me how "real" raytraced scenes can look in terms of lighting, but it's too complex/slow for video games.

How far have we gotten in terms of training AI models on raytraced lighting, to simulate it but fast enough for video games? Training an AI not on rendered scenes from any particular viewpoint, but rather on how light and shadows would be "baked into" textures?

Because what raytracing excels at is the overall realism of diffuse light. And it seems like the kind of thing AI would be good at learning?

I've always though, e.g. when looking at the shadows trees cast, I couldn't care less if the each leaf shape in the shadow is accurate or entirely hallucinated. The important things seem to be a combination of the overall light diffusion, combined with correct nearby shadow shapes for objects. Which is seems AI would excel at?

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

#5
It's a mega-kernel, so you'll get poor occupancy past the first bounce. A better strategy is to shoot, sort, and repeat, which then also allows you to squeeze in an adaptive sampler in the middle.

> // No idea where negative values come from :(

I don't know, but:

> newRay.origin += sign(dot(newRay.direction, geometryNormal)) * geometryNormal * 1e-4;

The new origin should be along the reflected ray, not along the direction of the normal. This line basically adds the normal (with a sign) to the origin (intersection point), which seems odd.

Poor's man way to find where the negatives come from is to max(0,...) stuff until you find it.

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

#7
post #5

It's a mega-kernel, so you'll get poor occupancy past the first bounce. A better strategy is to shoot, sort, and repeat, which then also allows you to squeeze in an adaptive sampler in the middle. > // No idea where negative values come from :( I don't know, but: > newRay.origin += sign(dot(newRay.direction, geometryNormal)) * geometryNormal * 1e-4; The new origin should be along the reflected ray, not along the dire…

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

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

#8

This is a completely side question, but just because it always astonishes me how "real" raytraced scenes can look in terms of lighting, but it's too complex/slow for video games. How far have we gotten in terms of training AI models on raytraced lighting, to simulate it but fast enough for video games? Training an AI not on rendered scenes from any particular viewpoint, but rather on how light and shadows would be "b…

At any reasonable quality, AI is even more expensive than raytracing. A simple intuition for this is the fact that you can easily run a raytracer on consumer hardware, even if at low FPS, meanwhile you need a beefy setup to run most AI models and they still take a while.

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

#9

This is a completely side question, but just because it always astonishes me how "real" raytraced scenes can look in terms of lighting, but it's too complex/slow for video games. How far have we gotten in terms of training AI models on raytraced lighting, to simulate it but fast enough for video games? Training an AI not on rendered scenes from any particular viewpoint, but rather on how light and shadows would be "b…

[deleted]

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

#10

This is a completely side question, but just because it always astonishes me how "real" raytraced scenes can look in terms of lighting, but it's too complex/slow for video games. How far have we gotten in terms of training AI models on raytraced lighting, to simulate it but fast enough for video games? Training an AI not on rendered scenes from any particular viewpoint, but rather on how light and shadows would be "b…

The current approach seems to be ray tracing limited/feasible number of samples and upsampling/denoising the result using neural networks.
Post reply on HN