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

 

 

 

转载于:https://www.cnblogs.com/sitt/archive/2012/12/19/2825292.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值