• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Load a vismat / vray material into sketchup using ruby code?

Scheduled Pinned Locked Moved V-Ray
renderpluginsextensions
5 Posts 3 Posters 843 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    wawmsey7
    last edited by 17 Jun 2015, 08:44

    Is it possible to load a vismat material into sketchup via the ruby script. So in this case i have written a script to draw some stuff and I now want to apply a saved vray material (.vismat) to it's faces as a part of the script so that it is all ready for rendering.
    Is this possible?

    If not, then what would be the best way to replace the material that is already mapped onto the faces how I want, with a vismat that has the same texture, so that the texture stays in the same place?

    Thanks for your help in advance,
    Matt

    1 Reply Last reply Reply Quote 0
    • D Offline
      driven
      last edited by 17 Jun 2015, 09:20

      if you have a look at model Attributes, you'll see all the vismat params listed for any applied texture... [ene_attribute_editor will show them, and her code is easy to follow]

      I suppose you could add those params to any model via ruby...
      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • W Offline
        wawmsey7
        last edited by 17 Jun 2015, 15:49

        I added a vismat material into the model and looked inside the material attribute dictionaries and found one dictionary that had one key "V-Ray for SketchUp Material Attribute"... This presumably holds all of the data vray needs for the material? the value for this is a really long a complicated load of stuff which begins....

        <Assets>
        <Asset renderer="vray" url="/Wood_02/Reflection/transparency_texture/TexFresnel" type="texture" layout="">
        <plugin>
        <vrayplugin version="7" type="texture" name="TexFresnel">
        <parameters>
        <parameter handler="default" listType="none" type="acolor texture" name="black_color_tex" label="Perpendicular Texture">
        <value></value>
        </parameter>
        <parameter handler="default" listType="none" type="acolor" name="black_color" label="Perpendicular">
        <value>
        <r>1.000000</r>
        <g>1.000000</g>
        <b>1.000000</b>
        </value>
        </parameter>
        <parameter handler="default" listType="none" type="bool" name="use_multiplier_as_exponent" label="Multiplier as exponent">
        <value>1</value>
        </parameter>
        <parameter handler="default" listType="none" type="float texture" name="refract_ior_tex" label="Refract IOR Texture">
        <value></value>
        </parameter>
        <parameter handler="default" listType="none" type="bool" name="invert" label="invert">
        <value>0</value>
        </parameter>
        <parameter handler="default" listType="none" type="float" name="refract_ior" label="Refract IOR">
        <value>1.550000</value>
        </parameter>
        <parameter handler="default" listType="none" type="float" name="fresnel_ior" label="IOR">
        <value>2.500000</value>
        </parameter>
        <parameter handler="default" listType="none" type="float" name="black_color_tex_mult" label="Perpendicular Texture Multiplier">
        <value>1.000000</value>
        

        and goes on... bla bla bla....

        so i guess if I put all this into the material in my code then it will behave like this vismat material when rendered??

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by 17 Jun 2015, 17:29

          it is very verbose...
          I checked someones materials the other day and the vray dictionary was 78000 chars long...
          he was wondering why SU was slow...
          john

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • J Offline
            jiminy-billy-bob
            last edited by 17 Jun 2015, 17:59

            @driven said:

            78000 chars long

            They store the preview image as a Base64 string, maybe that's why?

            25% off Skatter for SketchUcation Premium Members

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              5/5
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement