I am using Octane for Blender and I am trying to solve the following problem:
In Blender I need a backplate image (a jpg, not an environment image) in the Octane preview in the viewport to exactly match the Blender render border while in active camera view (numpad 0). In Blender Cycles you can simply do this by using window coordinates from the the texture coordinate node, using those to display an image in the world nodes (so without any object). But in Octane I could not find any other way to do that then using OSL. I adapted the example script from the beginning of the thread a little and came up with the following:
output point uvw = 0)
vector p = transform("camera", I);
uvw = 0.5 + 0.5 * p / p / tan(fov / 2) * 2160 / 3840;
uvw = 0.5 - 0.5 * p / p / tan(fov / 2) ;
This gets the aspect correct for a 4k image (due to the 2160/3840 value) disregarding the aspect of the viewport. However, this backplate setup does not zoom in/out when manually zooming in/out in the viewport. What would need to be changed/added in the OSL script to make this work? Or is there a simpler way to get a backplate in the world/environment nodes in Octane?