controlling amb color by a spotlight


I’m trying to figure out a way to have a texture map self-illuminate whereever a light source is NOT hitting the texture in a scene. It’d be like having a spotlight shine on a large plane (plane being much larger than the cone of the spotlight). Where ever the light was NOT hitting the surface, the texture would be self illuminating (ambient color turned up).

I’m trying to figure out how to tie the ambient color of a texture to a light, evaluating where the light is not hitting the texture. Anyone have any ideas on how to accomplish something like this?


the surface luminance node under utilities in the hypershade will output the amount of light hitting a surface at a given pixel. So plug this into a ramp texture’s v value (black at top, white at bottom) and feed that into your materials ambient color.


Thats a great technique :slight_smile: I’m stuck on one problem with it though. I don’t want any illumination (or visible color btw) where the light IS hitting the texture. I figured the easy way t odo this would be to set the texture’s diffuse to 0, so that it only self illuminates. Well, it only works reliabily when the total light hitting the surface doesn’t exceed 1. When it goes over 1, you get wierd hot spots which I can’t get rid of.

As an example, I created a plane and give it a default white lambert. The I created a spot light and pointed it down towards the center of the plane. Then I open up the lambert in hypershade, and created the ramp and luminance nodes as you suggested. I tied the outcolor of the ramp into the ambient color of the lambert, and turned the diffuse down to zero.

So it works great, the desired effect is achieved. But here’s the problem. Suppose I go over and change the light’s intensity to say 1.5. All of a sudden I get this wierd hot spot at the center of my ‘dark region’. yuck

This is problematic because It’s really hard to avoid situations in scenes when a surface gets more light than 1. Do you know of a way around this problem so I can still get the desired effect (without the hotspots) with scenes that have a total light value of greater than 1?

Thanks for your thoughts btw, very helpful!


No problem.

Instead of connecting the Surf. Luminance node directly into the ramp, first put it through a Set Range Node. (also found under utilities)

Connect the Out Value of the Surf. Luminance node to the ValueX of the SetRange node

and connect the OutValueX from the SetRange node to the VCoord of the ramp texture.

Then open the setRange node in the Attribute Editor and set Max X Attrubute (first column) to 1.000 and set the oldMax X Attribute to whatever maximum light output you’re expecting like say 2 or 3. You can tweak this number for varied results to your liking and this will get rid of your hotspots.


Very cool! Thanks for posting these solutions jadamburke!


It seems like you already have a sound fix for your probelm. My aproach would be to use a ramp SHADER. Make sure that you have it set to Brightness, not light angle.

Connect your regular material into the ramp, and connect a darker “Ambient material” to the ramp. Play with the values and you should have exactly what you are looking for. The second “ambient color” will only become visible where the light intensity is low.

Mike R


that sounds like an interesting idea Rhonedog, thanks for posting it :slight_smile: I’ll give it a try to, I’m all for having multiple ways of doing something and this is great hypershade practice.

Thanks for posting :beer:


This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.