Compositing

Hi guys, I’m trying to do virtual staging so I basically have to put the 3d model in a photo, what I’m doing is using fspy to get the right camera aperture and position, and start with setting up the shadow catcher plane, add the furniture, HDRI environment light and some spot lamp.
The problem is that when I go for the render using the filmic color management I’m also changing the contrast on the base image, is it possible to keep the light on the base image as it is and using the color management only on the scene with the object and shadows?


This is an example of what I’m trying to do.

Congratulations on stumbling into a colossally deep rabbit hole.

The issue is that any photo you find online or elsewhere, unless you are using the camera “raw” encoded file, has a number of twists and turns applied to it. That is, the still image from a camera, even if directly off of the card, has been manipulated.

Inverting the situation makes it easier to comprehend. That is, if we were to look outside a window, we could draw a grid on the window and capture the emission of each smaller window “pixel” region. To “play that back”, we would use a projector that was capable of projecting that exact dynamic range onto a wall. Of course, no such projector exists.

So your camera is bending the scene values it has captured from the sensor, and also likely applying some other aesthetic twists. Normally, for a “Hey that’s a nice photo!” everything is great. For compositing CGI however, it’s nothing but problems as the photo and the CGI components are warped entirely differently. To do things “properly”, the entirety of the warping stack would need to be undone and aligned to a single ground truth.

So how to take a random photo or video found somewhere and merge CGI into it? You can’t! Not without massaging and guessing and other estimates. Even after all of that, you can’t do it ideally, and still will end up with suboptimal results.

If you have access to the camera raw encoded file, it’s quite easy.

The best you can do is to pretend the image is encoded a certain way that it is not, and use that cheated hack to fudge the values. At 8 bit per channel however, you’ll also likely face other issues.

Leaving it at that until more information is available. For those who haven’t read it, Paul Chamber’s has an excellent series of blog posts that dives into the nuances of compositing CGI elements into a captured shot that are well worth reading. Everything from proximity lighting to understanding how some consumer cameras encode the scene. Great series.

So If I can use the raw file of the image is possible to get better results?

Much better results, yes.

By the way, this is also part of the reason why the OpenEXR (and MultiLayer OpenEXR) file formats were invented: to capture data, exactly, with none of the “manipulation” that is ordinarily applied to “an image file.”

Remember that “an image file” is designed to make life very easy for cheap display hardware. It has gamma-encoding and lots of other things. Plus, it’s sandwiched into a particular numeric range. Because it’s meant to be displayed. Per contra, the EXR file format is designed to capture a numeric data-set. Every floating-point number that the renderer produced, exactly as the renderer produced it. (Think of it as “a renderer’s RAW file …”)