Material Ids

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

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

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

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.

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

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

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.

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

Kind regards,
Peter

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

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

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.

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

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.

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.

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

Kind regards,
Peter

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 :


2. Run the following script once (per session):


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

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?