Announcement

Collapse
No announcement yet.

VRay Sun, Sky and Physical Camera video tut + Bonus Script!

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

  • --Copyright 2007 Emanuele Lecchi
    --you're free to modify this script as you wish, as long as the above lines remain in place,
    --and proper credit is given to the original author (me!) in case of public distribution and/or modification




    fn fixthemats dodiffuse doreflection diffCoeff reflCoeff isDiffAbs isReflAbs=
    (
    undo on (
    theMats = getclassinstances vraymtl
    for i in theMats do
    (
    if dodiffuse do (
    if i.texmap_diffuse != undefined do (
    print "Found Diffuse Map"
    if (hasproperty i.texmap_diffuse "*Output*") or (hasproperty i.texmap_diffuse "*RGB_Multiplier*") do
    (
    print "Found map with Output or RGB_Level Parameters"
    if isDiffAbs then (
    try (i.texmap_diffuse.RGB_Multiplier =diffCoeff ) catch ()
    try (i.texmap_diffuse.output.RGB_Level =diffCoeff ) catch ()
    try (i.texmap_diffuse.Texture_Output.RGB_Level =diffCoeff ) catch ()
    print ("Multiplied the diffuse Texture RGB Output of the material " + i.name + " to " + diffCoeff as string)
    ) else (
    try (i.texmap_diffuse.RGB_Multiplier *=diffCoeff ) catch ()
    try (i.texmap_diffuse.output.RGB_Level *=diffCoeff ) catch ()
    try (i.texmap_diffuse.Texture_Output.RGB_Level *=diffCoeff ) catch ()
    print ("Multiplied the diffuse Texture RGB Output of the material " + i.name + " times " + diffCoeff as string)
    )
    )
    if (not hasproperty i.texmap_diffuse "*Output*")and (not hasproperty i.texmap_diffuse "*RGB_Multiplier*") do
    (
    print "About to inset map in output map!"
    oldmap=i.texmap_diffuse
    i.texmap_diffuse = output map1ldmap name"output_"+oldmap.name)
    if isDiffAbs then (
    try (i.texmap_diffuse.output.RGB_Level =diffCoeff ) catch ()
    try (i.texmap_diffuse.Texture_Output.RGB_Level =diffCoeff ) catch ()
    print ("Embedded the diffuse Texture of the material " + i.name + " in an Output Map, and multiplied its RGB Output to " + diffCoeff as string)
    ) else (
    try (i.texmap_diffuse.output.RGB_Level *=diffCoeff ) catch ()
    try (i.texmap_diffuse.Texture_Output.RGB_Level *=diffCoeff ) catch ()
    print ("Embedded the diffuse Texture of the material " + i.name + " in an Output Map, and multiplied its RGB Output times " + diffCoeff as string)
    )
    )
    )

    if (i.texmap_diffuse == undefined) do
    (
    i.texmap_diffuse = VRayColor name:"VRColor_Diff_"
    i.texmap_diffuse.name = uniquename i.texmap_diffuse.name
    i.texmap_diffuse.color = i.Diffuse
    if isDiffAbs then (
    i.texmap_diffuse.rgb_multiplier =diffCoeff
    )else (
    i.texmap_diffuse.rgb_multiplier *=diffCoeff
    )
    print ("Changed the Diffuse Colour of the material " + i.name + " with a VRayColor Map, and multiplied to " + diffCoeff as string)
    )
    )



    if doreflection do (
    if i.texmap_reflection != undefined do (
    print "Found reflection Map"
    if (hasproperty i.texmap_reflection "*Output*") or (hasproperty i.texmap_reflection "*RGB_Multiplier*") do
    (
    print "Found map with Output or RGB_Level Parameters"
    if isreflAbs then (
    try (i.texmap_reflection.RGB_Multiplier =reflCoeff ) catch ()
    try (i.texmap_reflection.output.RGB_Level =reflCoeff ) catch ()
    try (i.texmap_reflection.Texture_Output.RGB_Level =reflCoeff ) catch ()
    print ("Multiplied the reflection Texture RGB Output of the material " + i.name + " to " + reflCoeff as string)
    ) else (
    try (i.texmap_reflection.RGB_Multiplier *=reflCoeff ) catch ()
    try (i.texmap_reflection.output.RGB_Level *=reflCoeff ) catch ()
    try (i.texmap_reflection.Texture_Output.RGB_Level *=reflCoeff ) catch ()
    print ("Multiplied the reflection Texture RGB Output of the material " + i.name + " times " + reflCoeff as string)
    )
    )
    if (not hasproperty i.texmap_reflection "*Output*")and (not hasproperty i.texmap_reflection "*RGB_Multiplier*") do
    (
    print "About to inset map in output map!"
    oldmap=i.texmap_reflection
    i.texmap_reflection = output map1ldmap name"output_"+oldmap.name)
    if isreflAbs then (
    try (i.texmap_reflection.output.RGB_Level =reflCoeff ) catch ()
    try (i.texmap_reflection.Texture_Output.RGB_Level =reflCoeff ) catch ()
    print ("Embedded the reflection Texture of the material " + i.name + " in an Output Map, and multiplied its RGB Output to " + reflCoeff as string)
    ) else (
    try (i.texmap_reflection.output.RGB_Level *=reflCoeff ) catch ()
    try (i.texmap_reflection.Texture_Output.RGB_Level *=reflCoeff ) catch ()
    print ("Embedded the reflection Texture of the material " + i.name + " in an Output Map, and multiplied its RGB Output times " + reflCoeff as string)
    )
    )
    )


    if (i.texmap_reflection == undefined ) do
    (
    if i.reflection != color 0 0 0 do (
    i.texmap_reflection = VRayColor name:"VRColor_Refl_"
    i.texmap_reflection.name = uniquename i.texmap_reflection.name
    i.texmap_reflection.color = i.reflection
    if isReflAbs then (
    i.texmap_reflection.rgb_multiplier =reflCoeff
    )else (
    i.texmap_reflection.rgb_multiplier *=reflCoeff
    )
    print ("Changed the Reflection Colour of the material " + i.name + " with a VRayColor Map, and multiplied it times " + reflCoeff as string)
    )
    )
    )
    )
    TheMats=#()
    )
    )





    rollout PhMatConvRoll "VRay PhysMat Converter 1.1a" width:304 height:88
    (
    checkbox chk1 "Affect Diffuse" pos:[8,8] width:104 height:16 checked:true
    checkbox chk2 "Affect Reflection" pos:[8,32] width:104 height:16 checked:true
    spinner spn1 "Diff. Mult.:" pos:[120,8] width:88 height:16 range:[0,5,0.255] scale:0.001 fieldwidth:40
    spinner spn2 "Refl. Mult.:" pos:[120,32] width:88 height:16 range:[0,5,0.255] scale:0.001 fieldwidth:40
    button btn1 "Fix The materials!" pos:[8,56] width:288 height:24
    checkbox chk3 "Relative" pos:[222,8] width:74 height:16
    checkbox chk4 "Relative" pos:[222,32] width:74 height:16


    on btn1 pressed do
    (
    fixthemats chk1.state chk2.state spn1.value spn2.value chk3.state chk4.state
    )

    on chk3 changed state do(
    chk3.caption = if state then "Absolute" else "Relative"
    )
    on chk4 changed state do(
    chk4.caption = if state then "Absolute" else "Relative"
    )
    )






    createdialog PhMatConvRoll


    you're welcome.
    Lele
    Trouble Stirrer in RnD @ Chaos
    ----------------------
    emanuele.lecchi@chaos.com

    Disclaimer:
    The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

    Comment


    • Lele,
      Any other way i can download ur tutorial?? Dropbox??

      Comment


      • That's actually a good idea.
        I'll try on monday from the office, and post the results ^^
        Although i think it'd be about time to expand on the concepts and go a bit deeper...
        Lele
        Trouble Stirrer in RnD @ Chaos
        ----------------------
        emanuele.lecchi@chaos.com

        Disclaimer:
        The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

        Comment


        • Lele
          Did you have a chance to upload ur tutorial in the dropbox? I am so eager to look @ them. Greatly appreciate it. Thanks

          Comment


          • https://dl.dropboxusercontent.com/u/...hyscam_tut.rar

            Nearly got lost when the external hdd died...
            Sorry for the delay, took a while to recover.
            Lele
            Trouble Stirrer in RnD @ Chaos
            ----------------------
            emanuele.lecchi@chaos.com

            Disclaimer:
            The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

            Comment


            • Thanks Lele, was looking for this again the other day. Also lost my "originals" way back due to HDD...
              Kind Regards,
              Morne

              Comment


              • Input any of these, or interpolate between them, for total surface reflectance (ie diff+refl), although with the fresnel term it may be difficult to gauge it exactly.

                http://www.google.com/imgres?imgurl=http://marine.rutgers.edu/mrs/education/class/yuri/albedo.gif&imgrefurl=http://marine.rutgers.edu/mrs/education/class/yuri/yuri.html&h=767&w=472&sz=9&tbnid=kpIPSy_Sbc_exM:&t bnh=93&tbnw=57&zoom=1&usg=__4VfvRN1_fN-JbhaeiuG9t0tOVQ0=&docid=RUaODeFJ00v4SM&sa=X&ei=IN2 BUsuZB8GltAano4HYBw&ved=0CC4Q9QEwAQ
                Lele
                Trouble Stirrer in RnD @ Chaos
                ----------------------
                emanuele.lecchi@chaos.com

                Disclaimer:
                The views and opinions expressed here are my own and do not represent those of Chaos Group, unless otherwise stated.

                Comment

                Working...
                X