Page 1 of 1

per object based map assignment

Unread postPosted: Sun Mar 31, 2019 11:19 pm
by lafrance
Hello,
I'm trying to set up a map file to choose the correct map based on the mesh object it is attached to.
I have a crude system working right now:
object's shading variable set to

DiffuseMap = "$MapDir/Mars01_005_Color_x0_y0.png"

and map file's filename set to

DiffuseMap

while this is working, it's pretty inefficient, as I would have to add this entry to every object, and worse, add another entry for every other map.
I would like a system that is smart enough to get the correct info from the object, and construct the proper path name.
I'm pretty sure expressions offer the possibility of this more robust approach, in particular the get_name() function. I wouldn't mind adding a variable for every object that just held it's tile string, but I can't figure out how to get expressions to evaluate a locally defined variable.

Any advice, including completely different approaches, appreciated,

thanks much

Re: per object based map assignment

Unread postPosted: Mon Apr 01, 2019 1:03 pm
by dboude
Hi,

It isn't possible to declare a shading variable with some SeExpr snippet inside. (But I added a feature request for that)

However, you have several workflows to use shading variables and fill them automatically.
- You can make a script that writes shading variables based on the objects names.
- You can export your object from your DCC package with custom attributes defining the paths and then read those attributes to write shading variables.

Cheers ;)

Re: per object based map assignment

Unread postPosted: Mon Apr 01, 2019 2:43 pm
by lafrance
THanks Demian.
My geo is coming out of World Machine, so, afaik there is no mechanism for adding custom attributes there.
Which leaves the scripting option, which I'll look into.

thanks much

Brian