My question is, how would I make the visible HDRI/Enviroment Map be image 1 and then have reflections as Image 2? If someone can post a node setup, or a .py file that would be great <3 I was thinking maybe using the Is Camera Ray node but I'm not confident it would work, and have no idea where to start.
2 Answers
A simple solution with no compositing, is to have two images as the background material for your environment texture. You mix them using a color mix node controlled by Is glossy Ray in the light path node. The glossy surfaces reflect one image, while others use the other HDRI image normally:
Alternatively, you can use Is Camera Ray to can have the one image not interact the objects at all but stay as backdrop for the scene:
Update for 2.8
In the shader editor, set to edit the world.
-
$\begingroup$ Thank you, this is exactly what I was looking for, a simple solution. My personal usage for this is to loose the ugly black horizon I have on my HDRIs (I do this to stop light from emiting below the object), replacing it with a mirrored version o the top portion of the HDRI. $\endgroup$ Commented Mar 25, 2016 at 12:01
When you are dealing with multiple environments, the best way is to set up separate Scenes and composite them together. The compositing setup is a simple Alpha Over node.
Scene Setup
Create your "Main Scene". Place your Objects, Camera, and create a World which uses an Environment texture of the HDRi Map you want to use for your reflections.
Node setup for a World that uses an Environment Map:
For this example I'm using freely available HDRi environments from The sIBL Archive.
In your Main Scene only, set Film to "Transparent". This is what will allow you to easily composite using Alpha Over.
Next create a new Scene with the same camera settings and render settings. When creating your new Scene, you can choose to Copy Settings and then it's just a matter of changing Camera, World, and some render settings.
It may help to stay organized by labeling your "Main Scene" which will receive reflections and your "Background Scene" which will have only its environment used.
Give your "Background Scene" a new World with the Environment Map you want to show up as the background.
Your Background Scene's sample count for rendering can be set rather low (about 20) because the rays from the environment won't bounce - they will go straight to the Camera. You can save yourself some render time and drop that down.
Camera and Render Settings
Optional: In your Background Scene you can have your Camera use the same settings as the Camera of your Main Scene. This way if you change the settings later they will still match. Just change the datablock to match that of the Camera of your Main Scene (its name is probably "Camera").
Optional: You can also drop a Copy Transforms Constraint on the Camera of your Background Scene so that if the Camera of your Main Scene is animated it will follow along.
Unfortunately, render settings are specific to each Scene, so they cannot be linked. You should verify that these match in both Scenes:
- Resolution
- Frame Range
- Aspect Ratio
- Frame Rate
- Time Remapping
Compositing
In your Main Scene create this compositing node setup:
You can Duplicate the Render Layers Node to get a second one (ShiftD). In one of them change the Scene source to your "Background Scene".
Add an Alpha Over Node (ShiftA and search for it or go to Color > Alpha Over). Pay attention to which Scene is connected to which socket. The "Background Scene" output should be connected to the upper input of the Alpha Over Node, and the "Main Scene" output should be connected to the lower one.
That's it! Render and save your result.
Below is a link to an example .blend, however due to the large file size of environment maps I did not pack the textures. You can use your own or download some from The sIBL Archive.