Announcement

Collapse
No announcement yet.

Change of material color

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

  • Change of material color

    Hello!

    I have a hard time digitizing a specific material, and would appreciate any input you have give me on this. Before I deep dive more in the material, there is some theory I need to make sure works, so here's my problem:

    Imagine you need to apply a material to a plane. The color on the plane need to change according to the camera-angle, but NO the angle in terms of height, but what SIDE you see the plane from. For example: If you see the plane from south, it's blue, from west it's read, from north, it's yellow, and from east it's purple.

    I have tried various setups with fallsoffs that depend on the camera angle, but it's all connected with the angle to the plane and the cameras direction to the plane. Any ideas?


    All the best,

    Rasmus


  • #2
    This 'may' be a start. Sounds plausible. I haven't tested it as it's time for dinner
    https://forums.chaos.com/forum/v-ray...rmal-direction
    https://www.behance.net/bartgelin

    Comment


    • #3
      Hi Fixeighted.

      I have seen the thread you are referring to earlier, but the scenes people are referring to and the plugins mentioned are no longer available. I have written directly to "instinct" in the hope that they can elaborate on the input given, but I have heard nothing and I can achieve the desired result - perhaps because there is some of the input I don't understand. Any help would be appreciated!

      Comment


      • #4
        Hehe, well at first I thought you meant 'plane' as in a flat plane, when in fact I think you meant aeroplane...is that right?

        Is what you're trying to make a chameleon paint by any chance?
        If not then what is it specifically?
        https://www.behance.net/bartgelin

        Comment


        • #5
          It is actually a flat plane I'm trying to replicate a specific piece of fabric. It has a visual expression as velvet, and this feeling I can achieve with falloff/sheen. However, and this is the tricky part, when I see the fabric from one direction (not angle) it looks dark, from the opposite direction, it's bright, and if I see it from the sides it looks spotchy. Imagine you apply this to a L-shaped sofa setup: Some of the seats look bright, while others look dark. It's crazy to look at, but that is how it looks when you see it on a photo.

          I have tried to replicate the fabric in different ways with textures, but it doesn't work as I would like it. So I decided to start from scratch and set up the material that should work from theory: When you see a plane from different directions with a camera (e.g. north, south, east west), it should change color. It needs to be dynamic - I can't animate it. I have attached an image on how I would like it to be in theory. So when you move the camera from position north to east, the color gradually changes from yellow to red. Hope that helps show my thoughts better

          Comment


          • #6
            Ah ok I see.

            You can't make that happen on a flat plane, at least not to my knowledge, or that I can figure a method for.

            Your material basically acting as you see it is due to the tiny fibres being oriented in a given way, so like crushed velvet, or stripe-mown lawn grass,
            a blend of the direction of the grass/fibres and the lighting will create that illusion of colour change.

            The nearest I've got to anything like that is possibly this attached thing...I'm still recovering from illness so my head aches too much to think any more about it for today
            Attached Files
            https://www.behance.net/bartgelin

            Comment


            • #7
              I'm not sure what fixeighted came up with as I don't have a newer version of max but I managed to get something workable using a VraySamplerInfoTex and some OSL shaders based on the SimpleGradient sample OSL shader.

              Click image for larger version  Name:	image.png Views:	0 Size:	118.1 KB ID:	1199583

              Click image for larger version  Name:	image.png Views:	0 Size:	245.8 KB ID:	1199580Click image for larger version  Name:	image.png Views:	0 Size:	201.2 KB ID:	1199581Click image for larger version  Name:	image.png Views:	0 Size:	233.6 KB ID:	1199582

              It really only works on a flat plane since it's using the reflection vector from the SamplerInfo texture rather than a true "if it's viewed from the left it's this color" kind of calculation. ​​I never really figured out what happens when it's viewed directly from above (i.e., which color should it be) and what I've got really just defaults to the red/yellow pair of composite maps. I can't imagine having to use this in a scene though, it seems like it would be so unpredictable.

              Maybe it'll help point you in the right direction though. Scene attached.
              Attached Files
              Last edited by dlparisi; 11-01-2024, 02:35 PM.
              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


              • #8
                Hehe, nice one, and that is exactly what the OP asked for, so maybe it's useful in some way.
                This is what I hacked together...not elegant now that I look at it but it appears to work...sort of
                Max 21 attached if interested.

                Now my day is going to be spent looking at the samplerinfo map, which I've not used before...
                Attached Files
                https://www.behance.net/bartgelin

                Comment


                • #9
                  Thanks for your input - much appreciated, I'll have a look at the scenes!

                  Comment


                  • #10
                    Click image for larger version

