# Darryl's Pixels

I’ve been very silent for a while but I have a big update coming soon. I’ve been extensively working on my own raytracer, Solstice whilst also beefing up my real-time engine which I’ve called Equinox.

I’ve been writing the blog posts for the next Ray tracing in One Weekend chapters, which I’m quite excited about, I’ve tried to be as pedagogical as possible.

I also have a post about how to go about building acceleration structures. In my opinion there isn’t really a gentle introduction on how to do this, and I’d like to fill the void. Just general tips and advice. I’m writing about my own personal process and the mistakes I made and how I fixed and debugged stuff.

The big blog post I’m planning for the summer will be about bidirectional path tracing. I’m going to provide a very simple framework and scene, for people and walk them through the theory and implementation. I’ve been thinking a lot about this and my aim is to simplify the concepts as much as possible.

On the work-side, we’re veeeeery busy with SIGGRAPH, but I’ll share later on what we’re doing, I don’t want to spoil it, but it is going to be brilliant! Tomorrow I’m giving a talk to the London GPU meetup group and I’ll talk about our initial efforts and investigations into getting some Realtime Ray tracing inside of Unity DXR. Whereas at GTC we kept it quite high level, I’ll dive deeper this time.

# Ray Tracing The Rest of Your Life: A reader's companion, Chapter 2

Welcome back! If you’re joining from the 1st post, you can skip ahead and start reading from the Chapter 2 title. If not, here’s a link to the first post as there’s some information in the beginning about this blog series.

# Chapter 2: One Dimensional MC Integration

Monte Carlo is widely used to solve integrals of higher dimensions, where an analytical method is not possible, or other integral computational methods are intractable. Dr. Shirley selects a simple integral to show how effective Monte Carlo integration is.

Start reading the chapter right until you get to the code that computes the integral. Don’t worry if you don’t get it, I’m going to explain everything.

The integral is $$\int_0^2 x^2 dx$$ which will compute the area under the curve, with the limits 0 to 2. So how do we translate this into a Monte Carlo estimate? I was a bit confused by the sudden appearance of the 2 being multiplied with the average(x^2, 0, 2) function. Why are we multiplying the sample average by 2? Well as it turns out, this how we perform Monte Carlo integration. A generic integral of the form:

$F = \int_a^b f(x)$

can be estimated with a Monte Carlo estimator by performing

$(b-a) \frac{1}{N} \sum_{i=0}^{N-1} f(X_i)$