frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: a Rust ray tracer that runs on any GPU – even in the browser

https://github.com/tchauffi/rust-rasterizer
61•tchauffi•6h ago
I’ve been experimenting with Rust lately and wanted a project that would help me explore some of its lower-level and performance-oriented features. Inspired by Sebastian Lague’s videos, I decided to implement my own ray tracer from scratch.

The initial goal was just to render a simple 3D scene in the browser at a reasonable frame rate. It evolved into a small renderer that can: • Run locally or on the web using wgpu and WebAssembly • Perform mesh rendering with a Bounding Volume Hierarchy (BVH) for acceleration • Simulate both direct and indirect illumination for photorealistic results • Be deployed easily as a free web demo using GitHub Pages

The project is far from perfect, but it’s been a fun way to dig deeper into graphics programming and learn more about Rust’s ecosystem. I’m also planning to experiment with Rust for some ML projects next.

GitHub: https://github.com/tchauffi/rust-rasterizer Web demo (desktop browsers): https://tchauffi.github.io/rust-rasterizer/

Would love feedback from anyone who’s built similar projects or has experience with wgpu or ray tracing in Rust.

Comments

WhitneyLand•4h ago
It looks cool, nice project.

Recommend taking a few minutes to make the web page work on mobile.

For example on iPhone the actual webgpu/ray tracing seems to work fine but html formatting is shoving things over to be barely visible.

tchauffi•4h ago
Thanks! It should work on mobile, you can hide the right panel using the button at the bottom of the screen. That said, performance on mobile is pretty limited because of hardware limitations.
jasonjmcghee•32m ago
performance was 60fps on my phone / worked fine, but as parent said - the sidebar covers 90% of the screen. Worth collapsing by default imo.
goodpoint•4h ago
It does not run: "unreachable executed"
tchauffi•4h ago
Maybe your browser do not support webgpu. Try using Chrome.
knowhistory•4h ago
https://www.jsweet.org/examples/#Ray_tracer

Written in Java then transpiled to JavaScript, been around for years.

nogridbag•2h ago
The OP is real time ray tracing which is running between 30-60FPS on my macbook air while moving the camera and objects around.

Your link appears to be a basic ray tracer which anyone who has taken an intro to computer graphics course in college is likely required to implement and would only need a javascript canvas. To be honest I have no idea how much OPs real-time ray tracing differs in complexity from traditional ray tracing.

gunalx•3h ago
Dosent work in firefox, because of missing webgpu.
tormeh•3h ago
Works on mobile Firefox Nightly
swiftcoder•3h ago
Very cool. Enjoyed playing with the "bounces" slider - it's fascinating how little improvement each additional bounce contributes after about 3 bounces. Severely diminishing returns in terms of the final image quality.
tormeh•3h ago
Demonstrates how important it is to match the scenes with the rendering techniques. You can easily create a corridor with a light at one end that requires lots of bounces for the light to get to the end. But in a game you can just decide to not create that kind of scene. Cyberpunk 2077 basically has no rooms without direct light in them, which makes the game look good even without ray tracing.
Maken•3h ago
That's why virtually every renderer stochastically discards indirect paths with low contribution. Looking at the source code, this one computes every subsequent bounce, even those hitting the perfectly blue sphere after hitting the perfectly green one.
eek2121•3h ago
In Firefox, open about:config and set this to true: `dom.webgpu.enabled`.
skrrtww•2h ago
In Safari 26 on an M1 with WebGPU enabled I get "InvalidStateError: GPUCommandEncoder.beginComputePass: Unable to begin compute pass."

In Chrome I get "Failed to start: Failed to create State. Caused by: failed to find GPU adapter."

So I guess it runs on "some" GPUs, in "some" browsers!

CyberDildonics•2h ago
runs on any GPU – even in the browser

Seems pretty clickbaity and dishonest when that's just what webgl and webgpu means. Just say webgpu.

Also the roughness doesn't apply to the environment map.

cptroot•1h ago
If you click into the code you can see that it depends on `wgpu`, which is a wrapper that uses whichever native API would be appropriate for the platform you're working with. If you run the native compiled version you won't be using WebGPU.
_bent•1h ago
Why did you call the project rasterizer when it is not using rasterization but raytracing?
SR2Z•11m ago
Rasterization is just the process of converting an image to a raster, which you also have to do in raytracing. It does sound strange though.

I Tracked 10k Top Podcasts: Here's Who Hosts Their Feeds

https://www.adithyan.io/blog/who-hosts-top-podcasts
1•speckx•19s ago•0 comments

Show HN: React-like Declarative DSL for building synthetic LLM datasets

https://github.com/qforge-dev/torque
1•arturwala•1m ago•0 comments

Building a 2.5kWh battery from disposable vapes to power my workshop [video]