Name:	Screenshot_2.jpg
Views:	77
Size:	49.6 KB
ID:	1199609@dlparisi​ I believe we have a winner! At least, it works in theory. Now next step is to replace the vray-colors and apply the correct textures. But from what I can see, it works! Thanks!


                    All the best,

                    Rasmus

                    Comment


                    • #11
                      Well that was a very interesting experiment. Actually both versions look sort of similar and work well, so please share when you get a result you like using either

                      The main difference seems to be at the corners; so my interpretation has the colours going from one to the next, whereas this one has intermediate transitions.
                      https://www.behance.net/bartgelin

                      Comment


                      • #12
                        Rasmus: glad it's working for you. If love to see the final product if you can share.

                        Fixeighted: I don't have access to a newer version of Max (I'm on 2020) but I'm curious what your solution involved. Care to elaborate?
                        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


                        • #13
                          Ah ok...earliest I have is 21 but the attached is the general theme, based on the method outlined in the old post https://forums.chaos.com/forum/v-ray...rmal-direction
                          Attached Files
                          https://www.behance.net/bartgelin

                          Comment


                          • #14
                            Originally posted by fixeighted View Post
                            Ah ok...earliest I have is 21 but the attached is the general theme, based on the method outlined in the old post https://forums.chaos.com/forum/v-ray...rmal-direction
                            Thanks. I didn't really follow Thorsten's description from his original post but your screenshot cleared it up for me. With your setup I think you get a better correspondence of left-->green, right-->red, etc. which is a bit easier to understand IMO. It still has a similar problem for surfaces that face directly up or down though (I may have it set up slightly incorrectly though too). Both options still seem like a mess to work with for real materials so I'm interested to see what the final product looks like.

                            I've also updated my material a bit (attached) to fix the straight down view (magenta) by adding in another layer to the final composite map and adding a mask to the red/yellow layer. I'm not sure this is really correct though since it seems like the top view should be 25% of each of the other values. I also fixed the "GREEEN" spelling!

                            It's not obvious, but the simplegradient OSL maps use slightly different code at the different nodes. The OSL maps that feed the R/Y composite have code that looks at the "float inValue = Input[0]" value to get the red component of the rgb input from the SamplerInfo map while the OSL maps for the B/G composite uses "float inValue = Input[1]" to get the green component of the rgb input. I swap black and white in the color values to get the ramps to flip. The last composite map has a two more OSL maps as masks whose code have three values (A,B, & F) that also switch the Input between [0] and [1], but the middle color value is black (the two others are white) to mask out the center of each ramp. I wired in a float controller to the "hardness" values as I was experimenting with different settings but I think this should be left at 0.​

                            Lastly, I should add that I am by no means an expert on this as it's my first time using the SamplerInfoTex material or modifying any OSL code so if something looks off or incorrect please let me know. I cobbled this together and it works but I don't fully understand it 100%.


                            Click image for larger version  Name:	image.png Views:	0 Size:	160.3 KB ID:	1199642
                            Attached Files
                            Last edited by dlparisi; 12-01-2024, 08:48 AM.
                            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


                            • #15
                              I fixed a small error in the setup (I had a '-1' when it should have been a '0' in the yellow OSL mask.) Updated scene attached.
                              Attached Files
                              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

                              Working...
                              X