Camera mapping (1.30)

Forum for OctaneRender Lua scripting examples, discussion and support.
User avatar
roeland
OctaneRender Team
Posts: 1823
Joined: Wed Mar 09, 2011 10:09 pm

This script approximately maps a texture so it fits into the camera view. Note this does not take things like distortion and depth of field into account.

Updated for versions 2.26 and 3.01:
camera map.lua
(3.9 KiB) Downloaded 709 times
Additional features:
  • the script also works for orthographic and spherical cameras (for cylindrical cameras it's not possible to correctly map the texture).
  • You can camera map the environment texture by selecting the texture environment node (although it will look weird if you have reflections of the environment in your scene).
Note that

--
Roeland
r-username
Licensed Customer
Posts: 217
Joined: Thu Nov 24, 2011 3:39 pm

love this script

Is there any way to repeat the script on a folder of png files so we can have camera/projection mapped animation? I think I can do this in the blender plugin but checking if there is an easy way to do this in the standalone.

cheers,
S
i7 960 - W7x64 - 12 GB - 2x GTX 780ti
http://www.startsimple.com/ - http://www.gigavr.com/
jitendra
Licensed Customer
Posts: 143
Joined: Sat Oct 16, 2010 6:09 am

roeland wrote:Since we changed the texture projections for version 1.30 I updated this script. The UV transform doesn't need the (.5, .5) offset anymore, and the width given for the scale is the full width, not the half width.
camera map 1.30.lua
Additional features:
  • the script also works for orthographic and spherical cameras (for cylindrical cameras it's not possible to correctly map the texture).
  • You can camera map the environment texture by selecting the texture environment node (although it will look weird if you have reflections of the environment in your scene).
--
Roeland
Thank you Roeland,
Works like a charm.
Best Regards, JITENDRA
Best Regards, Jitendra
leehenshall
Licensed Customer
Posts: 184
Joined: Sun Oct 25, 2015 5:44 pm
Location: England
Contact:

Great script! I can't seem to get it working with Octane 3.0. Can someone modify the script to make it compatible?
User avatar
roeland
OctaneRender Team
Posts: 1823
Joined: Wed Mar 09, 2011 10:09 pm

The change to the resolution node in the render target broke quite some scripts.

When you get a complaint about a missing pin called octane.P_RESOLUTION, you can change:

Code: Select all

local resolution = rendertarget:getPinValue(octane.P_RESOLUTION)
to:

Code: Select all

local resolution = rendertarget:getInputNode(octane.P_FILM_SETTINGS):getPinValue(octane.P_RESOLUTION)
--
Roeland
calus
Licensed Customer
Posts: 1308
Joined: Sat May 22, 2010 9:31 am
Location: Paris

Thanks for the update an the Tip :)
Pascal ANDRE
leehenshall
Licensed Customer
Posts: 184
Joined: Sun Oct 25, 2015 5:44 pm
Location: England
Contact:

Thanks roeland.

I did a find and replace using notepad++ then restarted Octane and attempted to run the script with the image texture selected and still getting an error in Octane 3.

See attached image:
Attachments
scipt_error.JPG
leehenshall
Licensed Customer
Posts: 184
Joined: Sun Oct 25, 2015 5:44 pm
Location: England
Contact:

Opps! sorry my mistake the fix does work. I just didn't have my render target selected/activated.

Thanks for the quick turn around roeland :)
manalokos
Licensed Customer
Posts: 441
Joined: Fri Nov 18, 2011 4:43 pm

The script is broken on V3.0, it cannot access P_RESOLUTION, and I don't know the syntax to fix it.
Can anyone help?

Thanks
Kind regards
Filipe
Post Reply

Return to “Lua Scripting”