Announcement

Collapse
No announcement yet.

multiple bitmaps and UVWRandomizer

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

  • multiple bitmaps and UVWRandomizer

    Is here any way to automatically load large number of bitmaps as VRayBitmap, connect them to VRayMutliSubTex and use as a mapping source the same UVWRandomizer for all bitmaps?
    Or maybe there is some way to use MutliTexture and VRayUVWRandomizer?

  • #2
    You can do it through MaxScript. Here is a simple example script which creates and applies (to the selected object) a VRayMtl in which a VRayMultiSubTex is plugged; the VRayMultiSubTex contains three maps with a shared VRayUVWRandomizer node:
    Code:
    bm=vraybitmap()
    bm.HDRIMapName="<map_location>"
    bm2=vraybitmap()
    bm.HDRIMapName="<map_location>"
    bm3=vraybitmap()
    bm.HDRIMapName="<map_location>"
    uvw=vrayuvwrandomizer()
    bm.mapSource=uvw
    bm2.mapSource=uvw
    bm3.mapSource=uvw
    mst=vraymultisubtex()
    mst.texmap_1=bm
    mst.texmap_2=bm2
    mst.texmap_3=bm3
    mtl=vraymtl()
    mtl.texmap_diffuse=mst
    $.Material=mtl
    Aleksandar Hadzhiev | chaos.com
    Chaos Support Representative | contact us

    Comment


    • #3
      That's cool. Is there not a way to make this available in the map itself?
      https://www.behance.net/bartgelin

      Comment


      • #4
        OK - this is my try.
        Script displays file select dialog and connect choosed files as VRayBitmap to SELECTED VRayMultiSubTex

        Code:
        fn load_images = (
        viewNode = sme.GetView (sme.activeView)
        view = trackViewNodes[#sme][(viewNode.name)]
        --Get Index of Active View
        actIndex = sme.activeview
        --Get the actual SME View
        theView = sme.getview actIndex
        if ((theView.GetSelectedNodes()).count == 0 ) then return messageBox "Select VRayMultiSubTex in Slate Material Editor"
        selected = (theView.GetSelectedNodes())[1]
        selectedRef = selected.reference
        if ((classof selectedRef) != VRayMultiSubTex) then return messageBox "Select VRayMultiSubTex in Slate Material Editor"
        
        --http://www.scriptspot.com/bobo/mxs9/dotNet/OpenFileDialog.html
        theDialog = dotNetObject "System.Windows.Forms.OpenFileDialog" --create a OpenFileDialog
        theDialog.title = "PLEASE Select One Or More Files" --set the title
        theDialog.Multiselect = true --allow multiple files to be selected
        theDialog.Filter = "Image Files|*.png;*.bmp;*.tga;*.hdr;*.sgi;*.rgb;*.rgba;* .jpg;*.jpeg;*.jpe;*.exr;*.pic;*.tif;*.tiff;*.psd;* .ifl|All Files (*.*)|*.*" --specify the filter
        theDialog.FilterIndex = 1 --set the filter drop-down list to All Files
        result = theDialog.showDialog() --display the dialog, get result into variable
        result.ToString() --when closed, convert the result to string
        result.Equals result.OK --returns TRUE if OK was pressed, FALSE otherwise
        result.Equals result.Cancel --returns TRUE if Cancel was pressed, FALSE otherwise
        theFilenames = theDialog.fileNames --the selected filenames will be returned as an array
        
        if (result.Equals result.OK) then (
        firstFreeSlot = selectedRef.texmap_num + 1
        
        for x=1 to selectedRef.texmap_num do (
        if ( selectedRef.texmap[x] == undefined ) then ( firstFreeSlot = x; exit )
        )
        if (selectedRef.texmap_num - firstFreeSlot + 1 < theFilenames.count) then selectedRef.addSubTex ( theFilenames.count - (selectedRef.texmap_num - firstFreeSlot + 1) )
        
        pos = selected.position
        pos[1] -= 150
        uvw=vrayuvwrandomizer()
        theView.createnode uvw &pos
        pos[1] += 100
        
        for i = 1 to theFilenames.count do(
        -- pos[2] -= 25
        bm=vraybitmap()
        bm.mapSource=uvw
        bm.HDRIMapName = theFilenames[i]
        selectedRef.texmap[i+firstFreeSlot-1] = bm
        theView.createnode bm &pos
        )
        
        )
        )
        
        
        load_images()

        Comment


        • #5
          Hi there, I found this Script very useful, I even improved a little bit adding Triplanar Texture, but now that MultisubTex has the BatchLoad its not quite perfect there are somethings that need to improve.
          Is there a possible way to Add Randomizer & Triplanar directly in the MultisubTex?
          Or maibe if you could give a tip in order to do my own script by selecting the desired maps that I want to Add those Maps?
          Carlos Rodriguez
          RTstudio
          Tutorials

          Comment


          • #6
            A similar question was asked in this thread. We've logged an issue for improvement.

            Dimitar

            Comment


            • #7
              Thanks Dimitar, thats my post, I also updated with an script that someone shared to me in a Facebook group
              Carlos Rodriguez
              RTstudio
              Tutorials

              Comment

              Working...
              X