zoukankan      html  css  js  c++  java
  • MaxScript获取材质缩略图的方法

    看到有人需要,简单写了一下

    Fn GetMaterialSample inputMaterial inputWidth inputHeight =
    (
        result = undefined
        with redraw off
        with undo off
        (
            tempHiddenObject = for tempObject in Objects where not tempObject.ishidden collect tempObject
            Hide tempHiddenObject
            tempCamera = Freecamera fov:45 targetDistance:50 nearclip:1 farclip:1000 nearrange:0 farrange:1000 mpassEnabled:off mpassRenderPerPass:off pos:[0,0,40]
            tempBackground = Plane pos:[0,0,-10] Length:150 Width:150 wireColor:gray
            tempSphere = Sphere pos:[0,0,0] rotation:(quat 0.707107 0 0 0.707107) wirecolor:gray radius:10 smooth:on segs:32 chop:0 slice:off sliceFrom:0 sliceTo:0 mapcoords:on recenter:off
            tempSphere.material = inputMaterial
            for tempLight in Lights where IsProperty tempLight #excludeList do 
            (
                tempLight.excludeList = Append tempLight.excludeList tempSphere
                tempLight.excludeList = Append tempLight.excludeList tempBackground
            )
            tempLight = Omnilight multiplier:1 pos:[20,20,40]
            tempLight2 = Omnilight multiplier:0.6 pos:[-15,-20,0]
            result = render camera:tempCamera outputsize:[inputWidth,inputHeight] vfb:false
            delete #(tempCamera,tempLight,tempLight2,tempSphere,tempBackground)
            UnHide tempHiddenObject
        )
        result
    )
    
    try(DestroyDialog TestRollout)catch()
    Rollout TestRollout ""
    (
        Bitmap MaterialSampleBitMap bitmap:(GetMaterialSample MeditMaterials[1] 100 100)
    )
    
    CreateDialog TestRollout
  • 相关阅读:
    【个人杂谈】MacBook Pro的使用心得
    【网页加速】lua redis的二次升级
    使用Openresty加快网页速度
    中间件——canal小记
    Java面试总结(二)
    RedissonLock分布式锁源码分析
    面试总结
    Spring AOP小记
    谈谈个人网站的建立(八)—— 缓存的使用
    Kafka、Logstash、Nginx日志收集入门
  • 原文地址:https://www.cnblogs.com/sitt/p/2825292.html
Copyright © 2011-2022 走看看