Skip to content

vlwkaos/threejs-blackhole

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

three-js-blackhole


Screenshot

My attempt at grokking realtime blackhole ray tracer with an accretion disk around. I tried to reproduce [1] and [2].

I was fascinated by the idea of ray tracing blackhole with now popularized accretion disk around it, So I hopped in.

// dev server
pnpm vite dev

Features

  • Drag to look around
  • Adjustable quality vs performance
  • Adjustable bloom effect
  • Save to an image
  • Physics
    • Lorentz transform
    • Doppler shift
    • Relativistic beaming
    • Accretion disk
    • Background star color from blackbody spectrum (random and trivial velocity for red shift)

TODO

  • Add foggy effect

How it was built

There are two parts to implementing this type of project: physics and graphics.

  • First, you need to grasp the basics of computer graphics: ray tracing.
    • Find an example that draws a sphere using a shader and learn from it.
    • It helps to think in a perspective of light when playing with ray tracing.
  • Try to implement a camera movement inside the shader.
  • Now, you want to apply varying degrees of physical phenomena with shader.
  • In this case, they are about light and blackhole. There are lots of resources out there to understand them. But remember that you might not understand everything. If you could you'd have a different major.
  • Find formulas, try them to better understand.
  • Slowly move towards the correct implementation of the formulas

License

Apache License, Version 2.0

  • dat.GUI

MIT license

CC-BY-NC 2.0

GNU, General Public License, Version 3.0

All other files in this glitch project are hereby licensed under GPL, v3.0

This project renders schwarzchild blackhole (+ various effects).

Copyright (C) <2018>  <pizzakinggod>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.