Where is VRayMtl in VRay SDK

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  10 October 2012
Where is VRayMtl in VRay SDK

Hello guys,

I would want to export VRay Materials with an home-made exporter plugin.
I already have the code to export Standard Materials and tried to apply the same logic to VRay Mats.

But I can't find the VRayMtl class in the VRay SDK!?
I saw they provided material examples to develop custom VRay Materials, but I didn't find the VRayMtl class, which is the class I would want to export...

Am I missing something obvious?
Has somebody already played with the VRay SDK?

Thanks for advance,
 
  10 October 2012
It seems that nobody has ever exported VRayMtl...
 
  10 October 2012
i would try asking on the chaos group forums
 
  10 October 2012
Thanks Gravey,
That's what I did.
 
  10 October 2012
As I was advised, I posted it on chaosgroup account.
A choasgroup member replied to me, sending a code example as attachment... but Chasgroup forums rules are so strict that I cannot even read the attachment.

Here is the link to the thread:
http://www.chaosgroup.com/forums/vb...3058#post563058

If any of you could repost the attachment here, I will be grateful.
Moreover, it could interest someonelse here.
Thanks
 
  10 October 2012
Actually just some property that you adjusted. So I think you can export by collect those property. To know the structure or name of properties, you can use showproperties function.
It will show all property that you can access. For quickly picking, you can change that propery and catch it in maxscript listener
__________________
YM & SkypeID: quangngainthk
http://rollingant.com
 
  10 October 2012
Here's your attachment from the Chaos forum...
Attached Files
File Type: zip vraymtl_export.zip (2.5 KB, 33 views)
 
  10 October 2012
Raytracer05 >> Thank you!

No doubt it will be useful for everyone.
 
  01 January 2013
For the record, here is a piece of code (from the above zip) that I used to extract VRayMtl properties :
http://pastebin.com/ewwhK1PF

/**************************************************  **************************
  Convenient VRay Enums and Defines For Vray Materials manipulation
**************************************************  **************************/
 
#define VRAYMTL_CLASS_ID Class_ID(0x37bf3f2f, 0x7034695c)
 
#define VRAYMTL_NSUBTEX 17
 
#define SUBTEXNO_DIFFUSE 0
#define SUBTEXNO_REFLECT 1
#define SUBTEXNO_REFRACT 2
#define SUBTEXNO_BUMP 3
#define SUBTEXNO_REFLECT_GLOSSINESS 4
#define SUBTEXNO_REFRACT_GLOSSINESS 5
#define SUBTEXNO_DISPLACEMENT 6
#define SUBTEXNO_ENVIRONMENT 7
#define SUBTEXNO_TRANSLUCENCY 8
#define SUBTEXNO_IOR 9
#define SUBTEXNO_HILIGHT_GLOSSINESS 10
#define SUBTEXNO_FRESNELIOR 11
#define SUBTEXNO_OPACITY 12
#define SUBTEXNO_ROUGHNESS 13
#define SUBTEXNO_ANISO 14
#define SUBTEXNO_ANISO_ROTATION 15
#define SUBTEXNO_FOG 16
 
namespace VRayMtlParameters {
 
        // Parameter block IDs
        enum {
                vrayMtl_old_id,
                vrayMtl_basic_id,
                vrayMtl_BRDF_id,
                vrayMtl_options_id,
                vrayMtl_maps_id,
                vrayMtl_reflIMap_id,
                vrayMtl_refrIMap_id,
        };
 
        // Parameters
        enum {
                pb_spin,
 
                pb_diffuse_color,
 
                pb_reflect_color, pb_reflect_glossiness, pb_reflect_subdivs,
 
                pb_refract_color, pb_refract_glossiness, pb_refract_subdivs,
 
                pb_reflect_fresnel,
                pb_refract_ior,
 
                pb_brdf_type,
 
                pb_reflect_trace,
                pb_refract_trace,
 
                pb_doubleSided,
                pb_reflectOnBack,
 
                pb_diffuse_trace, pb_diffuse_subdivs,
 
                pb_useIrradMap,
                pb_diffuseGlossy,
                pb_traceCaustics,
 
                pb_reflect_maxDepth,
                pb_refract_maxDepth,
                pb_cutoffThresh,
 
                pb_refract_fogColor, pb_refract_fogMult, pb_refract_translucent, pb_refract_thickness, pb_refract_volSubdivs, pb_refract_lightMult_old,
                pb_refract_scatterCoeff, pb_refract_scatterDir, pb_refract_lightMult,
 
                pb_fog_affectShadows,
 
                pb_useInterpolation,
                pb_interpSamples,
                pb_colorThreshold,
 
                pb_preservationMode,
                pb_translucent_color, pb_translucent_map,
 
                pb_reflect_minRate, pb_reflect_maxRate, pb_reflect_clrThresh, pb_reflect_nrmThresh, pb_reflect_interpSamples, pb_reflect_preset,
 
                pb_refract_minRate, pb_refract_maxRate, pb_refract_clrThresh, pb_refract_nrmThresh, pb_refract_interpSamples, pb_refract_preset,
 
                pb_reflect_exitColor, pb_refract_exitColor, pb_refract_exitColor_on,
 
                pb_brdf_anisotropy, pb_brdf_anisotropy_channel,
 
                pb_reflect_useInterpolation,
                pb_refract_useInterpolation,
 
                pb_brdf_anisotropy_rotation, pb_brdf_anisotropy_derivation, pb_brdf_anisotropy_axis,
 
                pb_refract_affectAlpha,
                pb_hilight_glossiness,
                pb_reflect_ior, pb_reflect_glossiness_lock, pb_reflect_ior_lock,
 
                pb_refract_fogBias,
 
                pb_environment_priority,
                pb_diffuse_roughness,
 
