Author : ysalex


Reply
Reply
 
Thread Tools Display Modes
JonMurphy's Avatar
Old (#1)
Ah, the joys of switching assets to a different engine. [img]/images/graemlins/confused.gif[/img]

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?
the artist formally known as BurntKona, remembers the q2pmp...
portfolio - Senior Artist (Full Fat)
Offline , triangle, 342 Posts, Join Date Oct 2004, Location Bristol, UK  
   Reply With Quote

Eric Chadwick's Avatar
Old (#2)
Kinda like MaterialReplacer, but not really.
http://plugins.angstraum.at/

One way that might work is to use BFF to convert the scene to a script file, then replace all the RGB Tints with a global replacer (I like ReplaceEm ), then load the script back in.

Although a script jock will probably come along with a better way...
Offline , Polycount.com Editor, 6,765 Posts, Join Date Oct 2004, Location Boston USA  
   Reply With Quote

CrazyButcher's Avatar
Old (#3)
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
)
)
3dsmax scripts and .fx - pixeljetstream - expressing my own opinions
Offline , dedicated polycounter, 1,348 Posts, Join Date Nov 2004, Location Germany Send a message via ICQ to CrazyButcher  
   Reply With Quote

JonMurphy's Avatar
Old (#4)
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. [img]/images/graemlins/frown.gif[/img]

*dives back into help files*
the artist formally known as BurntKona, remembers the q2pmp...
portfolio - Senior Artist (Full Fat)
Offline , triangle, 342 Posts, Join Date Oct 2004, Location Bristol, UK  
   Reply With Quote

CrazyButcher's Avatar
Old (#5)
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 />
3dsmax scripts and .fx - pixeljetstream - expressing my own opinions
Offline , dedicated polycounter, 1,348 Posts, Join Date Nov 2004, Location Germany Send a message via ICQ to CrazyButcher  
   Reply With Quote

JonMurphy's Avatar
Old (#6)
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
the artist formally known as BurntKona, remembers the q2pmp...
portfolio - Senior Artist (Full Fat)
Offline , triangle, 342 Posts, Join Date Oct 2004, Location Bristol, UK  
   Reply With Quote

CrazyButcher's Avatar
Old (#7)
oh you must run the function
removetint() on pressed, I fixed your utility here

http://planetquake.com/polycount/cot.../removetint.ms
3dsmax scripts and .fx - pixeljetstream - expressing my own opinions
Offline , dedicated polycounter, 1,348 Posts, Join Date Nov 2004, Location Germany Send a message via ICQ to CrazyButcher  
   Reply With Quote

JonMurphy's Avatar
Old (#8)
I owe you many, many cookies [img]/images/graemlins/smile.gif[/img]
the artist formally known as BurntKona, remembers the q2pmp...
portfolio - Senior Artist (Full Fat)
Offline , triangle, 342 Posts, Join Date Oct 2004, Location Bristol, UK  
   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Copyright 1998-2012 A. Risch