how to using the MtlVRmat class.

Hello. I’m in KOVI Company.Currently, we are developing a rendering program based on the V-Ray APP SDK.
Regarding that, I want to use a material created in V-RAY in APPSDK.
In the case of VRSCene, all information on materials, meshes, and nodes is included. Currently, I want to create a mesh in real time and attach a material for v-ray to it.
I’ve searched all the ways to figure out how to use a VRMAT file, but I’m having trouble.
Please give me a simple code on how to assign MtlVRmat as material using .VRMAT file.

Thank you.
Glass Object Frosted.zip (1.79 KB)

Hi @kovi_v

using MtlVRmat is straightforward. You have to fill in the “filename” and “mtlname” parameters.
filename is straightforward - path to the .vrmat file you’re using
mtlmame is the name of the material within the .vrmat file you want to use. In your case it is “/Glass Object Frosted”. You can look at the <Asset url=“/Glass Object Frosted” type=“material” … > in your .vrmat file
This is necessary since a .vrmat file may contain multiple materials.

Having that said once you have the MtlVRmat plugin created you assign it to the Node’s material property and that is it.
Please take a look at the following .vrscene file, which you can render standalone
demo.zip (480 KB)

Thank you very much.
The above problem has been resolved.
I was able to check it based on the attached file you sent. Also, it was confirmed that it is necessary to set it as follows.

MtlVRmat vrmatFile = renderer.newPlugin< MtlVRmat>();
bool bSuccess = vrmatFile.set_filename(“assets” PATH_DELIMITER “Glass Object Frosted.vrmat”);
vrmatFile.set_mtlname(“Glass Object Frosted”);

Hi,
Thanks for the help, I had the same issue and it solved it partly.
How ever I still have one problem, my vrmat file has some bitmaps textures with texture files in it.
But it seams like the texture files are not found by the renderer
How does the filepath work in the vrmat file?

Please find below an extract of the vrmat file as well as the full file attached

Thanks

<vrayplugin name="BitmapBuffer" type="bitmap" version="0">
<parameters>
<parameter handler="default" label="ifl_end_condition" name="ifl_end_condition" listType="none" type="integer">
<value>0</value>
</parameter>
<parameter handler="default" label="ifl_playback_rate" name="ifl_playback_rate" listType="none" type="float">
<value>1</value>
</parameter>
<parameter handler="default" label="ifl_start_frame" name="ifl_start_frame" listType="none" type="integer">
<value>0</value>
</parameter>
<parameter handler="default" label="load_file" name="load_file" listType="none" type="bool">
<value>1</value>
</parameter>
<parameter handler="default" label="file" name="file" listType="none" type="string">
<value>European_Hornbeam/Assets/Branch_su_Diff_512_srgb.tx</value>

d992b63_3dm_European_Hornbeam_001.rar (3.58 KB)