Change color based on incident energy in Cycles.

It’s possible in BI to change the color of an object based on the amount of light falling on it.

Is it possible in Cycles right now?

Any hacks/complicated node setups/OSL scripts to achieve it?

You can’t do it directly in Cycles, but you can do it in the compositor (assign it a simple one color material, use the ObjectID/MaterialID to separate it out in the compositor, change its color and overlay it again).

Let me make my question more specific here. The bottom image has a paint whose intensity falls off very rapidly with the angle (it is a lot darker where it’s facing perpendicular to the light source).

The top one if a lot brighter even when it’s facing perpendicular to the light.

I could probably get close to this effect by changing the roughness values, but it gives very little control, and you cannot change the hue, which happens with a lot of car paints.

http://thecarcarestore.com.au/ccs_shop_images/meguiars/PBC37S.pnghttp://thecarcarestore.com.au/ccs_shop_images/meguiars/KBC05S.png

And another one where the saturation changes with the angle.

http://thecarcarestore.com.au/ccs_shop_images/meguiars/KPF101ZS.png

You need access to “throughput” and “L” integrator core variables that not exposed to node system. Node tree provide only some “weight” that will be multiplied (or added in case of last direct edge to light source) to final color.

you seems to be describing the effect of spec or normals behavior not energy function olf color

i’ think iv seen one function of light color but very complicated to do

are you really interested in one like that
i can try to locate where i havee the ref for this effect!

happy cycles

Yes, would be appreciated.

Thanks for the help. RickyBlender. None of these are exactly what I’m looking for.

I’ll ask in the cycles thread.

I think using color ramp to control the diffuse color should do the trick. I can get similar effect using ‘facing’ input as factor to the color ramp. You can also use the angle trick that RickyBlender mentioned (the ies like lighting thread) to control the color ramp as well.

Edit: The falloff doesnt seem to depend on the light angle though even using the angle trick from the other thread… It only depends on viewing angle… I guess i posted too early :slight_smile:

I’ve managed to find a solution, but it only works if there’s jus one light. The position vector of the shading point, the lamp, and the surface normal are all you need to find the angle the normal makes with incident light, which you can use as input for color ramp.

But this does doesn’t work with any other light setup. Looking for a solution to that now.

I guess the only way possible would be to get amount of light at the point like you suggested (or some OSL magic). How are you using the position of light, are you entering the values manually?

Yeah, for now I’m entering the lamp’s position vector manually. But the wiki says it’s possible using the attribute node to get an object’s position. Even if that doesn’t work, I guess it would be possible using OSL.

Here’s a quick little example.

The question about an actual solution still stays.

Attachments

angle variation.blend (582 KB)

i got an example for showing the normals on faces
but less coorfull then yours!

salutations

you can make such rainbow paints by mixing different roughness glossy shaders together (that’s also how that sort of paint is made, different colored flakes with different reflective properties). It’s not necessary to trick a physicly based materialsystem where you don’t actualy need to :wink:


The phong_ramp closure is available in Blender OSL, it is just not exposed as a node.

I put a bare bones implementation together, if you’re interested you can find it here:

http://blenderthings.blogspot.com/2012/12/a-phong-ramp-car-paint-osl-shader-for.html

I realize that angle dependent diffuse reflection is problably not the whole story for a car paint shader but it is a start.


cheers

another way woudl be to use another renderer
like Yafaray or Luxrender!
which have more features then cycles!
i remember that luxrender have an option for lamps energy and spectrum!

salutations

As far as I know, the lamp energy and spectrum textures in Luxrender are textures to use with emissive materials to control the color and the behavior of the light, they do not actually allow a material to change color or do something similar based on the amount of light falling on it.

In fact, I don’t think Luxrender has any sort of option comparable to the blend weight node or the ‘incoming’ parameter available through the geometry node. Luxrender instead has a carpaint shader which more or less has a fresnal effect built into it, but I don’t think it’s quite as customizable as what you can do in Cycles with the individual shading components.

Thanks for the post on your blog post. I didn’t know about it.

While you can’t control glossy with that approach, it’s definitely going to be useful for the diffuse component of the car paint.

as i said you can get a normal color for each face nodes set up !

there is no direct way to get light intensity
but may be an indirect way!
is not there a way to get from the normal RGB values the intensity from each face
then you could re adjust the color function of that intensity may be ?

salutationsl

I created two materials that change color depending on the position of any point of light:
A diffuse material (needs solidify modifier)
A glossy material (If increasing the scale of Voronoy the surface is softer).



And the .blend:
Change-color-based-on-incident-energy.blend (641 KB)

That is very interesting mano-wii.

I cannot figure out how the diffuse shader works. Can you explain?