• About us
  • Contact Us
  • Terms and Conditions
  • Forum
  • Materials
  • Shaders
  • Tools
  • Video
  • Learn
  • Gallery
My Mental Ray

Navigation

  • Main Page
  • Cookbook

MYMR WIKI Tools

  • Creating pages
  • Markup n styles
  • Page protection
  • Help

 

Toolbox

  • Upload file
  • Special pages
  • Printable version
  • Permanent link
Article    Discussion    View source    History   
Personal tools
  • Log in / create account

Shadows only casting lights

From Wiki

Jump to: navigation , search

Shadows only casting lights in Mental Ray by Martin Bowman

This is a short but hopefully useful explanation of how to create lights that don't appear to add illumination to a scene, but do cause objects to cast shadows, a useful function when the lighting for the scene is just right, but the shadows are damaging the composition of the scene and you need them to fall in a different direction. I wrote this because I've wanted this function in MR for years (scanline has had it for ages and it's one of the few things I miss about scanline) and recently I had a moment of inspiration and worked out how to do it!

A good way to understand this process is to create a test scene - a cylinder standing on top of a large plane. Now create a camera to view the scene through, and two spotlights - one to add illumination to the scene, and one to cast shadows - make sure the shadow caster is in a different place to the illumination light, or you won't see the point to this exercise :) For the sake of making things blindingly obvious, place the shadow casting light 180 degrees opposite to the illumination light, and ensure that both lights are above the ground plane looking down at it.

On the illumination light, turn off shadows.

On the shadow casting light scroll down to the Mental Ray Light Shader rollout and click on Light Shader and choose the correct shader for the type of light you are using e.g. if your light is a spotlight, choose Light Spot (Base). Drag this shader from the light modifier panel into an empty space in the material editor as an Instance.

In the shader do the following:

Set the colour to White and add an Output map to the colour slot. Inside the output map, set output to 0.001. The reason for this is that we cannot do a true shadow casting only light (or at least I don't know how to and I can't find anything on the internet that tells me how to) without having some illumination in the scene. So by setting the Output of the light to very small levels, you will discover that a tiny amount of light is added to the scene, but it is not enough to raise a pixel above pure black in 24bit RGB 0,0,0 (in floating point, it's a two or three digit value above pure black, indistinguishable from true black in 24bit RGB).

Return to the main section of the shader

Tick the shadows option in the shader.

Click on the Shadow Transparency slot and add a Checker map. Make both slots of the checker map black (RGB 0,0,0) Place an Output map in the top slot and set its Output to -500 (a strong negative value is required). Now instance this map to the other slot of the Checker map.

Now render! The illumination light should add illumination to the scene while the shadow caster makes the shadows travel in a different direction. If you wish to make the shadows less dense, reduce the -500 value to a lower figure. You can also change the shader colour to something darker than white if you really need to reduce the amount of illumination being added by the light, but if doing so please remember to use even higher negative Output values than -500, try -750 or -1000 because otherwise the shadows will become very pale and possibly invisible.

--Moid 15:44, 20 October 2007 (PDT)

Retrieved from "http://mymentalray.com/wiki/index.php/Shadows_only_casting_lights"
Copyright © 2008 My Mental Ray Community. All Rights Reserved.
No part of this website may be reproduced unless for personal use without prior written permission from The My Mental Ray Community.