Camera projection for matte painting

Hello!
I don’t know if it’s the right place but here I go ^^ :
I was searching for ways to project an image from a camera on a geo without dealing with uvs and i didn’t find one. There is the uvproject modifier and correct me if I’m wrong, it means that I will have all my shading nodes in the node editor and my projections on the modifier stack ?
i would like to deal with every single aspect of my shader in one single place !!!

The behaviour that I’m looking for is like using the “window” output of the texture coordinate but with a different camera from the view camera, plugged into the vector input of a texture.

I don’t know what would be easier : adding a “camera” option in the image texture node’s projection slot so you will have : tube, sphere, box, flat and camera. Or the possibility to specified a different camera in the texture coordinate node.

Perhaps you’ll have a solution or it will be feature request :slight_smile: .
I’m a matte painter in a company doing animated feature film and my day to day job is projecting texture on low resolution geometry, I would like to build an open source pipeline at home but natron don’t have a 3D viewport so blender is my only hope for matte painting… :wink:
I think that unlocking matte painting in blender would be awesome mostly with grease pencil.

sorry for the long post !!

1 Like

Hello ! going back to the subject.
I totally forgot to mention another point to why I didn’t wanted to use the uvproject modifier ( can be super handy in some cases) :
if i want the same result between the “window” output way and the uvproject way i’m forced to subdivide my mesh to prevent any stretching. So i’m going from a pretty light scene to an heavy scene ( if I have a lot of objects ) and it’s not really the point.

I tried to look at the code to see if I could do something on my side but I’m really a newbie in coding, i can understand python stuff but C it way over my head ! I guess it’s in svm_tex_coord.h and looking at the “case NODE_TEXCO_CAMERA:” compared to the “case NODE_TEXCO_WINDOW:” , figuring that the sd->object is a perspective camera and using the data of this camera but it’s sadly way too complicated for me …

thanks for reading !
have a nice day !

No, from what i know there is currently no way to project a texture to a plane without a uv map. I dont see a problem in that since its just a subdivided plane and you can even use a modifier to control the subdivs. I guess you already know that project from camera view thing and thats the workflow for it.

Matte Painting is an underdeveloped workflow in blender but you can make it work.

thanks for the response !
the plane was just for the sake of clarity but in production you don’t deal with just a plane. you’ll have multiple geo for your matte and a LOT ^^ of geos for your foreground with your environment and characters which will be subdivided too, so the matte painting needs to stay as low as it can be.

1 Like

I don’t have any experience in the code for that matter to help you there but you could try to ask this in one of the blender today livestreams and get an answer from the developer of blender.

1 Like

Hey, I’m not sure I’m understanding exactly what you’re looking for, but I was intrigued anyway. So here I go.

If I’m understanding correctly, you want to project your texture using central projection, that is independent from your current viewpoint, but controlled by a camera (or empty). Like this:


In that case, here is way to set it up with the shader nodes in the material of the plane:


For this setup I created a new camera called ‘Projection_Camera’ that is used as projection origin, by taking the ‘Object’ coordinates from the Texture Coordinate node and specifying the ‘Projection_Camera’ in the object slot.
To actually create the effect of the ‘Window’ projection, we need to use distance from our projection centre (in the direction we are projecting it, so the Z-direction of our object) to drive the scale of the projected texture, so that the further away the geometry is, the bigger the texture becomes.
That is, what the two math nodes set to divide are doing.

As a sidenote: You don’t have to use a camera as a projection centre. It could be an empty or even an object. The good thing about using a camera though, is that you can easily switch to the point of view of your projection to confirm it actually works the way it’s supposed to.

I hope this is somewhat helpful.

1 Like

Hello !
thanks for taking the time to look at it ! I’ve tried your settup it works for a brick texture but it doesn’t with a file texture ( or i’m missing something).
To be simple : In a matte painting workflow most of the time you receive a shot camera, you duplicate it and freeze it at a certain frame ( the one which cover the most of the shot with the least amount of distortion ), render the frame, repaint and reproject with this camera on a simple 3D geometry or your full 3D environment (depending on the production), and you can continue with another camera, …
So you can have multiple projection camera with different focal length, different aspect ratio, for a single shot.
I need the camera to be sure my painting match the plate.
I don’t no if i’m clear ^^

Ah, I see. Just looked at some videos about matte painting. Having a background in architecture I actually wasn’t very familiar with that kind of workflow and don’t think I fully understand all the intricacies.

Anyway, in principle my setup from earlier should work with image textures, though sometimes you have to tweak the mapping a bit. I extended the node tree to adjust the mapping to a given image resolution/aspect ratio as well as the cameras focal length and sensor size, to make it match the ‘Window’ projection more closely.


The setup might seem a little unwieldy, but you can collapse it nicely into a node group. :slight_smile:

Since you seem to be doing this a lot, I tried automating the input of the variables, but using drivers actually seems to be more of a hassle to set up than just inputting the values manually.

But considering the setup is not that complex and all the required data is accessible through the Python API, there should be a way to automate it using Python.

3 Likes

OMG.
That’s amazing ! it works perfectly ! thanks a lot for taking the time to do that !
matte painting is really a big part in animation and vfx production. it’s really nice to have a solution like that!
I hope it will be implemented directly in the texture coordinate node for everyone to use !

2 Likes

Native support for Camera Projection Painting WIP:
https://developer.blender.org/T81662

3 Likes