Page 1 of 1

VisibleBackground scripted graph

PostPosted: Sun Oct 29, 2017 11:20 pm
by bepeg4d
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 261 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.

Re: VisibleBackground scripted graph

PostPosted: Thu Nov 23, 2017 12:15 am
by Notiusweb
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!