Creating 'Projectors' in Blender Cycles

Hi there! First time posting.

I’m currently trying to achieve a ‘projector’ effect in Blender. I’ve seen a lot of tutorials for creating a spot light that beams an image instead of a single light. Great! However, I haven’t seen someone create a projector that accounts for the focal range usually present in projections. i.e. a projector always focuses to a near distance (2m - 10m lets say), and ‘over throw’ or ‘bleed’ (anything that goes past or through the projection surface) from a real projector will create a blurry spot in the far distance. This is the effect I want. A focus-able projector.

I have a hacky solution working, in which ive made a ‘sharp’ and ‘blurry’ version of the image im projecting, and I’ve set up a mix shader, the factor of which is hooked up to the ‘Light Path, ‘Ray Length’’ node.

This means, depending on the ray length, it projects the sharp or blurry image. I then used a ‘Math’ node to divide the Ray Length value to tweak the focus depth. However I’m still not able to get the level of controlability I want.

Maybe theres someone here that is great with Maths/Nodes who can help me find a cleaner or more controllable solution. I think if I can just normalize the range of the ‘ray length’ and play with the upper and lower bounds then I have a workable solution.

Thanks for taking the time to read this :grinning: .

Current Result