Load a vismat / vray material into sketchup using ruby code?
-
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 -
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 -
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??
-
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 -
Advertisement