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
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:

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:

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:
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:
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:
(6.43 KiB) Downloaded 240 times

At the following link you can find the corresponding Xpresso version for c4doctane:
Happy Rendering,
ciao beppe

p.s. thanks to Luca-GIOLET for supporting and example scenes.
User avatar
Octane Guru
Octane Guru
Posts: 7314
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 RTX, 1 Titan Xp
External: 6 Titan X Pascal, 2 GTX Titan X
Plugs: Enterprise
User avatar
Licensed Customer
Licensed Customer
Posts: 1272
Joined: Mon Nov 10, 2014 4:51 am

Return to Lua Scripting

Who is online

Users browsing this forum: No registered users and 2 guests

Sun Jul 05, 2020 5:53 pm [ UTC ]