# Material Ids

**URL:** <https://forums.chaos.com/t/material-ids/86797>\
**Category:** General\
**Created:** [January 30, 2018, 9:12am UTC](https://forums.chaos.com/t/material-ids/86797 "2018-01-30T09:12:38Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [January 30, 2018, 9:12am UTC](https://forums.chaos.com/t/material-ids/86797/1 "2018-01-30T09:12:38Z")

</div>

Any reason why they are not automatically generated? Kind of annoying when you forget to generate them before rendering.

---

<div class="post-metadata">

**Author:** ![Peter.Chaushev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/peter.chaushev/32/66949_2.png) [@Peter.Chaushev](https://forums.chaos.com/u/Peter.Chaushev)\
**Post date:** [January 30, 2018, 12:21pm UTC](https://forums.chaos.com/t/material-ids/86797/2 "2018-01-30T12:21:55Z")

</div>

V-Ray 3 materials come with random IDs.  
If you are using v2.0 vrmat/vismats all of their Material ID colors will most probably be black.  
In such case, use Extensions \> V-Ray \> Tools \> Randomize Project Material IDs.

Kind regards,  
Peter

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [January 30, 2018, 2:03pm UTC](https://forums.chaos.com/t/material-ids/86797/3 "2018-01-30T14:03:37Z")

</div>

I was working on a brand new project - SU materials do not seem to create random IDs.

---

<div class="post-metadata">

**Author:** ![andybot\_cg](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/andybot_cg/32/56167_2.png) [@andybot\_cg](https://forums.chaos.com/u/andybot_cg)\
**Post date:** [January 30, 2018, 2:41pm UTC](https://forums.chaos.com/t/material-ids/86797/4 "2018-01-30T14:41:48Z")

</div>

I noticed if you’re importing any SU file with vfs2 diffuse layer, you have to manually add matID. Looks like a tool to generate random MatID for these materials is not available.

---

<div class="post-metadata">

**Author:** ![Peter.Chaushev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/peter.chaushev/32/66949_2.png) [@Peter.Chaushev](https://forums.chaos.com/u/Peter.Chaushev)\
**Post date:** [January 31, 2018, 11:14am UTC](https://forums.chaos.com/t/material-ids/86797/5 "2018-01-31T11:14:40Z")

</div>

> [@ValeroStudio](#):
>
> I was working on a brand new project - SU materials do not seem to create random IDs.

Where are these materials from? Are they newly created or reused from previous projects?  
Could you please share a sample scene containing some of them?

Kind regards,  
Peter

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [January 31, 2018, 12:24pm UTC](https://forums.chaos.com/t/material-ids/86797/6 "2018-01-31T12:24:37Z")

</div>

It was a little bit of both, but most of them were brand new and the MatID channel rendered 100% black

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [January 31, 2018, 12:26pm UTC](https://forums.chaos.com/t/material-ids/86797/7 "2018-01-31T12:26:02Z")

</div>

Actually, now that I testing it, the Material ID channel is rendering black in 2018 SU, when using the hybrid engine. Same for ExtraTex Channel. So we cant get some of these channels from the hybrid engine?

---

<div class="post-metadata">

**Author:** ![andybot\_cg](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/andybot_cg/32/56167_2.png) [@andybot\_cg](https://forums.chaos.com/u/andybot_cg)\
**Post date:** [January 31, 2018, 1:10pm UTC](https://forums.chaos.com/t/material-ids/86797/8 "2018-01-31T13:10:37Z")

</div>

> [@ValeroStudio](#):
>
> Actually, now that I testing it, the Material ID channel is rendering black in 2018 SU, when using the hybrid engine. Same for ExtraTex Channel. So we cant get some of these channels from the hybrid engine?

Yeah - the hybrid viewport uses the RT engine, which does not support MatID. I really hope this gets supported soon, as I’ve been using vfs3 only with GPU.

---

<div class="post-metadata">

**Author:** ![Peter.Chaushev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/peter.chaushev/32/66949_2.png) [@Peter.Chaushev](https://forums.chaos.com/u/Peter.Chaushev)\
**Post date:** [January 31, 2018, 1:12pm UTC](https://forums.chaos.com/t/material-ids/86797/9 "2018-01-31T13:12:47Z")

</div>

Material ID is not yet supported on GPU but ExtraTex is. What type of texture did you use?

Kind regards,  
Peter

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [January 31, 2018, 1:54pm UTC](https://forums.chaos.com/t/material-ids/86797/10 "2018-01-31T13:54:04Z")

</div>

I was using TexEdges

---

<div class="post-metadata">

**Author:** ![Peter.Chaushev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/peter.chaushev/32/66949_2.png) [@Peter.Chaushev](https://forums.chaos.com/u/Peter.Chaushev)\
**Post date:** [January 31, 2018, 2:16pm UTC](https://forums.chaos.com/t/material-ids/86797/11 "2018-01-31T14:16:52Z")

</div>

> [@ValeroStudio](#):
>
> I was using TexEdges

This one is not yet supported on GPU as well.  
Implementing GPU support for various features still lacking it is an ongoing effort.

Kind regards,  
Peter

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [February 1, 2018, 2:42pm UTC](https://forums.chaos.com/t/material-ids/86797/12 "2018-02-01T14:42:22Z")

</div>

Material IDs way more important than TexEdges. This basically is a hybrid killer… stuck using CPU for prodution is a bummer

---

<div class="post-metadata">

**Author:** ![andybot\_cg](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/andybot_cg/32/56167_2.png) [@andybot\_cg](https://forums.chaos.com/u/andybot_cg)\
**Post date:** [February 2, 2018, 2:13pm UTC](https://forums.chaos.com/t/material-ids/86797/13 "2018-02-02T14:13:56Z")

</div>

I’ve been sorta getting around it by using the diffuse render channel. Of course it’s not very useful where textures are used, but it’s better than nothing.

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [February 2, 2018, 2:45pm UTC](https://forums.chaos.com/t/material-ids/86797/14 "2018-02-02T14:45:01Z")

</div>

Is it like this in Max and Blender as well? Sounds crazy that people have dealt with it this long.

---

<div class="post-metadata">

**Author:** ![andybot\_cg](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/andybot_cg/32/56167_2.png) [@andybot\_cg](https://forums.chaos.com/u/andybot_cg)\
**Post date:** [February 2, 2018, 3:34pm UTC](https://forums.chaos.com/t/material-ids/86797/15 "2018-02-02T15:34:05Z")

</div>

Yep, no GPU support for MatID anywhere. Must be a holdover from not initially considering GPU rendering as a production tool, hope they fix it soon.

---

<div class="post-metadata">

**Author:** ![ValeroStudio](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/valerostudio/32/31524_2.png) [@ValeroStudio](https://forums.chaos.com/u/ValeroStudio)\
**Post date:** [February 3, 2018, 5:35pm UTC](https://forums.chaos.com/t/material-ids/86797/16 "2018-02-03T17:35:48Z")

</div>

Any tricks for getting a super fast MaterialID channel?

---

<div class="post-metadata">

**Author:** ![andybot\_cg](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/andybot_cg/32/56167_2.png) [@andybot\_cg](https://forums.chaos.com/u/andybot_cg)\
**Post date:** [February 5, 2018, 1:46pm UTC](https://forums.chaos.com/t/material-ids/86797/17 "2018-02-05T13:46:45Z")

</div>

> [@ValeroStudio](#):
>
> Any tricks for getting a super fast MaterialID channel?

Turn off all lights and render. That’s quick. I haven’t used production much, not sure of the best settings. When I tried it, my aliasing was really bad, so you’ll have to figure out the best settings to get sharp delineation between colors.

---

<div class="post-metadata">

**Author:** ![Peter.Chaushev](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/peter.chaushev/32/66949_2.png) [@Peter.Chaushev](https://forums.chaos.com/u/Peter.Chaushev)\
**Post date:** [February 5, 2018, 3:14pm UTC](https://forums.chaos.com/t/material-ids/86797/18 "2018-02-05T15:14:13Z")

</div>

Just wanted to add GPU support is on our roadmap for the next big update.

Kind regards,  
Peter

---

<div class="post-metadata">

**Author:** ![konstantin\_chaos](https://dub1.discourse-cdn.com/chaosprd/user_avatar/forums.chaos.com/konstantin_chaos/32/52929_2.png) [@konstantin\_chaos](https://forums.chaos.com/u/konstantin_chaos)\
**Post date:** [February 5, 2018, 3:21pm UTC](https://forums.chaos.com/t/material-ids/86797/19 "2018-02-05T15:21:47Z")

</div>

Hi guys,

The MaterialID will be supported on the GPU in the future. The GPU team is working on it as we speak.

Another thing that I have to point out is that the most robust way of rendering masks in 3dsMax for example is using MultiMatte render elemet.  
This is a render element that renders R G B channel masks for 3 scene object or material IDs (integer number IDs).  
If you want to mask more than 3 IDs you just create multiple MultiMattes.  
The reason why people prefer this approach is that the RGB channel masks can be extracted and applied with perfect anti-aliasing in post (unlike the MaterialID).  
We are considering adding this render element in SketchUp but we are still trying to design a good way to do it.

If you want to experiment a little with this element you can try the following:  
1. Set object IDs in SketchUp :

 ![ObjectID.png](https://europe1.discourse-cdn.com/chaosprd/original/3X/f/8/f8f3f3c2b1b754781405046a1207fb0ae65814d9.png)  
2. Run the following script once (per session):

```auto

module VRay
    module ObjectProperties
        BEFORE_RENDER_STARTED_CALLBACK ||= VRay.on(:beforeRenderStarted){
            ids = Sketchup.active_model.definitions.collect{|definition| ObjectProperties.get_object_id(definition) }.compact.sort
            ids.each_slice(3).with_index{|(r,g,b), i|
                name = "MM#{i}"
                mm = Renderer.active.create_plugin(:RenderChannelMultiMatte, name, {name:"#{name}(#{r},#{g},#{b})", red_id: r, green_id: g, blue_id: b})
            }
        }
        def self.get_object_id(entity)
            entity.get_attribute(OBJECT_PROPERTIES_DICTIONARY_NAME, "objectID")
        end
        def self.set_object_id(entity, value)
            if value
                entity.set_attribute(OBJECT_PROPERTIES_DICTIONARY_NAME, "objectID", value)
            else
                entity.delete_attribute(OBJECT_PROPERTIES_DICTIONARY_NAME, "objectID")
            end
        end
    end
end

```

3. At any point in the current SketchUp session you’ll be able to call:  
`VRay::ObjectProperties::BEFORE_RENDER_STARTED_CALLBACK.disable`  
…to disable the element  
or  
`VRay::ObjectProperties::BEFORE_RENDER_STARTED_CALLBACK.enable`  
… to re-enable it

---------------------  
The script will check the number of ObjectIDs that you have in the scene and auto-create the corresponding number of MultiMatte render elements (they’ll only show up in the VFB).  
You can experiment with the script a little and let me know what you think. We might decide to add similar option in the UI in the future.

Regards,  
Konstantin

---

<div class="post-metadata">

**Author:** ![delineator](https://avatars.discourse-cdn.com/v4/letter/d/9dc877/32.png) [@delineator](https://forums.chaos.com/u/delineator)\
**Post date:** [February 6, 2018, 2:43pm UTC](https://forums.chaos.com/t/material-ids/86797/20 "2018-02-06T14:43:17Z")

</div>

testing it out now - first pass and I"m getting yellow and cyans. Is that intentional? I’m assuming not, maybe its because I have some wonky object ID’s?

[Next page](https://forums.chaos.com/t/material-ids/86797.md?page=2)
