For a lot of jobs I need to plug in quite a lot of textures into ExtaTex renderelements. Loading these into the material editor, naming them and then adding them one by one into the render elements is very time consuming.
Is there a way (through scripting or so) to be able to add a desired number of extratex elements at once and then preferably at the same time connect those with textures that I choose from a folder - or something similar?
Does anybody know of any script I couldnt find or any way to write this on my own (I totally dont know how to write scripts).
Yeah, that would help bringing in a lot of extratex and not adding them one by one - although one would have to be careful to do that first instead of overwriting whatever already was in the renderlements.
But it doesnt help adding the maps into all these extratex slots. Ideally I would like to just choose a folder and the extratex elements will be added, linked already to the bitmaps…
Prepare your Elements, then save as a Preset for Render Setup. You get the option to save based on the tabs…so you can choose to just save the Elements and not the rest of the render settings.
So do you simply need a bunch of VRayExtraTex elements that each has a different Bitmap Texturemap ( “some.png”) in it or something else?
I’m not sure I understood the part “connect those with textures that I choose from a folder” part.
First problem was to add lots of extratex-elements without having to go into the add menu one by one. Lets say that is solved by preparing a long list and saving as render elements and then importing.
Lets say I have 20 textures I need to output as extratex. I would need to input each texture into a separate extratex, one by one. Instead of doing this I would like to tell 3dsmax to add a whole folder of textures as extratex elements.
/*******************************************************************************
* Creates VRayEtxraTex render elements en masse
*
* License: LEGOware. Send the author LEGO if you use it for commercial purposes.
* Author: Daniel Schmidt (mail@daniel-schmidt.biz)
* Version: 0.1
*******************************************************************************/
function createExtraTex f =
(
local el = VRayExtraTex()
local name = getFilenameFile(f)
--el.auto_update_name = false
--el.elementName = “ET_” + name
el.texture = Bitmaptexture fileName:f name:name
el
)
function chooseFiles =
(
local filenames = #()
local dlg = dotNetObject “System.Windows.Forms.OpenFileDialog”
dlg.title = “Please choose one or more image files”
dlg.Multiselect = true
dlg.Filter = “All Files (*.*)|*.*”
-- dlg.FilterIndex = 1
local result = dlg.showDialog()
if (result.Equals result.OK) do
filenames = dlg.fileNames
filenames
)
function massCreateExraTexElements =
(
local rem = maxOps.GetCurRenderElementMgr()
for f in chooseFiles() do
(
local tex = createExtraTex f
rem.AddRenderElement tex
)
)
Wow, beautiful! Almost perfect! Danke, Daniel!
Is there a way to change the elements name to say “ExtraTex” or just “Tex” and also uncheck the auto update name option? I had some trouble with it in the past when I changed the bitmaps. Cant really remember, but I always uncheck it.
Anyway, thank you so much!
I kind of anticipated that, but kept the default behaviour. Open the file (Scripting > Open Script…) then in the function createExtraTex remove “--” in front of 2 of the lines. Oh and make sure you read the License restrictions for commercial use at the top
Officially licensed to Manuel :-).
I always admired the LEGO building instructions as a kid and wondered how they are done - guess that got me into 3D.
Sooooo, I`ve been using your awesome script until now but just had some trouble with the normal 3ds max bitmaps and decided to use only VrayHdri maps from now. Would also like to set the color space settings to srgb in that. And maybe take out the blur…
how could I change your script towards?
I looked at it but dont have a clue where to start
If you have any free time, would be great if you could help me!
Manuel
Open MAXScript Listener (Scripting > MAXScript Listener) and enable MacroRecorder (MacroRecorder > Enable). Then go to Material Editor and create a VRayHDRI map. Watch what the Listener prints. Pick a new filename and watch what it prints again (the filename the Listener prints will look strange, ignore it). Now change color space and watch what it prints again. Based on the MAXScript Listener output I learned the parameter names and that sRGB space has the value of 2. So now I could make changes to the script.
For the layzy ones make the following changes to the script function createExtraTex. The line that previously assigned the Bitmap texture has been replaced (actually disabled and added 2 new lines):
--el.texture = Bitmaptexture fileName:f name:name -- creates a Bitmap texturemap
el.texture = VRayHDRI HDRIMapName:f name:name -- creates a VRayHDRI
el.texture.color_space = 2 -- set VRayHDRI colorspace to sRGB