Announcement

Collapse
No announcement yet.

faking dispersion using the new blend material

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

  • #16
    @Natty: it is not from HDRI

    @Morbid Angel: that example is very exaggerated, and doesn't look very real to me. I was after a crystal material like shown here

    @Lele: you're right about those numbers, they need to be higher to get more realistic results

    @Chris: I am afraid that the normal blend does not work like you said. If you are sure however, please show me how it is done

    here's another test with ior varying from 1.48 to 1.52, so more dispersion. As you can see it works fairly well for the ball , but for the pyramid we should need more steps:



    only drawback with this blend material is the fact that shadows become black. Here the rendering without dispersion:

    You can contact StudioGijs for 3D visualization and 3D modeling related services and on-site training.

    Comment


    • #17
      That looks better .. Whats is it like when you use the Fog rather than refraction colour? does that work at all?
      Natty
      http://www.rendertime.co.uk

      Comment


      • #18
        Originally posted by natty
        That looks better .. Whats is it like when you use the Fog rather than refraction colour? does that work at all?
        Devil of a man, i didn't think about it.
        Lemme try as well

        Lele

        Comment


        • #19
          Code:
          fn clrRampBuilder id baseColor = (
          		baseColor = color 0 0 0
          		baseColor.Value = 255
          		basecolor.Saturation= 255
          		basecolor.hue=(255.0/7)*id
          		return baseColor
          		)
          fn iorRampBuilder id spread baseIor newIor= (
          		newIor=baseIor+(id*spread)
          		return newIor
          		) 
          matSlot = VRayBlendMtl ()
          matSlot.baseMtl=vraymtl()
          matSlot.baseMtl.diffuse =color 0 0 0 
          refFraction=1.0/7
          matSlot.baseMtl.texmap_reflection = VRayColor red:refFraction green:refFraction blue:refFraction
          matSlot.baseMtl.reflection_fresnel=on
          matSlot.baseMtl.option_reflectOnBack=on
          matSlot.baseMtl.refraction =(clrRampBuilder 0 baseColor)
          matSlot.baseMtl.refraction_ior = (iorRampBuilder 0 0.03 1.7 newIor)
          matSlot.baseMtl.refraction_affectShadows=on
          matSlot.baseMtl.refraction_affectAlpha=on
          matSlot.baseMtl.refraction_maxDepth=15
          matSlot.baseMtl.reflection_maxDepth=15
          baseIor=matSlot.baseMtl.refraction_ior 
          for i=1 to 6 do (
          matSlot.coatMtl[i]=copy matSlot.baseMtl
          matSlot.coatMtl[i].refraction = (clrRampBuilder i baseColor)
          matSlot.coatMtl[i].refraction_ior = (iorRampBuilder i 0.03 1.7 newIor)
          matSlot.blend[i]=color 255 255 255
          )
          matSlot.additiveMode = on
          meditmaterials[1]=matslot
          Running this creates a 7 colours spectrum diffractive material, with a ior spread of 0.03 in the first mateditor slot.
          Slight issue: when i turn "shellac mode" on, the editor slot takes a ZILLION years to render the sample...
          Can anyone else confirm this?

          Lele

          Comment


          • #20
            over 7 mins and still updating.... Zillion years confirmed
            Eric Boer
            Dev

            Comment


            • #21
              while it renders in a blitz, wrong (for what we need here), without shellac mode, right? (line before the last one in the code set to "off" )

              Lele

              Comment


              • #22
                Originally posted by Gijs
                @Natty: it is not from HDRI

                @Chris: I am afraid that the normal blend does not work like you said. If you are sure however, please show me how it is done
                Indeed Gijs... I tried it and it is not right.. making me question the blend material a bit. The math that you did is correct, but I wanted to do it without the shellac (additive) mode. So I figured out that each color that gets added down the line gets added at 50% of it and 50% of all the other layers combined. Makes the math more tricky but still possible. Using Vray color (float is easier on the math), I did a base of red at x4, second was green at 4x and third was blue at 2x... Seems to match... but makes actually using the blend more complicated than I hoped, and questions what I have done so far.

                Comment


                • #23
                  That's realy clever! It took me a moment to figure out what you did, but it should indeed be mathematically correct (and working). Now I wanted to make a material that starts with violet and ends with red. in rgb values something like this:

                  1 0 1 violet
                  0 0 1 blue
                  0 1 1 cyan
                  0 1 0 green
                  1 1 0 yellow
                  1 0 0 red

                  After some tests it looks like this is going beyond the capabilities of the Vray blend material.
                  You can contact StudioGijs for 3D visualization and 3D modeling related services and on-site training.

                  Comment


                  • #24
                    Originally posted by Gijs
                    After some tests it looks like this is going beyond the capabilities of the Vray blend material.
                    Not really, but you need to know a bit better what's going on.

                    My preferred way of making a "dispersive" material is by making three ordinary glass materials (full white reflection/refraction with Fresnel and slightly different IORs), but assigning different Blend colors to them (e.g. Red and Green, or Blue and Green etc). This avoids having to do divisions and stuff.

                    Suppose we have Green for the first coat material, and Red for the second one.

                    Now, materials are calculated from bottom to top (bottom and top as in the UI). First we consider the second material with the red blend color. This means that the red component of the final result will come from that material, while the other components (green and blue) will pass through. Next, we get to the first coat material with the green blend amount. This means that the green component of the final result will come from that material, while the other components (by now only blue) will pass through. Finally we get to the base material, and we are only left with the blue component, which comes from that material.

                    I hope this makes sense... This scheme can also be adapted to include intermediate colors of the spectrum, if you think a bit more. E.g. if you want 4 colors in the spectrum, you can do something like this: have the bottom-most material with 50% red color; the one above it should be 100% red and 50% green, the one above it should be 100% green and 50% blue, the one above it should be the base material. It's possible to maybe write a script for this...

                    Best regards,
                    Vlado
                    I only act like I know everything, Rogers.

                    Comment


                    • #25


                      I guess i'll have to finish me coffee first :P

                      Lele

                      Comment


                      • #26
                        That must be one big coffee

                        Comment


                        • #27
                          Originally posted by vlado
                          Originally posted by Gijs
                          After some tests it looks like this is going beyond the capabilities of the Vray blend material.
                          Not really, but you need to be a bit better at maths
                          hehehe, I already hoped that that sentence would trigger you :P

                          Indeed using colors for the blend amount opens new possibilities. Goin to dive into this later. Thanks.
                          You can contact StudioGijs for 3D visualization and 3D modeling related services and on-site training.

                          Comment


                          • #28
                            go on lele! you can do it!!!
                            Chris Jackson
                            Shiftmedia
                            www.shiftmedia.sydney

                            Comment


                            • #29
                              Originally posted by vlado
                              My preferred way of making a "dispersive" material is by making three ordinary glass materials (full white reflection/refraction with Fresnel and slightly different IORs), but assigning different Blend colors to them (e.g. Red and Green, or Blue and Green etc). This avoids having to do divisions and stuff.
                              That is, the blend colour is actually a FILTER colour?

                              if you want 4 colors in the spectrum, you can do something like this: have the bottom-most material with 50% red color; the one above it should be 100% red and 50% green, the one above it should be 100% green and 50% blue, the one above it should be the base material. It's possible to maybe write a script for this...
                              Suppose we have 7 colours.
                              Is it like saying we use each colour of the spectrum to blend but , say, the red?
                              All at 100% value?
                              I managed to make it work with three, of course, and yay. looks good and that's very scriptable.
                              I am missing something here...

                              Lele

                              Lele

                              Comment


                              • #30
                                I got some interesting results using negative colors in the vray color map as a blend. Seemed like it was additive then, rendered long too
                                Eric Boer
                                Dev

                                Comment

                                Working...
                                X