<p>I am working on a raytracing Java program for fun. Here's one rendering: <a href="https://i.sstatic.net/CSWU3.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/CSWU3.jpg" alt="enter image description here"></a></p>

<p>As you can see I still have to implement anti-aliasing (and there are huge geometry problems I won't get in to). How would one go about this in a raytracing program, where the renderer doesn't really render lines, but individual pixels? Is it even possible? For example, in a scanline rendering, you could apply anti-aliasing after filling a triangle. But in a raytraced rendering, the program works pixel-by-pixel, and doesn't know where object's edges are, or where to smooth things out.</p>

<p>Thanks</p>

CC BY-SA 3.0
2017-12-27T04:47:09.523Z
For raytracing you can just cast multiple rays per pixel to collect multiple samples per pixel. Then average out the results. Now you can end up getting pretty sophisticated in terms of the sampling algorithm itself especially when you get into indirect lighting, but that's the gist of it: just multiple rays/samples per pixel. I've actually seem some raytracers just fudge the ray by a random subpixel value each time it is being cast to produce an antialiased image and the results actually look quite decent. The randomness of the sampling can help pick up razor thin geometry, e.g....
DataMatters
CC BY-SA 3.0
2017-12-27T04:50:02.390Z
... which a uniform sampling method might miss. That's for offline raytracers that are intended to run for long amounts of time to converge towards a decent production image. If your aim is more realtime approximation with interactive framerates, then maybe uniform sampling would work better, like one that is fixed to project 5 rays per pixel. There are also dirt cheap post-processing techniques on the rendered image like FXAA, but those don't look so great but maybe acceptable if your goal isn't to render production-quality images.
DataMatters
<3d><antialiasing><raytracing>
How does anti-aliasing work, in general, for raytracing?
MCMastery
# How does anti-aliasing work, in general, for raytracing?

(Asked by: username_0 on 2017-12-25)

I am working on a raytracing Java program for fun. Here's one rendering: [![enter image description here](https://i.sstatic.net/CSWU3.jpg)](https://i.sstatic.net/CSWU3.jpg)

As you can see I still have to implement anti-aliasing (and there are huge geometry problems I won't get in to). How would one go about this in a raytracing program, where the renderer doesn't really render lines, but individual pixels? Is it even possible? For example, in a scanline rendering, you could apply anti-aliasing after filling a triangle. But in a raytraced rendering, the program works pixel-by-pixel, and doesn't know where object's edges are, or where to smooth things out.

Thanks

**Tags:** 3d, antialiasing, raytracing

> **Comments:**
> **username_1**: For raytracing you can just cast multiple rays per pixel to collect multiple samples per pixel. Then average out the results. Now you can end up getting pretty sophisticated in terms of the sampling algorithm itself especially when you get into indirect lighting, but that's the gist of it: just multiple rays/samples per pixel. I've actually seem some raytracers just fudge the ray by a random subpixel value each time it is being cast to produce an antialiased image and the results actually look quite decent. The randomness of the sampling can help pick up razor thin geometry, e.g....  
> **username_1**: ... which a uniform sampling method might miss. That's for offline raytracers that are intended to run for long amounts of time to converge towards a decent production image. If your aim is more realtime approximation with interactive framerates, then maybe uniform sampling would work better, like one that is fixed to project 5 rays per pixel. There are also dirt cheap post-processing techniques on the rendered image like FXAA, but those don't look so great but maybe acceptable if your goal isn't to render production-quality images.  

---

## 0 answers

