6 ms·
Awesome! I tried to look into building a simple raytracer many times, but the either math gets me everytime or I just didn't come across the right "raytracer fo
by gumuz 13y ago
Awesome! I tried to look into building a simple raytracer many times, but the either math gets me everytime or I just didn't come across the right "raytracer for dummies" tutorials.
Any suggestions?
- ggambetta 13y agoThe fully commented (but not entirely clean) code is here: http://www.gabrielgambetta.com/tiny_raytracer_full.js http://www.gabrielgambetta.com/tiny_raytracer_full.js Also, I'm halfway through writing a Computer Graphics textbook, half of it dedicated to raytracing.
- jamiek88 13y agoI'd buy it, please post the link once its done, or if you want any proof readers or people to type in the code to check for typos I'd be happy to help.
- ohwp 13y agoFor many year I also tried to build a simple ray tracer. The math got me to, but in the end I was able to write different types of render engines. What helped me: learn about vectors learn about (vector) normalization learn about camera models http://www.ventrella.com/Ideas/Camera/Arm_Camera.pdf learn about pixels (pixels are just dots without size) use a 3D coordinate-system that works for you (mine is: x = right, y = forward, z = up) start with a simple camera model (always looking forward) normalize all direction vectors place the screen of pixels 1 unit in front of the camera normalize the screen of pixels know that the center pixel is on the forward vector of the camera try to calculate a vector from the camera position to the left top of the pixel screen in front of the camera
- tripzilch 13y agoPossibly more than you asked for, but it's great material: http://scratchapixel.com/ http://scratchapixel.com/ (on a not-particularly-raytracing-related note, I can really recommend to anyone interested the lesson about colour spaces, first time the point of CIExy and sRGB became clear to me. also for anyone wondering why the colours in F.lux / Redshift shift the way they do, check the "blackbody radiation" chapter)