Announcement

Collapse
No announcement yet.

shader help - change color based on normal direction

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • shader help - change color based on normal direction

    I can't seem to find anything that will do this. I am aware of being able to render out a normal pass, but I want to do this with a shader. Not only that, but I'd like to have control over the gradation colors.

    The reason being, I want to change the colors, then have a falloff based on plain old camera angle to change how much this effect is visible based on angle.

    I have a feeling I could make a pretty sweet looking material if I can figure that one out. I'm going for a slightly more accurate, yet still fake, pearlescent kind of material. I've seen some pretty good ones, but once I've taken them apart I find they don't really do what I want them to.

    Of course I'd also like to add swirls to it too via a noise or something like that, but that's not necessary I suppose.

    Any ideas?

  • #2
    You could use a Blend material or a mix map. Put a Fallof Map in the Mask or Mix slot and set the the falloff Type to parallel/perp. There's probably other ways but this is the first that pops into my head.
    www.dpict3d.com - "That's a very nice rendering, Dave. I think you've improved a great deal." - HAL9000... At least I have one fan.

    Comment


    • #3
      Use a Gradient Ramp for your diffuse color (or whatever other slot too). Set the Ramp type to Normal. You can make it do whatever you want. Virtually no one knows about this functionality. The max documentation is weak on this point.

      Comment


      • #4
        Those are good suggestions, but not quite what I'm looking for.

        You can get the same results using falloff. I want to each color to be a specific normal direction. That's what I can't seem to accomplish.

        So say the normal points toward the camera, it should be one color, if it points mostly in the X direction in relation to the camera it should be another color, -X should be something else, Y something else, and -Y something else.

        It's simple to use falloff or gradient ramp to accomplish the angle toward the camera. I have a harder time with the others.

        Comment


        • #5
          What if you put a normal map into a blend slot? Maybee I'm just not understanding what you are trying to achieve.

          Comment


          • #6
            I think you could do it with a morph, just set up the same object in the same state as the morph targets, then creat a morph mat with the different materials you want and then wire or script the blending amounts to the direction to the camera.
            Eric Boer
            Dev

            Comment


            • #7
              if i understood this is possible with a little monkey grip and nested falloffs

              First a Falloff for the left to right. Standard falloff, set two colours as desired and change mode to "towards/away" and direction to "camera x-axis".
              That one is put inside a maskmap and set as map. The mask is also a falloff with "camera y-axis" instead of x and "perpendicular/parallel" as mode. This masks away the top and bottom parts of the other falloff. Then that complete map is composited over another falloff using the "composite map". And that last falloff is meant to do the top to bottom gradient. So we use the same settings as in the first and simply change direction to "camera-y".

              That's all :



              In this example i used red for left, green for right, blue for top and yellow for bottom. Just to stress that, yes that's camera dependent.

              Here's the max file in case that helps investigating :

              http://www.instinct-vfx.de/pictures/...ormalthing.max

              Hope i understood you right at all, and of course that it helps.

              Regards,
              Thorsten

              Comment


              • #8
                Just a quick note. Just did a testsequence. It actually looks as if you had 4 colour lights that come from camera linked spots. I assume it would become a rather interesting effect with actual textures mixing....tho i got no idea whatsoever what you would need that for lol.

                Thorsten

                Comment


                • #9
                  If you have the "sciAnaComp" plugin map you can set this up. Willi Hammes showed me once how to create a material that could be assigned to objects to create normal maps from. It shades objects based on there angle to the camera. You can probably take this and adjust it to fit your needs. I'm not able to upload the material right now...but its not very complicated. Here is how to do it.

                  1. Put an output map into the diffuse slot. Check the invert checkbox...
                  2. Put an sciAnaComp map into the map slot of that output map. Set it to Add.
                  3. In the color 1 slot of the sciAnaComp map put a falloff map set to towards /away. The twoards color should be black and the away color red. Set the falloff direction to camera X.
                  4. In the color 2 slot of the sciAnaComp map put another SciAnaComp map...Again set to Add.
                  5. In the color 1 and color 2 slot of this new sciAnaComp your going to put falloff maps with the same settings as the one you just did. Only change the colors to green and blue respectively. Also change the falloff direction so that the green one is on the camera Y and the blue one is on the Camera Z.
                  6. Make the material 100% self-illuminated.

                  Hope that helps...

                  Tim J
                  www.seraph3d.com
                  Senior Generalist
                  Industrial Light & Magic

                  Environment Creation Tutorial
                  Environment Lighting Tutorial

                  Comment

                  Working...
                  X