5 ms·
Accelerated “Ray Tracing in One Weekend” in CUDA
- corysama 8y ago"Ray Tracing in One Weekend" is the first in a very popular 3-part series of short, introductory-level books on ray tracing. "Ray Tracing in One Weekend/The Next Week/The Rest of Your Life" have recently switched to DRM-free, "Pay What You Want" pricing http://in1weekend.blogspot.com/2016/01/ray-tracing-in-one-weekend.html http://in1weekend.blogspot.com/2016/01/ray-tracing-in-one-we...
- drharby 8y agoBless thee, corysama
- asafira 8y agoFrom the post: "Ray tracing was invented by Turner Whitted around 1980." I believe that Turner probably did some great things, but somehow I don't think I believe he invented ray tracing. Ray tracing has been around for so long in physics...
- twtw 8y agoWhitted published the first paper applying recursive ray tracing to the problem of rendering an image. Quibbling over this is like saying no one invented compute graphics because Renaissance artists knew how projection worked.
- asafira 8y agoI am sorry you feel that way =/; I understand it was a picky comment, but quibbling over it is far from the gross overstatement you mentioned.
- lsb 8y agoIn the newest Chrome I'm getting NET::ERR_CERT_SYMANTEC_LEGACY Subject: devblogs.nvidia.com Issuer: RapidSSL SHA256 CA
- pixelbeat__ 8y agosame in firefox nightly
- Goz3rr 8y agoIt's their fault, but to temporarily override it so you can read the page simply type "thisisunsafe" (without quotes) on the error page
- parka 8y agoWhose fault? Chrome? I'm also facing the same problem. Same version of Chrome, but on Windows, it loads properly, but not on Mac.
- HHalvi 8y agoCan someone explain Ray Tracing to me like i'm five? Assume that this 5 year old loves playing a lot of different varieties of games and would be glad if his favorite developers end up making better experiences for him using ray tracing.
- TomVDB 8y agoWith ray tracing, you cast an imaginary ray from your eye to each pixel of your monitor and you follow that ray until it hits some kind of object behind it. And then when you hit that object, you cast more rays from that intersection hit point: - to light sources and see whether or not there's some other object between that intersection and the light source. This determines shadows. - to the reflected position of the initial ray, to calculate reflections. - ... It's a recursive process where you gather light values as you go, the combination of which gives you a final color for the pixel through which you shot that initial ray.
- zamadatix 8y agoRay tracing is relatively easy to understand, it's not ray tracing that is actually complicated. Ray tracing is simply sending out rays from the virtual camera, seeing what they hit along the way, and calculating the lighting effects of the materials and light sources when you hit those things. In the end you've simulated a sample of light that hit the camera. Repeat a couple million times and you've got an accurate picture of what the virtual scene looks like. "Normal" computer graphics is comprised of doing every dirty shortcut trick you can imagine to avoid tracing hundreds of millions of rays per second while still having some semblance of lighting effects in the virtual scene.
- sdwisely 8y agosome good eli5s here, just adding for the grandparent post to remember that light bounces so the calculations get rather iterative and expensive.
- signa11 8y agoalso, don't forget that the nature of material also influences how light behaves e.g. scattering, reflection, refraction etc. etc. and depending on the scene, computations can be quite expensive...
- fulafel 8y agoI'd also recommend this interesting blog series from Unity graphics engineer arasp, covering many languages and platforms and incremental perf improvements: https://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-0-Intro/ https://aras-p.info/blog/2018/03/28/Daily-Pathtracer-Part-0-...
- weebhard 8y agoWhat's wrong with the code? I have CUDA 10 installed and all Nvidia's shipped samples work fine, while this doesn't. I'm new and totally lost, how can this be debug? [weeb@neet ~/repo/raytracinginoneweekendincuda (ch01_output_cuda)] $ ./cudart Rendering a 1200x600 image in 8x8 blocks. CUDA error = 48 at main.cu:48 'cudaGetLastError()'
- Robadob 8y agocuda error 48 is apparently "No Kernel Image available for execution on this device" Make sure that you're building for the appropriate device architecture. http://arnon.dk/matching-sm-architectures-arch-and-gencode-for-various-nvidia-cards/ http://arnon.dk/matching-sm-architectures-arch-and-gencode-f...
- weebhard 8y agothanks! that did it, works now. Makefile had "sm_60" arch flag while my card is sm_50.
- twtw 8y ago"I'm new and totally lost" Then I'll give you some unsolicited advice: 1. Don't assume it's someone else's fault - "What's wrong with the code" is the wrong first question. 2. Read the original article, in its entirety. Fortunately people are still nice enough to help you, but the combo of "how is this screwed up" and "I didn't thoroughly read the article" is off-putting to people who would otherwise love to assist you. The relevant section: > If you start with my Makefile, note that I build for a GTX 1070 card using specific -gencode flags for that card (-gencode arch=compute_60,code=sm_60). You will want to adjust the architecture and feature settings for the GPU or GPUs you will be running on.
- skinner_ 8y agoI checked this out because I expected to learn about the brand new RT Core accelerated ray tracing. Turns out this tutorial does not touch that topic. It's awesome either way, but https://devblogs.nvidia.com/nvidia-optix-ray-tracing-powered-rtx/ https://devblogs.nvidia.com/nvidia-optix-ray-tracing-powered... might be more relevant for people like me.
- IvanK_net 8y agoI made a similar thing a couple of years ago: http://powerstones.ivank.net/ http://powerstones.ivank.net/ Instead of producing an image, it is an actual game :D And instead of running just on nVidia, it runs everywhere (in a browser, even on phones etc).
- amelius 8y agoJust a random thought: would it make sense for Rust to target GPUs?
- jeffreyrogers 8y agoThe programming model for GPUs is pretty different from CPUs. (Branching is discouraged on GPUs, simpler hardware, highly parallel, etc.). I think the right approach is to have separate languages for the two.
- twtw 8y agoThe original post is about how to make a C++ program run on a GPU via relatively minor annotations.
- jeffreyrogers 8y agoYes, and the question was whether it makes sense for Rust to target the GPU, not whether it's possible. I think most people would agree that in an ideal world you would have a different programming language for the GPU than you have for the CPU because the hardware is so different. CUDA uses C++ (and C and Fortran) because there is already lots of code written in these languages and it makes it easy to port code to run on the GPU.