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