Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 1 19-04-2013 , 11:21 AM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520

Is there a way to make an object change colors based on light/p.o.v?

Let's say there's this object...
user added image
How do I make it shine in various colors depending on angle of view / angle of the light that shines over it?
The object needs to shine in 4 colors and change into them gradually: yellow-green-blue-indigo and go black when no light shines over it.
This isn't about setting color changes recorded to the timeline though, as it should be light-based. The object will be exposed to light from various angles and change reflected color according to the light's position / viewing angle.

Can someone explain how to do that, please? I am trying to emulate fish scales, specifically those of black swordtails.
user added image

# 2 19-04-2013 , 11:40 AM
daverave's Avatar
The thin red line
Join Date: Aug 2009
Location: England
Posts: 4,472
Look up ramp and facing angle I think that would work, you might have to model the scales of the fish to make it work.................dave




Avatar Challenge Winner 2010
# 3 19-04-2013 , 11:59 AM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520

Look up ramp and facing angle I think that would work, you might have to model the scales of the fish to make it work.................dave

Could it also work with bump mapping and transparency, and have a shader that turns completely invisible when it's not lighted (thus showing the black on the main body of the fish), but when it is, only the specular appears (varying its color from yellow to indigo)?
That way I could have a 2nd layer over the fish, to make it look as if the scales are part of its body.

If I cannot use png + bumpmap, then yeah, I'll have to do something similar to what I've done to the bird-like creature in my avatar, but that sure is going to slow down everything... and how do I stick the scales to the fish? Combine mesh command?

For a start, i'll try it on that object, but need to find a tutorial on how to do that.

# 4 19-04-2013 , 12:00 PM
daverave's Avatar
The thin red line
Join Date: Aug 2009
Location: England
Posts: 4,472
The more I think about your think about your fish the harder I think it will be to do, there are a number of things that are going on with a fish scale like yours, some of the colour will come from the scale, some from the reflective colour and some from the transparency of the scale showing the body colour. Give the ramp shader a go but also bring some transparency into it...............dave

Edit: there is a bump slot and you can use the texture layer shader to have a texture under your scales texture

Attached Thumbnails



Avatar Challenge Winner 2010

Last edited by daverave; 19-04-2013 at 12:08 PM.
# 5 19-04-2013 , 12:10 PM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520
So far I've gained some variation but I need to determine how fast it changes.
user added image
user added image
user added image
user added image
The yellow should have been present when the scale was in 1st position... But what if I use only two colors? From yellow to a dark indigo... maybe that would let the rest to change on their own...

# 6 19-04-2013 , 12:18 PM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520
A specular seems to be doing the job, but needs to be of a more metallic structure...
And I need to fix the ramp shader, it's showing blue in the wrong side.

Attached Images
# 7 19-04-2013 , 12:34 PM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520
I think having multiple overlaying scales and a shader that only is visible to light should do this.
But then I'd have to figure out how this was done:
https://simplymaya.com/forum/showthread.php?t=9508
I would need 4 scale objects combined as a single scale just to do this. Still, I have no idea how to do what was shown there...

# 8 19-04-2013 , 12:38 PM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520
Nvm, I've just remembered something important: A ramp shader can still use blinn... which gives me control over reflectivity... Bingo!
Now to set all colors to act like this.

Attached Images
# 9 19-04-2013 , 03:13 PM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520
For some reason, the scale turns to black when viewed from the left side side (left side of scale facing camera/light), instead of metallic-yellow.
The sequence should be, from left to right, yellow-green-blue-indigo, and then turn to black.

They look kind of... uh... plastic. O.o
I'll probably have to resort to painted glass style + refraction or something... They don't look metallic at all.

Well, this is as close as I can get with a mix of blinn and ramp...
user added image
user added image
user added image


Last edited by SilverFeather; 19-04-2013 at 08:41 PM.
# 10 20-04-2013 , 12:39 AM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
So wait, are you trying to control the color based on how much light is hitting the surface or how its facing the camera? You could use the surface luminance node or the sampler info node, respectively.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 11 20-04-2013 , 09:13 AM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520

So wait, are you trying to control the color based on how much light is hitting the surface or how its facing the camera? You could use the surface luminance node or the sampler info node, respectively.

More like a combo of both probably.
In real life, if one looks at the fish that have these scales, it also depends from where the light is coming.
So if someone looks at a fish that is sitting horizontally while the light is above the fish, they would see cyan scales. But if the light moves its angle to be in the observer's area, those scales will be either green or slightly yellow.
Suppose the light hasn't changed angle and it is still shining above. If the observer changes the angle they are viewing the fish, they will see different scale color.
So which is it that affects the scale color seen by the observer? Observer (or camera) position? Light position? Both?

# 12 20-04-2013 , 10:14 AM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520
This is pretty close to it. I've added an opaque black scale behind each of them and a spotlight instead of area light. Now it looks close, only that in the color frame I cannot add yellow too.
It only seems to work from yellowish green to dark blue.

I've also added a bit of yellow light instead of white light, looks even closer to the actual scales.

Attached Thumbnails
Attached Images

Last edited by SilverFeather; 20-04-2013 at 10:20 AM.
# 13 24-04-2013 , 10:20 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
You can control the colors using both. I'm uploading a scene with what I came up with, you can apply it to whatever attributes.

Attached Thumbnails
Attached Files
File Type: zip lightIntesity_viewAngle_shader.zip (991.9 KB, 298 views)

- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
# 14 25-04-2013 , 11:51 AM
SilverFeather's Avatar
Noober than noob
Join Date: Sep 2011
Posts: 520

You can control the colors using both. I'm uploading a scene with what I came up with, you can apply it to whatever attributes.

I cannot open the file for some reason... But those balls in the picture do not fully seem to fade the color in. It looks static, (and I have achieved that with the scales before but not what I am looking for) I don't know how to describe it... So I've made a video of a recorded shader color change to show what I am trying to achieve based on the angle the light bounces off but also observer's viewing angle. I didn't record the changes with the best accuracy, but it shows pretty much what it should act like.
Color change test - YouTube

# 15 25-04-2013 , 11:05 PM
Gen's Avatar
Super Moderator
Join Date: Dec 2006
Location: South FL
Posts: 3,522
Ok I think I know what you're getting at, you want the color to change on the entire surface and not per point. Hmm, that could be simple or really complicated lol. Even if you somehow use the camera's rotation as a driver for the ramp, then the behavior will still be dependent on that camera.


- Genny
__________________
::|| My CG Blog ||::
::|| My Maya FAQ ||::
Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads