Somewhat Configurable Object IDs Workaround!

Forums: Somewhat Configurable Object IDs Workaround!
Tutorials for OctaneRender - demonstrations and howto's.

Somewhat Configurable Object IDs Workaround!

Postby caffe3 » Fri Mar 27, 2015 1:04 am

caffe3 Fri Mar 27, 2015 1:04 am
Problem:
If you are like me and like to render everything in one go (not re-rendering a scene multiple times) AND want to have control in compositing, Object ID's are usually a good way to go. But they're not configurable (yet!... I hope :P) so it presents some issues.

- Not being able to set the color of each objects ID means you sometimes get colors that are more difficult to use as masks (like faint colors or similar colors to objects nearby)
- Say you have 50 spheres and 50 cubes in a scene. In compositing you want to have one single mask for all the cubes. To do this you'll have to have a lot of patience to combine 50 of the different colored IDs into one.

Layer masks is an alternative (more commonly used) which works even better than Object ID's, UNLESS you have objects intersecting, in which case the mattes/masks will overlap in a way that they leave a blank/transparent space between them that's almost 1px wide. A workaround for this is to make one mask of the group of objects for cutting, and then multiple masks for individual objects in the group for editing (like color correcting and applying filters). But since there's no way to get all these mattes in one single render, this is not an option either! :D

