Forum Groups
  All forums
    Help & Feedback
      Work in progress
      Finished Art
      Non-Max related

Featured Threads
  inspiration alert!!!
(37 replies)
  Indespensible MaxScripts, Plugins and 3rd Party Tools
(37 replies)
  The allmighty FREE Resources Thread !
(17 replies)
  spam alert!!!
(4886 replies)
  Maxforums member photo gallery index
(114 replies)
  Maxforums Member Tutorials
(89 replies)
  three cheers to maxforums...
(240 replies)
  101 Things you didnt know in Max...
(198 replies)
  A Face tutorial from MDB101 :D
(95 replies) Members Gallery
(516 replies)
(637 replies)
  Dub's Maxscript Tutorial Index
(119 replies)

Maxunderground news unavailable

Baking diffuse colours to bitmap
show user profile  jpedleham
At work we have a model library with thousands of fixtures. At the moment they are all textured with multi sub materials with diffuse colours only. We use a VR engine that can handle multi subs with diffuse colours however we are looking to make the move to UDK and as far as i can tell UDK doesnt support standard colours, only bitmaps. Can anyone tell me if theres a script that will render a small square bitmap of the diffuse colour and then apply it to the diffuse slot?
Can anyone help with a method of possibly batch processing all of the 1000ish models in the library in this way and possibly make them share the same texture if the colour value is the same?
Its a big ask i know!

read 644 times
11/30/2014 2:53:08 PM (last edit: 11/30/2014 3:13:20 PM)
show user profile  herfst1
I can only think of one automated way, and that's to split each model/object into seperate material id's. e.g. say your model has 10 material id's then it'll become 10 sub-objects... which isn't ideal for exporting when you have 1000's of models. Plus, you said you would want to be able to recycle the same diffuse maps wherever possible, but that would only automatically work if your multi-sub materials are all in the same order e.g. red is in the first slot, blue in the second.

Here's a pitfall of baking out a small diffuse map:
1. You'll need to flatten the uv's so they don't overlap. Now they won't be organised into nice little bundles of seperate material id groups, they'll be scattered all over the uv map, so baking out a small diffuse will result in a tonne of colour bleeding.
2. You could show only individual id's in the uv editor and pack them (then move them across or up or down 1 square) and keep doing that till you have clusters of material id squares which you can then scale down into the uv square, but that will take a lot of time and isn't automatic (and you couldn't recycle diffuse maps).

So, yeah, I'd probably try organising the multi-sub materials into a consistent format (red first slot, blue second etc) and write a script to split each model into individual id groups. Maybe you could then attach all the material id 1 objects together, and material id 2 objects together and go from there.

All sounds very tiring.

read 638 times
11/30/2014 3:16:40 PM (last edit: 11/30/2014 3:16:40 PM)
show user profile  jpedleham
None of the models have proper uv unwrapping which wasnt essential for our original viewer. It might not be essential to reuse the maps really if the size is small enough since theyre plain colours. At the moment using UDK is just a concept that needs testing. Any idea how i can export the diffuse colour alone as a jpg. our original exporter did just that but we want to move away from it due to increasing annual fees.
read 636 times
11/30/2014 3:22:15 PM (last edit: 11/30/2014 3:22:15 PM)
show user profile  Garp
The way I'd do it is with one single bitmap.
A sketch of the code:
- collect all individual colors from all submats of all objects
- create a single bitmap with one little square per color (in theory, one pixel should be enough, but there could be some padding issue), keeping track of where each color goes
- create a set of mapping coordinates all set to zero for each object
- for each submat, assign the bitmap, retrieve the position in it for the current color, compute and apply corresponding offsets

Disclaimer: I haven't put much though into it, it's sunday and I'm not entirely sober. So there could be a big hole in my logic.

If you keep having problems like this you might consider hiring a programmer. Asking on forums will only get you so far.

read 627 times
11/30/2014 4:19:14 PM (last edit: 11/30/2014 4:20:30 PM)
show user profile  jpedleham
Yeah im recovering from a heavy night too, this might not be the best way of doing this. Perhaps UDK forums might be more informed as to the ins and outs of UDK and whether it can grab diffuse colours from the fbx file. Ill figure something out im sure!
Programmer wise its not an essential project at the moment its just something that would make our department look better in exec meetings and so we have more functionality in the future. Ill see what i can find out. maybe i could use the old exporter to get the diffuse colour maps then just apply them. itll take some time but im sure itll be worth it in the end. At least now i can get some nice normal mapping and realtime lighting going!
read 624 times
11/30/2014 4:44:29 PM (last edit: 11/30/2014 4:44:29 PM)
show user profile  Garp
Sounds like a plan :)

read 622 times
11/30/2014 4:45:38 PM (last edit: 11/30/2014 4:45:38 PM)
show user profile  jpedleham
Im an idiot. the models already share bitmaps for their colours. it just so happened that the one i selected from the library for testing only had diffuse colours not bitmaps. what are the chances.
read 615 times
11/30/2014 5:15:28 PM (last edit: 11/30/2014 5:15:28 PM)
#Maxforums IRC
Open chat window