Is there a way to make an HDRI light setup not cast shadow? I Want to light my scene with an HDRI, but control the shadow with an normal lamp.
2 pass rendering (render layers) and compositing do the trick.
A few caveats:
- it involves manual steps (see below)
- as commented by @jaroslav-jerryno-novotny (thx), this method produces only black and white shadows where true environment lighting produces colored shadows.
- it requires to carefully match the orientation of the environment lighting with the lamps to avoid producing an image that would otherwise look fake
In this example, I changed the light orientation to create a lamp shadow obviously different from the original Environment Lighting one.
- First render layer, Environment Lighting only, no shadows:
- disable all shadows from all objects (Object/Cycles Settings)
- disable all lamps from rendering (outliner/Restrict Rendering)
- enable environment lighting (Properties/world tab)
- Second render layer, no Environment lighting, lamps only, shadow pass:
- disable environment lighting (Properties/World Tab, delete world or black background)
- enable all your lamps (outliner/Restrict Rendering)
- enable transparency in the Render/Film tab
- enable shadows for all objects (Object/Cycles Settings)
- enable Shadow pass (Properties/Render Layers/Passes/Shadow)
- In composite, use the first render and mix in the Shadow pass result of the second render layer (multiply or any other suitable method).
Note that the lamp shadow overlay factor here is controlled by the alpha channel of the second pass.
Let me know if you need me to flesh out the setup.
Sadly you cannot turn off shadows for emissive material or the world background.
You can control the shadows of any object in that objetc's shaders using the Light path Shadow ray input or by unchecking the Shadow option under Ray visibility in Object panel, but that reacts to all light sources.
The only solution is to use Light primitives, for which you can turn shadows on/off. If you create a big dense icosphere and you put a point-light in every vertex, you get a sky dome with even light distribution.
Using python you can access the HDRI texture pixels and drive every light's strength and color to match a point on the texture accordingly. How the pixel array works is explained here and figuring the math of turning a point on a dome into 2D point on texture is a matter of some trigonometry. You can use a script to be run once and set this for all the dome lights.
You can also add drivers to link and multiply the strength of those lights with some Scene property for better control. How to create drivers with python script is here.
If you are making some sort of vector image, like a logo, you could use the Ambient Occlusion. Turn Faction to 1. Distance: 0
This will brighten your scene.