PDA

View Full Version : Removing RGB Tint en-mass


JonMurphy
09-26-2005, 09:22 AM
Ah, the joys of switching assets to a different engine. /images/graemlins/confused.gif

Anyway, the issue is this. We have an environment, in MAX 5. All the materials have a structure like this:

Diffuse - RGB Tint - Bitmap

Unfortunately, the engine we are switching to, the exporters do not recognise the RGB Tint, and is dropping the bitmap, so we have a very flat world. Resources are tight atm, so rather than re-tooling the exporter, I need to find a solution in MAX. I would like to keep the RGB Tint in the materials, as this gives me the opportunity to lay down blocks of colour to multiplay over bitmaps.

I need to figure out a MAXScript to take

Diffuse - RGB Tint - Bitmap

and give me:

Diffuse - Bitmap

Unfortunately, I don't have my MAXScript books with me here at work, or I would be plugging away now. Was wondering if any MAXScript gurus knew of anything already out there that could do this, or a suitable script that can be jerry-rigged into the task?

Eric Chadwick
09-26-2005, 10:12 AM
Kinda like MaterialReplacer, but not really.
http://plugins.angstraum.at/

One way that might work is to use BFF (http://www.scriptspot.com/bobo/darkmoon/) to convert the scene to a script file, then replace all the RGB Tints with a global replacer (I like ReplaceEm (http://www.orbit.org/replace/) ), then load the script back in.

Although a script jock will probably come along with a better way...

CrazyButcher
09-26-2005, 11:03 AM
not tested but maybe this does the job, assuming you use standardmaterial:

-- remove rgbtint

for m in scenematerials do (
if (classof m == standardmaterial and classof m.diffusemap == rgb_tint) then
(
m.diffusemap = m.diffusemap.map1
)
)

JonMurphy
09-27-2005, 01:52 AM
No dice on that, I'm afraid.

The trouble is, I need to find away of copying the bitmap value sitting in the RGB tint slot, and pasting that into the diffuse.

All materials are standard, but they are sitting in multi-sub lists.

Not done MAXScript for materials before. /images/graemlins/frown.gif

*dives back into help files*

CrazyButcher
09-27-2005, 02:20 AM
this here should work (at least did for me)

<font class="small">Code:</font><hr /><pre>
function relink_diffuse m = (
if (classof m.diffusemap == rgb_tint) then
(
m.diffusemap = m.diffusemap.map1
)
)

function process_mat m = (
if (classof m == standardmaterial) then (
relink_diffuse m
)
else if (classof m == multimaterial) then
(
for subs in m.materiallist do (
process_mat subs
)
)
)

function removetint = (
for m in scenematerials do (
process_mat m
)
)
</pre><hr />

JonMurphy
09-27-2005, 02:52 AM
I get

<font class="small">Code:</font><hr /><pre>-- Syntax error: at ), expected &lt;factor&gt;
-- In line: )</pre><hr />

When pasted into the MAXscript listener

I have tried wrapping it in a utility, but I get feedback on the listener with that, and nothing happening.

<font class="small">Code:</font><hr /><pre>Utility removergbtint "Remove RGB Tint"
(

Button remove "Remove RGB Tint"
on remove pressed do
(

function relink_diffuse m = (

if (classof m.diffusemap == rgb_tint) then

(

m.diffusemap = m.diffusemap.map1

)

)



function process_mat m = (

if (classof m == standardmaterial) then (

relink_diffuse m

)

else if (classof m == multimaterial) then

(

for subs in m.materiallist do (

process_mat subs

)

)

)



function removetint = (

for m in scenematerials do (

process_mat m

)

)

)
)</pre><hr />
Using MAX 5 here

CrazyButcher
09-27-2005, 04:36 AM
oh you must run the function
removetint() on pressed, I fixed your utility here

http://planetquake.com/polycount/cottages/crazybutcher/code/removetint.ms

JonMurphy
09-27-2005, 04:55 AM
I owe you many, many cookies /images/graemlins/smile.gif