Colored shadows
Closed, ArchivedPublic

Description

This patch provides a control for changing the color (and thereby the intensity) of cast shadows, on a per-lamp basis. This is useful for trick effects (weird club lighting), as well as subtle shading in scenes (cooling or warming shadows).

The main use, though, is in changing shadow color to shades of gray, which has the effect of lowering shadow intensity without altering the overall energy of the lamp. Many times in my own lighting rigs, I am happy with the quality of lighting but find that shadows are too dark. Setting shadow color to, say RGB (.5, .5, .5) has the effect of cutting shadow density in half without having to add additional light sources that could effect your overall scheme. This has cut some of my lighting rigs in half, as I no longer have to have two-lamp clusters for every light source (one for lighting energy and one set to Only Shadow for shadow intensity). Setting shadow color to white RGB (1,1,1) causes the shadow to effectively disappear, as though shadows were not enabled.

The colored shadowing technique plays nice with all of Blender's shadowing types (ray, buff-halfway, buff-irregular), lamp types (spot, sun, area, point), ray options (soft shadow, area lamp with samples), and transparency (irregular buff alpha and ray transp + filter). It also works for Only Shadow, and processes into passes correctly as demonstrated in the provided test .BLEND files.

One other fun feature is the TEX button beside the color swatch, which causes the lamp texture to affect the shadow as well (it normally does not). The effect produced is one that has the lamp's texture seem to "pass through" the object and integrate with the shadow for special effects.

Attached is the patch against current trunk, plus four simple .BLEND files that show the integration.

Details

Type
Patch

Awesome, Ive being wanting this for so long, sometimes the least you want is to make your node setup more complicated just for adding colors to shadows!

Hey, I had a quick look at the code, and the pictures seem pretty nice!

I'm not so keen on the 'Tex' button though, it seems like really 'bolted on' and to be adding on another layer of complexity to the workflow, rather than fitting in the existing texture system.

What I think would be much better (perhaps more difficult to implement, but much better in terms of design) would be to make 'Shadow' an option in the lamp texture's Map To panel. Currently there is only 'Col'. What this would mean is that it would be easy to set up to do the same thing as this patch - just click both 'Col' and 'Shadow' in the texture - but also would give a lot more flexibility, allowing other combinations such as different textures on light and shadow , or flat colour light with textured shadow. The latter combination would allow using a fake 'caustic map' [1] very easily, that just gets projected into the shadows but not in the actual lighting.

Anyway, if that's going to be too difficult, then it'd be cool to make a stage 1 patch with just the shadow colour without texturing options, and work on that later. I really think integrating it with the texture system is the correct solution here.

cheers

[1] http://www.lysator.liu.se/~kand/caustics/

Agreed. That would be significantly more powerful and fit better with the existing texturing paradigm. I'll see if I can't roll that in tomorrow.

Yikes, I just re-read my second sentence. I should remember not to write things first thing in the morning without coffee. Looking forward to the next iteration!

Cool! Sounds really useful.

Joe

Okay. Updated everything so the texturing option is now in the texture buttons. You can enabled/disable shadow texturing per item in the texture stack, meaning that you can, for example, have a lamp with a nice "causticy" texture that is mapped only to a colored shadow in Add mode, creating a fake caustic (if you place it nicely with tex coords from an Empty). I'm sure there are other ways to use this as well that creative artists will discover.

While I was in there, I fixed a minor shenanigans with Lamp Color flags being misused within material textures.

We should see if we can get Andy G to take a build for a test drive too, as his input on lighting issues will be valuable.

Howdy Ton -- updated patch to work with current svn (8/13/08). I know you're at SIGGRAPH, so this will be a "nice" present for when you get back.

I've made a page, linked below, with technical information and demonstrations as well as artists' info, etc., to make review of this patch as easy as possible. Also, I've linked to the ba.org thread where people have been barking about it.

http://www.harkyman.com/2008/08/06/controllable-shadow-intensity-and-color/

http://blenderartists.org/forum/showthread.php?t=132325

Excellent, thanks for updating, this is great functionallity

In svn, thanks for the work and convincing doc Roland! :)

Ton Roosendaal (ton) closed this task as Archived.Sep 19 2008, 6:01 PM