Subtract shaders?

We all know about the Add and Mix nodes - but is there a way to subtract one shader from another.

To illustrate the concept - if you mix two glossy shaders with different roughness values together - you get a bright highlight where the light hits the surface - surrounded by a more diffuse highlight. This technique is used in materials such as “bloom metal”.

What I would like to do is subtract the glossy shader with the lower roughness value so that i’m left with a ring/halo shaped highlight around the light sources.

I tried using a trick I learned from the emission shader - whereby if you set the emission strength to negative, you actually emit darkness rather than light. I tried applying the same concept to a glossy shader by trying to make the glossy colour negative (figuring that of I added the two shaders together - the negative colour of one shader would cancel the positive colour of the other) - however Blender wont accept negative RGB values.

check ies lamp thread

he added like a spherical gradient on a lamp

is it what you want as a lamp trick ?

in any case only node that can add more then 1 if I remember well is the Add shader
otherwise output is limited to 1
except the emission node which is a light source !

happy bl

This application isn’t for lamps - its for glossy or anisotropic materials.

Most materials can exceed an output of 1 for RGB values - you just have to type it in. I used RGB values greater than 1 to simulate a fluorescent colour in my retroreflective tape material.

What they can’t do is use negative values (except emission).

Use a value input node or nodes with combine RGB. Blender will then have no choice but to like it. :evilgrin:
But be prepared for some unusual results.


That is exactly the effect I was after/expecting…thanks

Here is a quick test using this technique to get rainbow coloured halos around any light sources in the scene. Could be used for some interesting iridescent like effects:



1 Like

Another test - more subtle this time - incorporating it into a shiny ceramic type material with some fresnel to make the colours stronger at glancing angles.


1 Like

Another interesting effect that I hadn’t considered - and could actually be used to replicate in cycles - the type of specular highlights you get in BI (which I know people have been asking for on other threads).

Rather than have the roughness of the negative RGB node smaller than the positive RGB node (which gives a halo type effect) - invert the roughness values - and you force the highlight to fall off quicker than it otherwise would. Examples:

This is a single glossy shader with roughness of 0.4 - lit with two mesh lights

Same scene - but mixing a negative RGB glossy node with a roughness of 0.5. You get the specular highlights from the lights - but little else.


Mixed into a suitable material - you get BI looking specular highlights in a cycles material.


Great results, thanks for sharing. I especially like the subtle ceramic one.

Another test - this time using it on glass (its a little noisy though - this took 1500 samples)


I was curious what you’d do with that. :slight_smile:

Other than highlights, with some large roughness and textures, you can get some interesting “photo-reactive” materials. That is, materials that respond to scene lights. With two or three anisotropic shaders and some voronoi or other noise, it makes odd fractal effects that respond to light.

I knew that little combine RGB trick should work as I also used it with values greater than 1 to overdrive colors. Now why would I do that? Using that along with the lightpath node allows you to amplify light instead of cast shadows. It was something I stumbled upon while trying to figure how to get Cycles glass to behave better and not absorb half the light which should be passing through it. It also means you can have lamps with shades still light a scene as they naturally should, without resorting to other measures.

Yeh - I have used RGB values greater than 1 before - to simulate emission or fluorescence (without actually emitting light). I used such an approach on my retroreflective tape material. Neon colours are difficult to get right using RGB values below 1 - but overdriving one or more colours seems to give it the required “day-glo” effect.

I also use rgb values greater than 1 when I want to boost highlights in anisotropic nodes. Again I used this approach in the carbon fibre shader I recently put up in the car paint thread.

You dont need to use the combine RGB node for values greater than 1 though. Even though the RGB sliders are limited to 1 by default - you can overtype with larger values and the slider rescales appropriately.

if it can also reduce noise from emission plane this might be interesting
you found a way to fake fluorescent lamp effect
can you show an example for this effect

thanks

Not sure what you mean - can you clarify?

post 12
to simulate emission or fluorescence (without actually emitting light).

I tried again your retro mat and cannot really make it work well !

happy bl

one sugg here
did u update the aniso in that thread of yours ?
did some test and aniso has improve a lot with new method!

i’ll do some test for fluo type this afternoon

do u know if this fallof node can be use on mat or only on light source ?

thanks

No I havent -the thread still shows the old anisotropic shader. (edit: just updated it)

No idea - haven’t tried it (yet)

As i sad in another thread, this is very ingenous!!!
Great work moony!
just remember that the green/red angle should be a bit sharper than the blue/green angle. That would give a bit more realistic results. :wink:

At first I was skeptical that you would be able to just subtract one shader from another in a pathtracing environment, but it seems like you have a strong theory on how such a node would work (flip some of the shading values from positive to negative for starters).

Now if someone can produce a proof of concept patch for inclusion into Master, the iridescent effects look quite good.

All this is really, really interesting.