PDA

View Full Version : Color Change - based on bump texture?


Stoehr
06-17-2004, 10:09 PM
I've been attempting to make a color gradient change based onthe bump. I'm stuck. Someone has tried this before right? I believe this is a commonly used industry wide. I thought I saw a video on this topic once before, but I don't remember where it was. If someone could help me? Here's an example image.
http://www.theladyandthelion.com/forumPosts/colorFromBump.jpg

Stoehr
06-18-2004, 12:50 AM
I found a solution.
I also found this thread. It's helpful.
http://www.xsibase.com/forum/index.php?board=6;action=display;threadid=1023;start=0

http://www.theladyandthelion.com/forumPosts/bumpColorApproach3.jpg

thebigMuh
06-18-2004, 02:42 AM
I know this sounds funny, but I'm not sure if this actually does what you want :D

You are essentially turning the image into a greyscale picture, and then use the luminance to drive a gradient. This would look identical without the bump, and actually has nothing to do with it :shrug:

If you want to get a "steepness" map, that is, extract information about how much the bump changed the surface normal at each location, you'll have to compute the dot product between the unperturbed surface normal, and the bumpmapped surface normal. Looks like this:

http://animus.brinkster.net/temp/BumpColor.jpg

I colored it like a heat map. Dark blue means that the bump map didn't actually change anything, while red-white means that the bump map turned the surface normal quite a lot around.

Ciao, ímuh!

Stoehr
06-18-2004, 03:30 AM
Thanks Muh,
That's logical. I was looking for something like that.
Here's my new result. It's quite a bit different. Thanks!

http://www.theladyandthelion.com/forumPosts/bumpColorApproach4.jpg

Stoehr
09-24-2005, 04:56 PM
Problem: Change the color of the surface based on the HEIGHT of the bump.

Sorry to bring up such an old thread, but it is mine! ;-) Anyway, I realized recently that bigMuh's previous solution is nice, but still does not resolve what I want. BigMuh's solution changes the color based on the change in ANGLE of the surface normals. So, the color returns to the base color when the surface normals are "flush" at the top of the bump.

My trouble is I can't seem to find the distance between the orignal surface and the perturbed surface. I speculated a couple of solutions (see below), but neither are giving me a decent result.

Any help is greatly appreciated!

http://theladyandthelion.com/forum_images/bump_vector.jpg

http://theladyandthelion.com/forum_images/bump_scalar.jpg

skyPhyr
09-26-2005, 09:38 AM
If you want to get the difference between the two vectors then use a vector-scalar math node. Set it to give the dot product of the two input vectors - same vectors as you've got at the moment. You can use the scalar this output to drive your gradient.

You're getting the difference already, but getting it as a vector which probably isn't giving you what you want as it's another vector. The dot product with give you the cosine of the angle between the two vectors - which is probably something more like what you want.

Cheers,

Alan.

Stoehr
09-26-2005, 04:29 PM
Thanks, but that's what has already been suggested. theBigMuh had already suggested the dot product. The dot product gives the change in angle between the two vectors, so when the bump returns back to 0 degrees, it returns to the base color. So, if the top of the bump is 0 degrees, it returns to the first color of the gradient. I need a linear transition from first color to last color. Thanks though. It seems this is a tough solution.

Atyss
09-26-2005, 05:34 PM
I could be wrong, but I have doubt what you're looking is possible. You see, bumpmap is a shading factor obtaining by, like it's been pointed out, the multiplication of vectors. These vectors have no notion of depth or such, based on an input color, they provided a direction. These vectors are then combined to know the final modified normal direction at the intersection point, wich in turn modifies the illumination of the intersection point.

