如何为一个文件渲染制作许多图片大小?

时间:2014-12-11 14:07:19

标签: 3dsmax maxscript

我正在尝试使Max Script可以将1个文件3Ds最大渲染为3个或更多文件图片大小。但我尝试了很多方法,没有任何代码可以帮助我做到这一点。

这是我的代码:

macroScript vrayStudioSetup category:"Multi Images" buttonText:"Multi-Images" tooltip:"Multi Images Setup"
(
rollout srsetup "Multi Images Setup" width:300 height:200
(
    GroupBox grp2 "Output Size" pos:[5,15] width:120 height:84
    checkbutton ckb_436 "436x380" pos:[15,35] width:100 height:15
    checkbutton ckb_218 "218x190" pos:[15,55] width:100 height:15

    radiobuttons rdo1 "Rendering Presets" pos:[160,15] width:90 height:62 labels:#("Low (Test)", "Medium (Test)", "High") default:1 columns:1

    button btn_render "Render!" pos:[160,90] width:125 height:40

    local sorigwidth = renderWidth
    local sorigheight = renderHeight

    fn setRenderResolution width height =
    (
        if (renderSceneDialog.isOpen()) then 
        (
            renderSceneDialog.close()
            renderHeight = height
            renderWidth = width
            renderSceneDialog.open()    
        )           
        else 
        (
            renderHeight = height
            renderWidth = width
        )
    )

    fn applyRenderSettings settings =
    (
       for i = 1 to settings.count do
       (
           rString = "renderers.current." + settings[i]
           execute rString
        )
    )
    fn CollectSettings x =
    (
        renderMed = #(
        "gi_on = true"
        ,"gi_refractCaustics = true"
        ,"gi_reflectCaustics = false"
        ,"gi_primary_type = 0"
        ,"gi_primary_multiplier = 1.0"
        ,"gi_secondary_type = 2"
        ,"gi_secondary_multiplier = 0.8"
        ,"gi_irradmap_minRate = -3"
        ,"gi_irradmap_maxRate = -1"
        ,"gi_irradmap_subdivs = 50"
        ,"gi_irradmap_interpSamples = 20"
        ,"gi_irradmap_colorThreshold = 0.4"
        ,"gi_irradmap_normalThreshold = 0.2"
        ,"gi_irradmap_distThreshold = 0.1"
        ,"adv_irradmap_calcInterpSamples = 15"
        ,"gi_irradmap_showCalcPhase = true"
        ,"dmcgi_subdivs = 10"
        ,"dmcgi_depth = 5"
        ,"dmc_importanceSampling = 1.0"
        ,"dmc_earlyTermination_amount = 0.85"
        ,"dmc_earlyTermination_threshold = 0.01"
        ,"dmc_earlyTermination_minSamples = 12"
        ,"dmc_subdivs_mult = 1"
        ,"imageSampler_type = 1"
        ,"twoLevel_baseSubdivs = 1"
        ,"twoLevel_fineSubdivs = 4"
        ,"twoLevel_useDMCSamplerThresh = true"
        ,"filter_on = true"
        ,"filter_kernel = Mitchell_Netravali()"
        ,"options_defaultLights = 0"
        ,"environment_gi_on = true"
        ,"environment_gi_color = [255,255,255]"
        ,"environment_gi_color_multiplier = 0.1"
        ,"environment_rr_on = true"
        ,"environment_rr_color = [0,0,0]"
        ,"environment_rr_color_multiplier = 1.0"
        ,"colorMapping_type = 1"
        ,"colorMapping_affectBackground = true"
        ,"colorMapping_clampOutput = true"
        ,"colorMapping_subpixel = true"
        ,"system_region_x = 64"
        ,"system_region_y =64"
        )
        renderHi = #(
        "gi_on = true"
        ,"gi_refractCaustics = true"
        ,"gi_reflectCaustics = false"
        ,"gi_primary_type = 0"
        ,"gi_primary_multiplier = 1.0"
        ,"gi_secondary_type = 2"
        ,"gi_secondary_multiplier = 0.8"
        ,"gi_irradmap_minRate = -3"
        ,"gi_irradmap_maxRate = 0"
        ,"gi_irradmap_subdivs = 70"
        ,"gi_irradmap_interpSamples = 20"
        ,"gi_irradmap_colorThreshold = 0.3"
        ,"gi_irradmap_normalThreshold = 0.1"
        ,"gi_irradmap_distThreshold = 0.1"
        ,"adv_irradmap_calcInterpSamples = 10"
        ,"gi_irradmap_showCalcPhase = true"
        ,"dmcgi_subdivs = 30"
        ,"dmcgi_depth = 20"
        ,"dmc_importanceSampling = 1.0"
        ,"dmc_earlyTermination_amount = 0.5"
        ,"dmc_earlyTermination_threshold = 0.005"
        ,"dmc_earlyTermination_minSamples = 14"
        ,"dmc_subdivs_mult = 1.5"
        ,"imageSampler_type = 1"
        ,"twoLevel_baseSubdivs = 1"
        ,"twoLevel_fineSubdivs = 30"
        ,"twoLevel_useDMCSamplerThresh = true"
        ,"filter_on = true"
        ,"filter_kernel = Mitchell_Netravali()"
        ,"options_defaultLights = 0"
        ,"environment_gi_on = true"
        ,"environment_gi_color = [255,255,255]"
        ,"environment_gi_color_multiplier = 0.1"
        ,"environment_rr_on = true"
        ,"environment_rr_color = [0,0,0]"
        ,"environment_rr_color_multiplier = 1.0"
        ,"colorMapping_type = 1"
        ,"colorMapping_affectBackground = true"
        ,"colorMapping_clampOutput = true"
        ,"colorMapping_subpixel = true"
        ,"system_region_x = 64"
        ,"system_region_y =64"
        )

        case rdo1.state of
        (
           1: applyRenderSettings renderMed
           2: applyRenderSettings renderHi
         )  
     )

    on ckb_436 changed state do
    (
                if state == on then 

                (
                    ckb_218.state = on
                    setRenderResolution 436 380
                )
                if state == off then
                (
                    setRenderResolution sorigwidth sorigheight 
                )
            )
    on ckb_218 changed state do
    (
                if state == on then 

                (
                    ckb_436.state = on
                    setRenderResolution 218 190     
                )
                if state == off then
                (
                    setRenderResolution sorigwidth sorigheight 
                )
            )

    on btn_render pressed do
    (
     CollectSettings 0
     max quick render
    )
)
r_studio = newrolloutfloater "Render Pictures" 315 165
addRollout srsetup r_studio rolledUp:false
)

当我点击选择2尺寸的图片并点击渲染时,它只能制作一个图片尺寸。 我不确切知道它是如何工作的,因为我只是新人。

1 个答案:

答案 0 :(得分:1)

您可以简化" setRenderResolution"像这样的ei。不要关闭并打开渲染对话框来更新它。

fn setRenderResolution width height =
(
    renderHeight = height
    renderWidth = width
    renderSceneDialog.update()
)