5
$\begingroup$

I have cubes on a glossy plane so they reflect on that plane. Is there a way to only render the reflection of the cube without rendering the plane itself? So I can get my cubes + the reflection with alpha? I want to be able to put the cubes on different pictures in photoshop and have the matching reflection. I'm using cycles Thank you in advance.

$\endgroup$
7
$\begingroup$

A bit late, but this can be done with two render layers.

Put the objects that are to be reflected on one layer and the mirror on another layer, and make sure that the camera and any light sources are visible on both those layers. Under Relations in the Object tab, make sure both layers are selected (hold Shift while clicking LMB to select more than one).

enter image description here

Go to Render Layers and add one render layer. Under Scene select the two layers on which your objects are. On the first render layer, make sure only the layer containing the objects that are to be reflected is selected. Leave everything else unchanged.

enter image description here

On the second render layer, make sure only the layer containing the mirror is selected, and under Passes make sure only Glossy: Indirect is selected.

enter image description here

Now go to the compositor. Make sure you're on the Compositing tab and have enabled Use Nodes. One input and one output node should already be there. Leave those alone for now. Add another one one, Render Layers (ShiftA > I > R or Add > Input > Render Layers) and select the render layer containing your mirror. It should only have a single output socket, Glossy Indirect.

Add a Math node (ShiftA > N > M) and set it to Greater Than. Connect the Glossy Indirect to the upper input socket of the math node. This checks if the intensity of the colour is greater than the value specified in the lower input of the math node. Anything greater than this will be set to 1 and anything equal to or less than this will be set to 0. This output will be a mask, and the value you specify is the threshold at which to mask. Connect that to a Blur node (ShiftA > F > L). I'm using Gaussian and enabled the Bokeh option, but the exact settings are a matter of taste. I found that I liked this best, but you may prefer something different.

Add a Set Alpha node and connect the output from the blur node to the Alpha input and the Glossy Indirect output from the Render Layers node to the Image input.

Add an Alpha Over node, and connect the Image output from the first render layer to the upper input and the output from the Set Alpha to the lower input, the the output from the Alpha Over to the Image input of the Composite node that should already be there. Make sure Use Alpha is enabled.

enter image description here

I used a slight roughness on the glossy shader for the mirror, and this makes the reflections a bit blurry. This will cause some parts of the reflection to have very low intensity, but still greater than 0, which can make it appear as if the mirror is showing although there are no reflections (i.e. black edges around the reflections). The threshold (the value in the Math node) controls how much of these will be visible. The blur node blurs the mask slightly, to get the reflections to blend better with a background image. If your mirror's roughness is set to 0.000, you may get good results with a threshold of 0 and no blur node.

Since this uses the fact that reflections are indirect light, it will not work as expected if the objects whose reflections you want to see emit light. And using Glossy: Direct instead, will also make the reflections of the environment visible. Remedying that will be a bit more complicated. If needed, I'll look into that too, but for now, this is what I have.

The result...

enter image description here

And the .blend I've used in this example.

The PBR Dielectric node group used in the included .blend was taken from
How to Make Photorealistic PBR Materials - Part 1 courtesy of Andrew Price.

$\endgroup$
  • $\begingroup$ It's never to late! Thank you very much for your help! $\endgroup$ – Mining_Pickaxe Mar 16 '17 at 15:25
0
$\begingroup$

Not easily, at least not that I know of.

The reflection of the cubes is not a thing in and of itself that can be separated from the surface of the plane. Rather, it is just some of the light bouncing off the plane's surface.

Really, you are saying that you only want to render part of the surface, and not another.

You might be able to do it using a mask. You would assign a blank black texture to the plane, and then use texture paint from your camera view to paint white around where the reflection appears on the plane. You would then use that mask as the factor input to a mix between Gloss and Transparent shaders. End result would be to make the painted white bit (i.e. where the reflection lies when looking through your camera) glossy, and the black bit (i.e. the rest of plane) transparent.

It is a very manual solution, and painting the plane exactly would probably be difficult.

In honesty, it would be quicker to render your image with a transparent background, and then use Photoshop to "cut out" the cube and its reflection, discarding the rest of the plane.

$\endgroup$
-1
$\begingroup$

You can accomplish that with material nodes, playing and understanding the Light Path node. The documentation is https://www.blender.org/manual/render/cycles/settings/light_paths.html
you may also find many tutorials on youtube regarding the light path node.

$\endgroup$
  • $\begingroup$ I could be wrong, but I dont think you can do what the Op is asking with the Light Path node. $\endgroup$ – Lewis Oct 30 '16 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.