Rendering Background image in Cycles

I have Background image (not World texture) set in viewport. How to render the scene together with it? Moreover, there is a glass detail in the scene and the image should be seen through the detail on render. Is there any chance to do it? Thanks alot in advance

Attach the texture to world shader and set its texture coordinate input to screen using the texture coordinates node. It will then show the image in screen space similar to viewport background.

Thank you. I however would like to avoid attaching the picture to World in any way. The matter is, in this case it will inevitably influence lighting settings. I set my scene up with this background and some certain world settings so don’t want to change it. I thought that I could render it, but it turned out background image can’t be rendered. It’s a pity that Blender can’t do it, in Luxrender that can be done easily.

It’s not as inevitable as you might think…
Use a Light Path > Is Camera Ray node and it will only be visible to the camera, but invisible to all other ray types (and hence will not light anything). If you also need to see it through refraction, combine Is Camera Ray and Is Transmission Ray.

Thank you IkariShinji. Did you mean such node settings? But I can’t figure out how to combine Is Camera Ray and Is Transmission Ray. Could you please explain a bit more in details?

Attachments


Unless I misunderstood the question, I was wondering the same thing yesterday and found a way that appears even easier.

Simply create the world shader the way you want it, and then under Ray Visibility you can tick Camera, Diffuse, Glossy, Transmission and Volume scatter.
stc=1
I think if you deselect diffuse and leave transmission on, you should have what you want.
In my example below the Susanne on the left is a glass material and on the right is glossy. The cube is only diffuse and does not pick up any environment light except for the 1 lamp I had in the scene.

stc=1

Attachments


Thank you all guys. I’ve set up the complete node tree in accordance to your description. But, absolutely honestly, the resulted picture looks the same as if I just set this image as Image texture in world, without any mixes. just Image texture>World (see 1st answer in this thread). No Mix shaders, no other inputs. Thank you anyway.