here is a small test that creates an 8bit indexed pallete png that works in SU
(dont know if your engine supports it)
you then go through all color materials, create pngs and replace the color with those textures
def create_small_png(red,green,blue, filename)
small_png = %{iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAABlBMVEUAAP8A
AAB7Yr8+AAAADklEQVR42mJgwAQAAQYAABQAAWhJMmMAAAAASUVORK5CYII=
}.unpack("m").to_s
color_pos = 41
small_png[color_pos] = red.chr
small_png[color_pos+1] = green.chr
small_png[color_pos+2] = blue.chr
File.open(filename,"wb") {|x| x.write small_png}
end
create_small_png(255,255,0,"d;/test.png")