Page 1 of 1

Specify which camera is used for Camera Mapping?

Posted: Fri Sep 20, 2019 1:11 pm
by artbydile
Hey, just wondering if I'm missing something probably incredibly basic...

In C4D the camera mapping option allows you to specify WHICH camera is used to map a picture to an object. Further down the line this allows me to specify another camera to render or bake said texture out on the UV or animate a different camera without altering the projection coordinates.

I THINK I saw something a while ago on this when the camera mapping option was added to the texture node, but I cannot find it. Am I just missing something? Thanks in advance guys!

Re: Specify which camera is used for Camera Mapping?

Posted: Wed Oct 02, 2019 8:43 am
by linograndiotoy
artbydile wrote:Hey, just wondering if I'm missing something probably incredibly basic...

In C4D the camera mapping option allows you to specify WHICH camera is used to map a picture to an object. Further down the line this allows me to specify another camera to render or bake said texture out on the UV or animate a different camera without altering the projection coordinates.

I THINK I saw something a while ago on this when the camera mapping option was added to the texture node, but I cannot find it. Am I just missing something? Thanks in advance guys!
We still need to implement the possibility of specifing a camera for the mapping. In Octane for Blender 2.8 we'll be able to use the Camera info node, and that should help.

The best way to get camera mapping right now is to use an OSL shader. You can "copy" the scripts from here:

viewtopic.php?f=21&t=65575


This one can be used in an OSL projection node, it works great:

shader CameraMap_geo(
output point uvw = 0)
{
vector p = transform("camera", P);
float fov;
int res[2];
getattribute("camera:fov", fov);
getattribute("camera:resolution", res);
uvw[0] = 0.5 - 0.5 * p[0] / p[2] / tan(fov / 2) ;
uvw[1] = 0.5 - 0.5 * p[1] / p[2] / tan(fov / 2) * res[0] / res[1];
}


I hope this helps.
CameraMapping.JPG

Re: Specify which camera is used for Camera Mapping?

Posted: Fri Oct 04, 2019 10:15 pm
by artbydile
Thank you lino! Will try this out asap!