Forums
You are not logged in.
#1 2010-12-22 05:43:04
- caveman
- Member
- From: Mumbai
- Registered: 2009-12-15
- Posts: 100
tdlmake on multiple files
Hi
I was going through the tdlmake page of 3Delight manual .
There they have shown an illustration where you can batch convert multiple files into one file.
I have 3 textures in d:\temp as a1b.tif, a2b.tif, a3b.tif
how do i batch tdlmake all the 3 textures in one go?
Sushant Acharekar
Offline
#2 2010-12-22 06:07:53
- mistermatti
- Member
- From: Stuttgart, Germany
- Registered: 2009-10-11
- Posts: 39
Re: tdlmake on multiple files
For things like these and to integrate these issues into a pipeline I usually write a couple lines of python to convert all files in a directory... Is that what you meant?
Copied from one of my scripts, you'll have to test and change stuff to make it work for you. Quick and dirty... I have this being executed from maya and have maya push data about the current asset into the script to determine where the textures are located etc. This is a stripped version...
Code:
cwd = os.getcwd()
if not os.path.exists( cwd.replace( 'tif', 'tdl' ) ):
os.mkdir( cwd.replace( 'tif', 'tdl' ) )
allFiles = os.listdir(cwd)
for file in allFiles:
if file.endswith('.tif'):
src = os.path.join( cwd, file )
dest = os.path.join( cwd.replace( '/tif/', '/tdl/' ), file.replace( 'tif', 'tdl' ))
print src, dest
if 'COL' in file:
cmd = "tdlmake -byte -colorspace srgb -newer %s %s" % ( src, dest )
os.popen( cmd )
else:
cmd = "tdlmake -newer %s %s " %( os.path.join( cwd, file ), os.path.join( cwd.replace( '/tif/', '/tdl/' ), file.replace( 'tif', 'tdl' )) )
os.popen( cmd )and yeah, I know that there are a couple things you could do nicer in the code :)
edit: Did I get you correctly at all? What do you mean by converting multiple files into one file?
Last edited by mistermatti (2010-12-22 06:13:03)
matti 'mistermatti' gruener
the /*jupiter jazz*/ group
Offline
#3 2010-12-22 07:01:10
Re: tdlmake on multiple files
zsh:
Code:
for tex in *.tif; do tdlmake $tex $tex:r.tdl; done
.mm
Last edited by Mauritius (2010-12-22 07:01:29)
Render faster, get to the party earlier — /*jupiter jazz*/
Offline
#4 2010-12-22 07:31:37
- mistermatti
- Member
- From: Stuttgart, Germany
- Registered: 2009-10-11
- Posts: 39
Re: tdlmake on multiple files
Hehe, yep. I have a button in Maya that converts the textures for the currently openened asset and thats just easier to do in Python,- at least for me. It also changes it's behaviour concerning colorspace according to the texture type. I am sure you can do that in zsh too tho. :)
Last edited by mistermatti (2010-12-22 07:32:13)
matti 'mistermatti' gruener
the /*jupiter jazz*/ group
Offline
#5 2010-12-22 08:30:00
Re: tdlmake on multiple files
Hello Caveman,
If you don't want to get into more troubles than necessary, don't listen to Moritz and Mistermatti :) You would have to install software in order to do what you want which is crazy. Instead, you could simply do a batch for loop:
Code:
for %f in (*.tif) do tdlmake.exe %i %i.tdl
The only problem is that your files will be named something like texture.tif.tdl. This is not a big deal. You can probably do something better but I am not a batch expert ...
-- aghiles
Last edited by aghiles (2010-12-22 08:30:32)
Offline
#6 2010-12-22 08:35:52
- mistermatti
- Member
- From: Stuttgart, Germany
- Registered: 2009-10-11
- Posts: 39
Re: tdlmake on multiple files
Hehe, just to defend myself: On a decent OS, Python comes preinstalled ;)
matti 'mistermatti' gruener
the /*jupiter jazz*/ group
Offline
#7 2011-01-11 07:39:25
- leeway
- New member
- Registered: 2010-11-27
- Posts: 5
Re: tdlmake on multiple files
Hi guys
i made a GUI for tdlmake with python.(windows only) it can convert multiple pics to tdls
it works well so far and i wanna share with you ,hope you guys like it.
tdlconverter
you can download here
http://hotfile.com/dl/95917482/e973ae5/ … r.rar.html
how to use it :
if you have several pics in d:\picshere\
just fill in the first blank "d:\picshere\" (without quotation marks)
and fill in the second blank any options if necessary such as "-lzw -float"(without quotation marks)
then this programme will make a .bat file in the pic folder as temporary
and execute it in a windows shell(background)
Enjoy!
thank dna research !
im a python rookie,this is my first programme
have not tested enough yet
if any bugs ,please let me know
Leeway
iamleeway@126.com
Offline
#8 2011-06-02 00:24:58
- caveman
- Member
- From: Mumbai
- Registered: 2009-12-15
- Posts: 100
Re: tdlmake on multiple files
thanks all
i am using windows so ...
@aghiles i guess the batch code has to be
for %f in (*.tif) do tdlmake.exe %f %f.tdl
instead of %i
@ leeway ill def give it a try...
Sushant Acharekar
Offline
#9 2011-08-07 14:41:03
- Megacortex
- Member
- From: Canada Québec Montreal
- Registered: 2009-04-26
- Posts: 14
- Website
Re: tdlmake on multiple files
hello
this one work fine for me
for %%f in (*.jpg *.tif) do tdlmake.exe %%f %%~nf.tdl
Last edited by Megacortex (2011-08-07 14:46:47)
Offline
#10 2012-02-03 14:12:12
- luis_pages
- New member
- Registered: 2012-01-20
- Posts: 3
Re: tdlmake on multiple files
Hello everyone,
I was wondering if you have tried to do this on a mac, I'm trying this: for %%f in [*.hdr] do tdlmake %%f %%~nf.tdl
But no luck, any ideas?
Thanks
Offline
#12 2012-02-06 17:54:48
- luis_pages
- New member
- Registered: 2012-01-20
- Posts: 3
Re: tdlmake on multiple files
Thank you Aghiles, Moritz, it works like a charm.
Cheers
Offline
#13 2012-03-07 07:21:47
- caveman
- Member
- From: Mumbai
- Registered: 2009-12-15
- Posts: 100
Re: tdlmake on multiple files
Megacortex wrote:
hello
this one work fine for me
for %%f in (*.jpg *.tif) do tdlmake.exe %%f %%~nf.tdl
Thanks .... this really makes a difference...
Sushant Acharekar
Offline
#14 2012-04-16 19:04:19
- DavC
- Member
- Registered: 2011-07-13
- Posts: 20
Re: tdlmake on multiple files
Well for what it's worth, I'll show my solution to the problem. Of course, it's python ;)
I found it necessary to add different options to different files, e.g. 32-bit displacement maps as a "linear" colour space, and an 8-bit colour map as "srgb" colour space. And my solution needed to "scale" well too, which I think it does, it works just as well for 10 files as it does 100 files.
My solution was to enable the directory name under the "<project>/sourceimages/" directory to guide the options automatically given to tdlmake. Note: Only files in "<project>/sourceimages/convert" are converted to .tdl, this seems a cleaner approach than converting all files under "<project>/sourceimages/*". All the output .tdl's are located in "<project>/sourceimages/". For example, accessing the textures is as simple as "<project>/sourceimages/texture.tdl" in a shader string parameter.
So the file "<project>/sourceimages/convert/srgb/colour_map.png" will automatically be given the "-colorspace srgb" flag, and the file "<project>/sourceimages/convert/float/linear/latlong/hdri_map.hdr" will automatically be given the "-float -colorspace linear -envlatl" flags.
It's basically a remapping of tdlmake's options into a directory tree.
You can download a tar.gz with the .bat, .sh and a list of "options"/directories from the link below.
http://dl.dropbox.com/u/3382126/Code/dc … TDL.tar.gz
Have fun :)
David Cattermole
Offline
#15 2012-04-16 23:35:35
- Megacortex
- Member
- From: Canada Québec Montreal
- Registered: 2009-04-26
- Posts: 14
- Website
Re: tdlmake on multiple files
hello all
here there is a good utility for that http://www.3db-site.com/html/melscripts.php
thank you to the creator http://www.3db-site.com/home.php
Offline

