7
$\begingroup$

I am rendering a transparent material with a lot of inter-refractions, which works pretty fine. I now want to add some raytraced mirror to the same object but I am only interested in the mirroring of the surface - no refracted rays should be considered by mirror shader, since this is rather expensive.

How can I render twice, one time only with refrection and another time only with mirror and blend the renderings to get a final result?

I already tried something with with RenderLayers but I can't see any option to set a specific material for a specific mesh in a specific RenderLayer.

$\endgroup$
  • $\begingroup$ Is it just an object? If so, you can clone it, and put it in another layer to make a separate renderlayer to mix in the compositor. If this solution fits your problem, I can make a detailed answer. $\endgroup$ – DavidGasku Aug 25 '14 at 13:17
  • $\begingroup$ It is one single object yes. I tried something similar as you describe it but I ended up with a lot of artifacts in my image because both copies of the object were rendered. $\endgroup$ – Machtl Aug 25 '14 at 14:28
  • $\begingroup$ @Machtl Could this be what you want? pasteall.org/pic/75990 $\endgroup$ – someonewithpc Aug 25 '14 at 17:49
  • $\begingroup$ Unfortunately I need a solution for Blender-Internal renderer as you can see in the tags. $\endgroup$ – Machtl Aug 25 '14 at 18:13
  • $\begingroup$ I've been playing with this a bit but I can't seem to find a solution.. It might not be possible with BI renderlayers (It is possible with cycles renderlayers though..). Would it be too much of a pain to use separate scenes? I think that's the answer here. $\endgroup$ – gandalf3 Aug 27 '14 at 17:48
8
$\begingroup$

You can use multiple scenes:

  1. Add a new scene by pressing the + at the top of the screen and selecting Link Objects:

    enter image description here

    This will link the objects into a new scene. This way modifying an object will change it in both scenes.

  2. In the new scene, select the refractive object and pres U> Object. Now the refractive object in the new scene is no longer linked to the refractive object in the old scene, but the object data is still linked.

    This mostly means that changes to the object transforms will not be copied between scenes, but changes to object data like materials and UV maps etc. will.

  3. Still in the new scene, set the material to be stored in the object, not the object data:

    enter image description here

    Since the object is local to each scene, by setting the material to be stored in the object, we can now set the material individually for both scenes.

    Remove the refractive material and add the reflective material. I made the reflective material slightly transparent with mask transparency so that it doesn't completely replace the refractive image they are combined, but you can do this in compositing too.

  4. Still in the new scene, set the alpha to Transparent in Render settings > Shading, so the the sky is rendered as transparent alpha:

    enter image description here

    You only need to do this for the new scene.

  5. In the old scene, add some composite nodes to combine the results of both scenes:

    enter image description here

    It doesn't really matter which scene you put the composite nodes in, but I like to keep everything in the "base" or "bottom" scene on top of which everything is overlaid. Just remember to render from the scene with the composite nodes.

  6. Render. Both scenes should automatically render and combine.

enter image description here

Example .blend

| improve this answer | |
$\endgroup$
4
$\begingroup$

While you can't specify a material per object on each render layer you can get the same object rendered with two materials using render layers - this applies to both BI and Cycles. Render layers have a material override that applies to every object in that render layer, if only one object uses that layer then it is the only one that gets that material, you can create more than one render layer that uses the same scene layers but have different material overrides.

  • You want the target object to be visible on a layer by itself.
  • Create one render layer that renders only the target object's scene layer, set the layer material to use the first material.
  • Create another render layer for the same scene layer and set the layer material to the second material.
  • Create a third layer for the rest of the objects in the scene.

Composite the two object layers as desired and then composite over the background layer to get the final image.

Here I have one cube in a corner, one layer uses a plain blue material, one layer uses a red material with mirror at 0.4 and the third layer has the green walls that mix into the mirror of the red material. The cube is on scene layer one and the walls are on scene layer 2.

enter image description here

| improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ I also considered this, but refractions/reflections need something that can get refracted/reflected - there for not an option. $\endgroup$ – Machtl Aug 30 '14 at 6:29

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.