(bear in mind I'm very new to vectors and such, this explanation could be very wrong)

So to summarize, when it comes to bumpmapping, there is no concept of depth, but rather normal alteration end how "strong" that alteration is. You could possibly try to extract each intersection point's modified normal and use that as a keyer. I have no idea how you would do that though, I think it would be a long winded process for something that could *possibly* be better handled with displacement.

Anyone correct me if I'm wrong.


Bernard

Stoehr
09-26-2005, 06:33 PM
Atyss, yes that sounds about right. Hmm.. ok, I'll continue my research.

(BTW, I really like the PST you did for 3dtutorial).

Stoehr
09-27-2005, 05:57 PM
Yea! Found a solution.
http://www.xsibase.com/forum/index.php?board=12;action=display;threadid=21260;start=0#lastPost

Per-Anders
09-27-2005, 08:31 PM
sorry if i'm being silly... but why not simply plug the output luminance from your bitmap your'e using as a bump into a gradient, put that into the diffuse color channel, and plug the bump as normal..... or maybe i really am totally missing what's wanted here.

http://www.peranders.com/general/bumpcolor01.jpg

mocaw
09-28-2005, 06:24 AM
I think the confusion comes from which gradient node to use...it did for me...

Stoehr
09-28-2005, 07:07 AM
I think the confusion comes from which gradient node to use...it did for me...

Oh right, yes, you need the Mixer Gradient with the scalar input. Sorry about that!

mdme_sadie: What you did, is what I firrst did, and unfortunately, changing the bumpgenerator values has no link to the color. There is a fine difference in the rendering, and I'm very happy with my final result. This is quite nice!

http://theladyandthelion.com/forum_images/bump_vector_mixer.jpg

mocaw
09-28-2005, 03:56 PM
Ah, my thick brain gets what it was you were looking for now. Do you use this function of gradients with bumps a lot- or the quicker, but less refined way? I can see the trade off in each...

For simple things wouldn't ajusting the effects on the image node give a somewhat similar effect? If you write a simple expression so that the Brightness is -100 units of the gain it seems to give good approximation.

What about using an intensity node to drive the bump and the gradient, and setting the bump factor to a negative input since factor controls the range for the bump? Maybe that only works for procedurals?

Your version would be much better for an animated bump for things such as viens etc.

I've done some semi-similar things with expressions and change range nodes- but this is far more streamlined.

Stoehr
09-28-2005, 06:51 PM
Ah, my thick brain gets what it was you were looking for now. Do you use this function of gradients with bumps a lot- or the quicker, but less refined way? I can see the trade off in each...

For simple things wouldn't ajusting the effects on the image node give a somewhat similar effect? If you write a simple expression so that the Brightness is -100 units of the gain it seems to give good approximation.

What about using an intensity node to drive the bump and the gradient, and setting the bump factor to a negative input since factor controls the range for the bump? Maybe that only works for procedurals?

Your version would be much better for an animated bump for things such as viens etc.

I've done some semi-similar things with expressions and change range nodes- but this is far more streamlined.

Yep, the key reason for this method is animated surface. I need refined control over a "layer" of the bump, through a gradient and/or mix color node, then have the ability to add an 2D animated sequence to a "layer" of the bump (great for oily, "magical" effects)! This same concept would work well with displacements; vector instead of scalar.

I would love to see your example using an Intensity node! Please do share your thoughts on this approach.

mocaw
09-29-2005, 06:06 AM
Here is a simple version using a procedural. To do it with a image is very similar. What ever the main input node is (3D cloud, an image etc.) you need to use the intensity to drive the bump AND the gradient. Also note that the Bump_generator has a negative value for the factor so that things get pushed out instead of sucked in, but this depends on what you want to have going on. There is more to it, but I'm sure you'll find a better way! I'm sure the old school softimage folks will come down on me for my lame half assed atempt- but hey I'm really new to XSI and this whole render tree world!

The image based example will not save the small liked expression for some reason- so you'll need to link the intensity nodes factor with the change range's New Range:end input. Sorry but it is just a simple drag and drop away...

This was done in v5 so let me know if it converts OK to 4.2- which it should as there is nothing new going on here...

PS- try using the settings under the enable effects tab for the image to get a similar effect.

Stoehr
09-29-2005, 07:06 AM
Your result is very nice, and it is definitely faster to render. However, it is loosing quite a bit of detaill with out the bumpgenerator mixing into the the gradient. I like what you have done, though. It is simpler, and easy to teach!

mocaw
09-29-2005, 03:02 PM
Your result is very nice, and it is definitely faster to render. However, it is loosing quite a bit of detaill with out the bumpgenerator mixing into the the gradient. I like what you have done, though. It is simpler, and easy to teach!

Yeah, I'd say my versions are hacks and yours is the right way to do it. Unfortunatly hacks are something that us x-lw'ers are prone to...hehehe

CGTalk Moderation
09-29-2005, 03:02 PM
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.