https://www.youtube.com/watch?v=dy-wFixuRVU
1•rsanek•2m ago•0 comments

Windows 7 slimmed down to 69 MB

https://www.theregister.com/2025/10/31/windows_7_limbos_down_to/
1•TMWNN•2m ago•1 comments

This Month in Ladybird: October 2025

https://buttondown.com/ladybird/archive/this-month-in-ladybird-october-2025/
1•samtheDamned•4m ago•1 comments

Snapit: Snapshot Testing for C

https://mattjhall.co.uk/posts/snapit-snapshot-testing-for-c.html
1•ingve•6m ago•0 comments

Intellectual Ventures: Mosquito Laser Shootdown Sequence (2010) [video]

https://www.youtube.com/watch?v=l4tPrcePdGM
1•stmw•7m ago•0 comments

Writing Music with Emacs (2020)

https://www.youtube.com/watch?v=gimjJH73wxI
1•brudgers•7m ago•0 comments

The Year of a Thousand Rooms

https://dxdt.ch/blog.php?blog=year_of_rooms
1•lkm0•7m ago•0 comments

OpenAI Made a $12B Loss Last Quarter, Microsoft Results Indicate

https://www.wsj.com/livecoverage/stock-market-today-dow-sp-500-nasdaq-10-31-2025/card/openai-made...
2•thm•7m ago•1 comments

An Experimental Program for AI-Powered Feedback at STOC

https://scottaaronson.blog/?p=9283
1•amichail•8m ago•0 comments

Temml: A TeX-to-MathML conversion library in JavaScript

https://temml.org/
1•susam•8m ago•0 comments

Coca-Cola's new AI holiday ad is a sloppy eyesore

https://www.theverge.com/news/812559/coca-cola-ai-holiday-christmas-commercial-2025
4•stalfosknight•8m ago•1 comments

Trust Your Intuition in the Face of Uncertainty

https://lindynewsletter.beehiiv.com/p/when-should-you-trust-your-intuition
1•walterbell•9m ago•0 comments

Hosting your static web site with Firebase Hosting

https://www.peterbe.com/plog/hosting-your-static-web-site-with-firebase-hosting
1•speckx•9m ago•0 comments

Writing an LLM from scratch, part 26 – evaluating the fine-tuned model

https://www.gilesthomas.com/2025/11/llm-from-scratch-26-evaluating-the-fine-tuned-model
2•gpjt•12m ago•0 comments

Credentials Evidence or Simulate

https://preludes.eu/op/2025/i/
2•sandij•12m ago•0 comments

Portable documents host new file formats

https://preludes.eu/op/2025/ii/
1•sandij•13m ago•0 comments

Not so sweet: Some sugar substitutes linked to faster cognitive decline

https://www.aan.com/PressRoom/Home/PressRelease/5281
4•oidar•15m ago•2 comments

Leverage Points: Places to Intervene in a System (1999)

https://donellameadows.org/archives/leverage-points-places-to-intervene-in-a-system/
1•Jtsummers•15m ago•1 comments

First clinical pregnancy following AI-based microfluidic sperm detection

https://www.thelancet.com/journals/lancet/article/PIIS0140-6736(25)01623-X/fulltext
1•domofutu•16m ago•0 comments

Max Number of Simultaneous Key-Press (N-Key Rollover, NKRO, Ghosting)

http://xahlee.info/kbd/keyboard_n-key_rollover_key_ghosting.html
2•behnamoh•17m ago•0 comments

Adeia sues AMD for patent infringement over semiconductor technology

https://www.reuters.com/legal/litigation/adeia-sues-amd-patent-infringement-over-semiconductor-te...
3•voxadam•18m ago•1 comments

The dangers of driving after too much coffee

https://www.telegraph.co.uk/health-fitness/diet/nutrition/the-dangers-of-driving-after-too-much-c...
1•domofutu•19m ago•0 comments

Use AMP to send interactive, dynamic emails

https://amp.dev/about/email
1•nateb2022•19m ago•0 comments

Inflammaging biomarkers: retinal vasculature, cardiovascular diseases, longevity

https://medicalxpress.com/news/2025-10-eye-scans-reveal-clues-aging.html
2•PaulHoule•20m ago•0 comments

</> Htmx – The Fetch()ening

https://htmx.org/essays/the-fetchening/
6•leephillips•20m ago•0 comments

Gut microbiome tests are everywhere. Should you get one?

https://apnews.com/article/gut-health-test-microbiome-probiotics-diet-f61947edfc591616639253eeb7a...
2•mooreds•24m ago•0 comments

Efficacy and Safety of CBL-514 Injection in Reducing Abdominal Subcutaneous Fat

https://academic.oup.com/asj/article/45/6/611/8051634?login=false
1•walterbell•24m ago•0 comments

Google flagged my site for phishing and won't tell my why

5•iambateman•24m ago•0 comments