# How is a projector handled in a Ray Tracing environment?

I want to create a scene where a room includes a projector and a white screen.

How is a Ray Tracing environment functioning in such a setup? Is the light from the projector going through a slide and then the color reflecting on the white screen? If so, wouldn't any light ray bounce on that screen creating a mess?

• Is this a ray-tracer you control, or are you trying to make a scene that will work with a particular (off the shelf) renderer? Apr 19 '18 at 10:49
• @DanHulme I'll be in control. Apr 19 '18 at 14:42

Just treat it as a special case of a point light + shadow ray. Whenever a ray hits the screen (or any surface onto which you'd like to project the slide), fire another "projector" ray back towards the projector. If it is not obscured, then use the X & Y angles (relative to the coordinate system of the projector) to look up a texture map of the slide.

Graphics is all about cheating when possible.

The projector can be a spotlight where the color of the light depends on the direction of the light vector.

It's the same math required for shadow mapping with it.

• "color depends on the direction" — by that do you mean that I can represent the projector white light going through the slide and taking on the color of that pixel? Apr 20 '18 at 2:48

This is kind-of the same as ratchet freak's answer, but fleshed out a little more.

The usual way to handle this is with a special projector light type. It's like a spotlight, but (usually) with a square instead of circular fall-off. That is, when you cast a shadow ray to the light, you don't just measure a single angle (or radius) from the light's axis, you measure $(x, y)$ co-ordinates in the light's space. You divide these co-ordinates by the size of the projection (a parameter of the light just like the cone spotlight's angle parameter), and use the result for a texture look-up in the image you want to project.

If so, wouldn't any light ray bounce on that screen creating a mess?

If you're using a GI system, the high-frequency lighting detail that you get from a projector light will create a more challenging GI environment. You can control the badness by making the albedo of the surface you're projecting onto as small as you can get away with. If you don't need accurate GI results, you can use a proxy in the GI system instead of the real projector map. The proxy could have an aggressively blurred image, or even a normal spot-light whose colour is the average of the whole image. The blur technique is very applicable to a path tracer, while a single colour would be simplest for a radiosity or virtual lights implementation.