                pb_brdf_soften,
                pb_clampColors,
 
                pb_reflect_dimDistance, pb_reflect_dimDistanceFallOff, pb_reflect_dimDistanceOn,
 
                pb_refract_dispersion, pb_refract_dispersionOn,
 
                pb_refract_fogUnitScaleOn,
                pb_brdf_fixDarkEdges,
 
                pb_effect_id,
                pb_override_effect_id,
 
                pb_reflect_affectAlpha,
        };
 
#define SUBTEX_PARAM_ID 100
#define ON_OFFSET 50
#define MULT_OFFSET 100
 
#define VRAYMTL_TEXMAP_PARAMID(subtexNo) (SUBTEX_PARAM_ID+subtexNo)
#define VRAYMTL_TEXMAP_ON_PARAMID(subtexNo) (SUBTEX_PARAM_ID+subtexNo+ON_OFFSET)
#define VRAYMTL_TEXMAP_MULT_PARAMID(subtexNo) (SUBTEX_PARAM_ID+subtexNo+MULT_OFFSET)
 
} // namespace VRayMtlParameters
 
 
 
 
 
/**************************************************  **************************
  DumpMaterialVRay (Get the VRayMtl material properties)
**************************************************  **************************/
void Max2Nmo::DumpMaterialVRayMtl(Mtl* mtl, VirtoolsMaterial &NMat, BOOL &OpacityValid)
{
/*
        // list every parameters in its matching IParamBlock2
       
        IParamBlock2 *pblockBasic=mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_basic  _id);
        IParamBlock2 *pblockMaps=mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_maps_  id);
        IParamBlock2 *pblockOptions=mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_optio  ns_id);
        IParamBlock2 *pblockBRDF=mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_BRDF_  id);
 
        OutputDebugString("pblockBasic\n");
        for (int i=-1; ++i<pblockBasic->NumParams();)
        {
                OutputDebugString("\t");
                OutputDebugString(pblockBasic->GetLocalName(pblockBasic->IndextoID(i)));
                OutputDebugString("\n");
        }
 
        OutputDebugString(_T("pblockMaps\n"));
        for (int i=-1; ++i<pblockMaps->NumParams();)
        {
                OutputDebugString("\t");
                OutputDebugString(pblockMaps->GetLocalName(pblockMaps->IndextoID(i)));
                OutputDebugString("\n");
        }
 
        OutputDebugString(_T("pblockOptions\n"));
        for (int i=-1; ++i<pblockOptions->NumParams();)
        {
                OutputDebugString("\t");
                OutputDebugString(pblockOptions->GetLocalName(pblockOptions->IndextoID(i)));
                OutputDebugString("\n");
        }
 
        OutputDebugString(_T("pblockBRDF\n"));
        for (int i=-1; ++i<pblockBRDF->NumParams();)
        {
                OutputDebugString("\t");
                OutputDebugString(pblockBRDF->GetLocalName(pblockBRDF->IndextoID(i)));
                OutputDebugString("\n");
        }
*/
 
 
 
 
        TimeValue t = GetStaticFrame();
        BOOL map_on;
        float map_mult;
 
 
        Color ambient_color(0.75, 0.75, 0.75);
        Color diffuse_color(0.75, 0.75, 0.75);
        Color reflection_color(0.0, 0.0, 0.0);  // specular color
        Color emissive_color(0.0, 0.0, 0.0);
 
        float reflection_glossiness = 10.0f;    // specular power
        float transparency = 1.0f;              // diffuse color alpha component
 
        BOOL option_doubleSided = true;
 
        Texmap *diffuse_texture = NULL;
 
 
        //--
        // Get VRay Material Properties
       
        IParamBlock2 *pblockBasic = mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_basic  _id);
        IParamBlock2 *pblockMaps = mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_maps_  id);
        IParamBlock2 *pblockOptions = mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_optio  ns_id);
        IParamBlock2 *pblockMaps = mtl->GetParamBlockByID(VRayMtlParameters::vrayMtl_maps_  id);
 
        // get colors
        diffuse_color =         pblockBasic->GetColor(VRayMtlParameters::pb_diffuse_color, t);
        ambient_color =         diffuse_color;
        reflection_color =      pblockBasic->GetColor(VRayMtlParameters::pb_reflect_color, t);
       
        // get specular level
        // from the "Reflection Glossiness" spinner [formula: (100* (1-value))]
        reflection_glossiness = 100.0f * (1.0f - (pblockBasic->GetFloat(VRayMtlParameters::pb_reflect_glossiness,   t)));
 
        // get transparency value from the "Maps" rollout
        map_on = pblockMaps->GetInt(VRAYMTL_TEXMAP_ON_PARAMID(SUBTEXNO_OPACITY)  , t);
        if (map_on)
        {
                map_mult =      pblockMaps->GetFloat(VRAYMTL_TEXMAP_MULT_PARAMID(SUBTEXNO_OPAC  ITY), t);
                transparency = (map_mult / 100.0f);
        }
        else
        {
                transparency = 1.0f;
        }
 
        // get both-sided value
        option_doubleSided = pblockOptions->GetInt(VRayMtlParameters::pb_doubleSided);
 
 
       
        // Diffuse map
 
        int diffuse_map_on;
        Texmap* diffuse_texture = NULL;
 
        diffuse_map_on = pblockMaps->GetInt(VRAYMTL_TEXMAP_ON_PARAMID(SUBTEXNO_DIFFUSE)  , t);
        if (diffuse_map_on)
        {
                diffuse_texture = pblockMaps->GetTexmap(VRAYMTL_TEXMAP_PARAMID(SUBTEXNO_DIFFUSE)  );
        }
}

Last edited by feranti : 01 January 2013 at 06:13 PM.
 
  01 January 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:14 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.