Solution (I'm using C4D, but I imagine the solution is the same for all):
What I find works is using Render layer to isolate (cut out, if you will) a group of objects which you want to composite with a different background, and then use Render Layer ID info pass (as an alternative to Object ID info pass) to create masks for individual objects inside that group.

1. Enable Render layer with Active Layer set to 1 and tick the Invert box (important, will explain later).
2. Tick the Render Layer ID option under Info passes.
3. Add Object Tags to all objects in the scene.
4. Set the Layer ID in Object Tag of objects you want invisible to 1. This is usually some type of floor which catches shadows. Or maybe just other objects you don't want in the final render. Or if you don't have any other objects, just skip this step.
5. Set the Layer ID in Object Tag of objects you want to belong to one group of "Object ID's" a certain number above 1 (not 1).
6. Set the Layer ID in Object Tag of objects you want to belong to another group of "Object ID's" another number above 1 (not 1 or same as above).

Now with the Render Layer ID you should be able to see three (if you did step 4, otherwise 2) different colors in the Live Viewer. So we have our groups set for the "Object ID's", changing their color is done by simply changing their Layer ID in the Object Tags. So select all of the Object Tags of a group at once, and change the Layer ID to get a different color until you have one that's vivid and different from the others.

Good Layer IDs - UPDATED based on stratified's info below:
73 = Red
18 = Green
36 = Blue
45 = Magenta
54 = Cyan
27 = Yellowish
63 = As close to White as possible
64 = As close to Black as possible
Last edited by caffe3 on Fri Mar 27, 2015 4:51 pm, edited 2 times in total.
caffe3
Licensed Customer
Licensed Customer
 
Posts: 58
Joined: Tue Dec 09, 2014 5:30 am

Re: Somewhat Configurable Object IDs Workaround!

Postby stratified » Fri Mar 27, 2015 1:45 am

stratified Fri Mar 27, 2015 1:45 am
Yep, that's a clever way to have (semi) configurable masks.

As a side note, the info channels kernel tries to assign as much contrast as possible between consecutive ids (be it material ids, object ids or light ids). The assignment is not random (but I don't remember the name of the scheme). Below is a table for the colors of the ids ranging from 1 to 100.

Code: Select all
+-----+-----+-----+-----+
+ ID  +   R +   G +   B +
+-----+-----+-----+-----+
|   1 | 128 |   0 |   0 |
|   2 |   0 | 128 |   0 |
|   3 | 128 | 128 |   0 |
|   4 |   0 |   0 | 128 |
|   5 | 128 |   0 | 128 |
|   6 |   0 | 128 | 128 |
|   7 | 128 | 128 | 128 |
|   8 |  64 |   0 |   0 |
|   9 | 192 |   0 |   0 |
|  10 |  64 | 128 |   0 |
|  11 | 192 | 128 |   0 |
|  12 |  64 |   0 | 128 |
|  13 | 192 |   0 | 128 |
|  14 |  64 | 128 | 128 |
|  15 | 192 | 128 | 128 |
|  16 |   0 |  64 |   0 |
|  17 | 128 |  64 |   0 |
|  18 |   0 | 192 |   0 |
|  19 | 128 | 192 |   0 |
|  20 |   0 |  64 | 128 |
|  21 | 128 |  64 | 128 |
|  22 |   0 | 192 | 128 |
|  23 | 128 | 192 | 128 |
|  24 |  64 |  64 |   0 |
|  25 | 192 |  64 |   0 |
|  26 |  64 | 192 |   0 |
|  27 | 192 | 192 |   0 |
|  28 |  64 |  64 | 128 |
|  29 | 192 |  64 | 128 |
|  30 |  64 | 192 | 128 |
|  31 | 192 | 192 | 128 |
|  32 |   0 |   0 |  64 |
|  33 | 128 |   0 |  64 |
|  34 |   0 | 128 |  64 |
|  35 | 128 | 128 |  64 |
|  36 |   0 |   0 | 192 |
|  37 | 128 |   0 | 192 |
|  38 |   0 | 128 | 192 |
|  39 | 128 | 128 | 192 |
|  40 |  64 |   0 |  64 |
|  41 | 192 |   0 |  64 |
|  42 |  64 | 128 |  64 |
|  43 | 192 | 128 |  64 |
|  44 |  64 |   0 | 192 |
|  45 | 192 |   0 | 192 |
|  46 |  64 | 128 | 192 |
|  47 | 192 | 128 | 192 |
|  48 |   0 |  64 |  64 |
|  49 | 128 |  64 |  64 |
|  50 |   0 | 192 |  64 |
|  51 | 128 | 192 |  64 |
|  52 |   0 |  64 | 192 |
|  53 | 128 |  64 | 192 |
|  54 |   0 | 192 | 192 |
|  55 | 128 | 192 | 192 |
|  56 |  64 |  64 |  64 |
|  57 | 192 |  64 |  64 |
|  58 |  64 | 192 |  64 |
|  59 | 192 | 192 |  64 |
|  60 |  64 |  64 | 192 |
|  61 | 192 |  64 | 192 |
|  62 |  64 | 192 | 192 |
|  63 | 192 | 192 | 192 |
|  64 |  32 |   0 |   0 |
|  65 | 160 |   0 |   0 |
|  66 |  32 | 128 |   0 |
|  67 | 160 | 128 |   0 |
|  68 |  32 |   0 | 128 |
|  69 | 160 |   0 | 128 |
|  70 |  32 | 128 | 128 |
|  71 | 160 | 128 | 128 |
|  72 |  96 |   0 |   0 |
|  73 | 224 |   0 |   0 |
|  74 |  96 | 128 |   0 |
|  75 | 224 | 128 |   0 |
|  76 |  96 |   0 | 128 |
|  77 | 224 |   0 | 128 |
|  78 |  96 | 128 | 128 |
|  79 | 224 | 128 | 128 |
|  80 |  32 |  64 |   0 |
|  81 | 160 |  64 |   0 |
|  82 |  32 | 192 |   0 |
|  83 | 160 | 192 |   0 |
|  84 |  32 |  64 | 128 |
|  85 | 160 |  64 | 128 |
|  86 |  32 | 192 | 128 |
|  87 | 160 | 192 | 128 |
|  88 |  96 |  64 |   0 |
|  89 | 224 |  64 |   0 |
|  90 |  96 | 192 |   0 |
|  91 | 224 | 192 |   0 |
|  92 |  96 |  64 | 128 |
|  93 | 224 |  64 | 128 |
|  94 |  96 | 192 | 128 |
|  95 | 224 | 192 | 128 |
|  96 |  32 |   0 |  64 |
|  97 | 160 |   0 |  64 |
|  98 |  32 | 128 |  64 |
|  99 | 160 | 128 |  64 |
| 100 |  32 |   0 | 192 |
+-----+-----+-----+-----+
User avatar
stratified
OctaneRender Team
OctaneRender Team
 
Posts: 945
Joined: Wed Aug 15, 2012 6:32 am
Location: Auckland, New Zealand

Re: Somewhat Configurable Object IDs Workaround!

Postby caffe3 » Fri Mar 27, 2015 3:26 am

caffe3 Fri Mar 27, 2015 3:26 am
Nice, thanks for giving a glimpse of what goes on under the hood! :) The table will come in handy!

It feels like the assignment of colors is doing what you've explained, but it also feels like it's washing out the colors a bit as it takes into account that it has to work for 100 ids, or something. Cause I'd expect the first three ids to be (255,0,0), (0,255,0) and (0,0,255).

I'm sure the way it does it is perfectly fine. But with my limited knowledge in making use of Object/Material IDs (I usually use black and white mattes) in compositing, and the fact that I don't use more than 2-4 ids, I feel more comfortable being able to assign the strongest red, green and blue possible :D
caffe3
Licensed Customer
Licensed Customer
 
Posts: 58
Joined: Tue Dec 09, 2014 5:30 am

Re: Somewhat Configurable Object IDs Workaround!

Postby RobSteady » Fri Mar 27, 2015 6:14 am

RobSteady Fri Mar 27, 2015 6:14 am
Stratified, is there any plan to implement an alpha mask channel for materials?
Octane for 3ds Max v2.21.1 | i7-5930K | 32GB | 1 x GTX Titan Z + 2 x GTX 980 Ti
User avatar
RobSteady
Licensed Customer
Licensed Customer
 
Posts: 618
Joined: Thu Jun 07, 2012 7:33 am

Re: Somewhat Configurable Object IDs Workaround!

Postby prodviz » Fri Mar 27, 2015 9:51 am

prodviz Fri Mar 27, 2015 9:51 am
Cheers for the info.

The same here, working with red, green, blue or b/w matte is the only way to get a clean mask.

Is there anyone successfully using the washed out ID colours for selections?
prodviz
Licensed Customer
Licensed Customer
 
Posts: 543
Joined: Sun Jul 14, 2013 6:00 pm

Return to Tutorials


Who is online

Users browsing this forum: No registered users and 1 guest

Mon Oct 21, 2019 8:20 pm [ UTC ]