[Hackathon] NeRF in Mojo

TL;DR: Iimplemented a Neural Radiance Fields (NeRF) rendering pipeline in both PyTorch and Mojo, including ray sampling, neural network inference, and volume rendering. PyTorch is currently 73.5x faster, but the project taught me a lot about Mojo and its potential.


What I Built

Complete End-to-End NeRF Implementation: Not just the neural network, but the entire 3D rendering pipeline:

  • Ray Generation: Camera rays for each pixel

  • Point Sampling: 3D points along rays

  • NeRF MLP: Neural network for density + color prediction

  • Volume Rendering: Alpha compositing integration

  • Image Synthesis: Final pixel color computation

Both frameworks render the same algorithm identically - this isn’t just a toy example, it’s a real implementation that generates real results (24.59 dB PSNR on the class Lego scene).


Try It Yourself

Clone the github repo and test it for yourself

  • Memory Optimization: Novel approaches to graphics pipelines
3 Likes

This topic is very hot in the GIS space right now.

Your title says " PyTorch is currently 73.5x faster, but the project taught me a lot about Mojo and its potential." but the readme.md says mojo+gpu is 10,077x faster than PyTorch GPU NeRF. Bit confused. Are those two separate benchmarks that aren’t comparable?

the link is not working.. can you pl share updated link. super interested in how LumaAI’s nerf were implemented and to compare with mojo implementations