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
64•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•59m 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•4h ago
Dosent work in firefox, because of missing webgpu.
tormeh•4h ago
Works on mobile Firefox Nightly
swiftcoder•4h 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•4h 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•4h ago
In Firefox, open about:config and set this to true: `dom.webgpu.enabled`.
skrrtww•3h 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•3h 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•2h 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.
CyberDildonics•12m ago
wgpu is based on webgpu, what is your point here?

The title implies that the reason this exists is because it "runs on any gpu, even in the browser". People have been making raytracers using gpu apis in the browser over and over for the last decade.

That would be like someone claiming their program "multiplies huge matrices using SIMD" and then wrapping eigen. Why make a claim that is just happening because you call the same library as everyone else?

_bent•2h ago
Why did you call the project rasterizer when it is not using rasterization but raytracing?
SR2Z•38m 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.

Show HN: Tamagotchi P1 for FPGAs

https://github.com/agg23/fpga-tamagotchi
20•agg23•6d ago•1 comments

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

https://github.com/tchauffi/rust-rasterizer
64•tchauffi•6h ago•19 comments

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

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

Show HN: FinBodhi – Local-first, double-entry app/PWA for your financial journey

https://finbodhi.com/
24•ciju•4h ago•16 comments

Show HN: Extrai – An open-source tool to fight LLM randomness in data extraction

https://github.com/Telsho/Extrai
3•elias_t•1h ago•0 comments

Show HN: An AI to match your voice to songs and artists you should sing

https://coach.singonesong.com
14•JacobSingh•2h ago•0 comments

Show HN: Centia.io – Open PostgreSQL/PostGIS back end for developers

https://centia.io/
21•mhoegh•1w ago•4 comments

Show HN: Weak Incentives – lean, minimalistic toolkit for background agents

https://github.com/weakincentives/weakincentives
2•andreisavu•3h ago•1 comments

Show HN: JotChain – Get more out of your daily work notes

https://jotchain.com
3•morozred•3h ago•0 comments

Show HN: Serie – A rich Git commit graph in your terminal

https://github.com/lusingander/serie
13•lusingander•11h ago•1 comments

Show HN: Complete Claude Code Resource with 3-Minute Setup

https://github.com/jmckinley/claude-code-resources
3•johnmckinley•4h ago•1 comments

Show HN: A pragmatic SQLite schema for application-level caching

https://gist.github.com/ewaldbenes/e48b9b4c1d0e1cb7175dfdd868addd58
2•ebenes•5h ago•0 comments

Show HN: Pianolyze – Learn any piano song using AI/ML, right in the browser

https://pianolyze.com/
4•nickplee•5h ago•0 comments

Show HN: Pydoll, a type-safe asyncio lib for evading bot detection

https://pydoll.tech/docs/deep-dive/fingerprinting/
3•thalissonvs•5h ago•0 comments

Show HN: Anki-LLM – Bulk process and generate Anki flashcards with LLMs

https://github.com/raine/anki-llm
54•rane•1d ago•22 comments

Show HN: Strange Attractors

https://blog.shashanktomar.com/posts/strange-attractors
783•shashanktomar•2d ago•75 comments

Show HN: Why write code if the LLM can just do the thing? (web app experiment)

https://github.com/samrolken/nokode
429•samrolken•2d ago•315 comments

Show HN: Safebox: Open-source framework for managing self-hosted apps (Beta)

2•drebora•9h ago•0 comments

Show HN: A beginner-programming language and IDE with helpful tab completion

https://easylang.online/ide/
3•chrka•3h ago•0 comments

Show HN: Give your coding agents the ability to message each other

https://github.com/Dicklesworthstone/mcp_agent_mail
13•eigenvalue•22h ago•2 comments

Show HN: Pipelex – Declarative language for repeatable AI workflows

https://github.com/Pipelex/pipelex
120•lchoquel•6d ago•26 comments

Show HN: In a single HTML file, an app to encourage my children to invest

https://roberdam.com/en/dinversiones.html
247•roberdam•4d ago•434 comments

Show HN: Quibbler – A critic for your coding agent that learns what you want

https://github.com/fulcrumresearch/quibbler
114•etherio•3d ago•27 comments

Show HN: Duper – The Format That's Super

https://duper.dev.br/
31•epiceric•1d ago•14 comments

Show HN: DeepFake – Free AI Face Swap Online

https://deepfakefusion.com
3•epistemovault•16h ago•3 comments

Show HN: A simple drag and drop tool to document and label fuse boxes

https://github.com/alexadam/fuse-box-labels
26•eg312•3d ago•6 comments

Show HN: PyTogether, open-source lightweight real-time Python IDE for teachers

https://pytogether.org/
4•JawadR•17h ago•0 comments

Show HN: Learn German with Games

https://www.learngermanwithgames.com/
125•predictand•5d ago•106 comments

Show HN: KeyLeak Detector – Scan websites for exposed API keys and secrets

https://github.com/Amal-David/keyleak-detector
27•amaldavid•1d ago•7 comments

Show HN: Run a GitHub Actions step in a gVisor sandbox

https://github.com/geomys/sandboxed-step
85•FiloSottile•1w ago•3 comments