Announcement

Collapse
No announcement yet.

How to access material properties via Maxscript

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

  • How to access material properties via Maxscript

    Hi all,

    I'm hoping this is very easy and I am just being thick, but I seem to be unable to work out how to add a texture map to the diffuse channel of a Vray material via Maxscript. Is this easy enough?? Basically I want to add maps to diffuse and opacity automatically. This is how I am adding it when using a standard material :

    theMaterial.diffusemap = bitmapTex bitmap:theMap


    Any help greatly appreciated.

    Paul

  • #2
    You can use the showproperties MaxScript function to list all available MaxScript properties of the V-Ray material. For the diffuse texture in particular, you could use something like this:
    Code:
    theMaterial.texmap_diffuse=bitmapTex bitmap:theMap
    Best regards,
    vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      To show the properties of a material in the first slot of the material editor type this is in the listener window

      show meditmaterials[1] -- ([1] is the slot number that you want to see the properties for)

      Once that shows you'll see down the list :

      ....
      .texmap_diffuse : texturemap
      .texmap_diffuse_on : boolean
      .texmap_diffuse_multiplier : float
      .texmap_reflection : texturemap
      .....

      the property texmap_diffuse is what you're after, you'll see it takes a texturemap as an input.
      Colin Senner

      Comment


      • #4
        Thanks Vlado, i'll try that..

        Comment


        • #5
          Thanks Moondoggie,

          That's exactly what i needed..

          Comment


          • #6
            Just for "best coding practices", it's always best to test to make sure a property exists before attempting to change/set it. For instance

            Code:
            mat = meditMaterials[1]
            
            if (isProperty mat "texmap_diffuse") then 
                -- change or do something to the mat.texmap_diffuse (like assign a new bitmap texture)
            else
                format "Mat: [%] does not have a property 'texmap_diffuse'\n" mat.name
            Colin Senner

            Comment


            • #7
              Oh ok. Thanks for the tip..

              Comment

              Working...
              X