VisibleBackground scripted graph

Forums: VisibleBackground scripted graph
Forum for OctaneRender Lua scripting examples, discussion and support.

VisibleBackground scripted graph

Postby bepeg4d » Sun Oct 29, 2017 11:20 pm

bepeg4d Sun Oct 29, 2017 11:20 pm
Hi,
starting from this discussion, and from this other Lua script by roeland, I have prepared a Lua scripted graph node for automatically adapting an image assigned to a Visible Environment node to be displayed like a Background image.
Let’s take this example scene:
SA-VisibleBackground_a.jpg

If the Background option is used, it is necessary to enable the Alpha channel option in the Kernel settings, but the Background image is not taken into consideration in reflection and refraction:
SA-VisibleBackground_b.jpg

With the VisibleBackground Lua scripted graph node, you need to assign a reference camera (by copy pasting the camera node, or connecting the camera expanded from the Render Target), and the image to be displayed as RGB Image texture node. In this way, the projection and uv transform node of the image will be adapted to perfectly feat to the frame buffer, taking count of the camera FOV and Shift value:
Screen Shot 2017-10-29 at 23.31.37.jpg

It is possible to enable/disable backplate, reflection, refractions:
Image
And change the border mode, in order to have different reflections/refractions based on the color repeated in all directions in the Visible Environment node:
Image
When connect to the Visible Environment, and the Film settings pins of the Render Target, the Resolution is set equal to the image dimensions, and it is possible to use the Zoom factor to correct the final resolution,
Load this .lua file in a Scripted graph node in your scene:
VisibleBackground_03.lua
(6.43 KiB) Downloaded 197 times

At the following link you can find the corresponding Xpresso version for c4doctane:
viewtopic.php?f=87&t=63808
Happy Rendering,
ciao beppe

p.s. thanks to Luca-GIOLET for supporting and example scenes.
User avatar
bepeg4d
Octane Guru
Octane Guru
 
Posts: 6766
Joined: Wed Jun 02, 2010 6:02 am
Location: Italy

Re: VisibleBackground scripted graph

Postby Notiusweb » Thu Nov 23, 2017 12:15 am

Notiusweb Thu Nov 23, 2017 12:15 am
Love Love Love Love LOVE This!

Here is a tip - if the image plane rotation angle gets knocked out of whack by you rotating around the geometry in the viewport, you can adjust the "Zoom Factor %" slider back and forth in the Film Settings Node to reset it, so that the perspective of the background image is correct again!
Win 10 Pro 64, Xeon E5-2687W v2 (8x 3.40GHz), G.Skill 64 GB DDR3-2400, ASRock X79 Extreme 11
Mobo: 1 Titan Xp, 1 Titan X Pascal
External: 6 Titan X Pascal - 1600W EVGA T2
Plugs: 3DSMax, C4D, Daz, Houdini, Lightwave, Sketchup
User avatar
Notiusweb
Licensed Customer
Licensed Customer
 
Posts: 1185
Joined: Mon Nov 10, 2014 4:51 am

Return to Lua Scripting


Who is online

Users browsing this forum: No registered users and 1 guest

Sun Dec 15, 2019 8:35 pm [ UTC ]