Hi, all!
I’m writing a custom tool here (actually a macroscript) to set a number of things in VRay, including the render passes, but I hit a wall.
The thing is I wanted to make the VRayExtraTex pass come already with a VRayDirt map, pre-configured for AO, but can’t figure out a way to do so.
I’m pretty sure it’s simple, but as far as my coding habilities go, I can’t find a way to do it. Anyone?
Any help is much appreciated.
Cheers!
Rick Eloy
can you get around this by loading a preset with the elements saved in it?
I probably could, but the problem is the map configuration. Presets don’t, AFAIK, hold any information about maps that might be used by the render elements. So what I need here is not only the render element itself (which I already did via scripting and was relatively straight forward), but the dirt map to be loaded and pre-configured.
holds the map fine on my end.
Hum… gonna check it asap. Thanks!
Tried it here, cubiclegangster, not to much success. There are also other things I was trying to configure via scripting, for instance the zdepth max distance and a parametric file name system (following Allan McKay’s script), and a preset won’t do here.
The goal is to have a dialog box with some parameters available to be configured (on/off and some numeric values as well) without having to actually open V-Ray. A bit more complicated, I’m afraid.
I didnt mean use the preset instead of a script. i meant have your script load the preset with dirt then do everything else it needs to.
Here you go:
RE = maxOps.GetCurRenderElementMgr()
aoDirt = VRayDirt radius:1.0 occluded_color:(color 0 0 0) unoccluded_color:(color 255 255 255) subdivs:12 -- create the VRayDirt map
re.addRenderElement (VRayExtraTex elementname:"Ambient Occlusion" texture:aoDirt)
Great stuff, MoonDoggie! Just what I was looking for!
Just for the record, this is what I have so far (lots of stuff found on the help files, other figured out myself, and so on…). Nevermind the “noobieness” of the script nor the comments in Portuguese. ![]()
Code:
-- This script is based on Allan McKay’s free video TDT 1 (http://www.tdtransformation.com/fe/68096-td-transformation-video-1)
-- macroscript Renderizar category:“Rick Eloy” Tooltip:“Controle do Render”
(
-- Fecha a caixa de diálogo de render para poder atualizar
renderSceneDialog.close()
-- Define a variável vr como sendo o VRay
vr=renderers.current
-- Especifica o diretório onde salvar (pode estar na rede, desde que tenha uma letra fixa)
MyDir = “C:/Temp”
-- Cria o diretório para os arquivos da cena específica
PassName = substring maxfilename 1 (maxfilename.count - 4) -- cria uma variável que é o nome do arquivo SEM o .MAX
RenDir = MyDir + “/” + PassName -- variável que define onde salvar e o diretório com o nome da cena
MakeDir RenDir -- Efetivamente cria o diretório com os nomes definidos acima
RenFile = RenDir + “/” + PassName + “.exr” -- variável que define o nome do arquivo RAW salvo, com a extensão EXR
RenFile2 = RenDir + “/” + PassName + “.png” -- variável que define o nome do arquivo NORMAL salvo, com a extensão PNG
/*
Se quiser salvar direto pelo frame buffer do Max, descomente essas duas linhas
--rendSaveFile = true
-- rendoutputfilename = RenFile
*/
-- Configura o VRay Frame Buffer
vr.output_on = true -- liga o VRayFrameBuffer
vr.output_useram = true -- liga ou desliga o Memory frame buffer
vr.output_fileOnly = true
vr.output_saveFile = true
-- vr.output_fileName = RenFile2
-- A seguir, desligamos o Get Resolution from Max e definimos manualmente o tamanho do render
vr.output_getsetsfrommax = true -- liga ou desliga o Get Resolution
vr.output_width = 2000 -- define a largura do render
vr.output_height = 1125 -- define a altura do render
-- Vai salvar como RAW?
vr.output_saveRawFile = true -- liga ou desliga o V-Ray raw image file
vr.output_rawFileName = RenFile -- endereço onde salvar
vr.output_genpreview = true -- liga ou desliga o Generate Preview quando salvando RAW
-- Vai salvar como PNG?
vr.output_splitgbuffer = true -- liga ou desliga o Separate Render Channels
vr.output_splitfilename = RenFile2 -- define o nome do arquivo que vai ser salvo pelos canais separados (PNG)
-- Adicionando os render elements mais comuns
elementlist = #(VRayAlpha,VRayBackground,VRayDiffuseFilter,VRayGlobalIllumination,VRayLighting,VRayReflection,VRayRefraction,VRayShadows,VRaySpecular,VRayWireColor,VRayZDepth)
re = maxOps.GetCurRenderElementMgr() -- get the current render element manager
re.removeallrenderelements() -- remove all renderelements
re.numrenderelements() -- get number of render elements
-- Adicionando o VRayDirt ao VRayExtraTex
aoDirt = VRayDirt radius:10.0 occluded_color:(color 0 0 0) unoccluded_color:(color 255 255 255) falloff:1.0 subdivs:32 -- create the VRayDirt map
re.addRenderElement (VRayExtraTex elementname:“_RENDER ELEMENTS_Ambient Occlusion” texture:aoDirt)
theManager = maxOps.GetRenderElementMgr production
theManager.numrenderelements()
-- adds all renderelements to be rendered.
for n in elementlist do
(
re.addrenderelement (n elementname:(“_RENDER ELEMENTS_”+ (n as string)))
format “\nAdded % renderelement” n
)
setsilentmode true -- used to avoid error message when checking the filename of element
)