# help needed for basic vray material plugin use in maya

**URL:** <https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716>\
**Category:** SDK\
**Created:** [June 12, 2012, 12:31pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716 "2012-06-12T12:31:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AardmanCGI](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@AardmanCGI](https://forums.chaos.com/u/AardmanCGI)\
**Post date:** [June 12, 2012, 12:31pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716/1 "2012-06-12T12:31:34Z")

</div>

Hi,  
I am new to vray and since I am used to writing shaders for Renderman I am finding the process of writing plugin materials for vray a little confusing. Hopefully someone can give me some tips 🙂  
I have started by taking the materialID example, renaming it and giving it a different plugin id. It complies and I have copied the resulting .so file to the vrayForMaya2011-x64/vray/vrayplugins/ folder.  
I now hoped to see a new material listed in my Maya hypershade alongside the existing vray nodes. When Maya loads I see a message telling me that vray plugins are loaded and there are no errors.  
So my question is this:  
How to I use a vray plugin material in maya once I have compiled it?

Thanks,

Philip

---

<div class="post-metadata">

**Author:** ![t.petrov](https://avatars.discourse-cdn.com/v4/letter/t/c68b51/32.png) [@t.petrov](https://forums.chaos.com/u/t.petrov)\
**Post date:** [June 12, 2012, 1:05pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716/2 "2012-06-12T13:05:32Z")

</div>

Hi,  
You can create an instance of your material with the menu item “Create-\>V-Ray-\>Create from V-Ray Plugin-\>Material”.

---

<div class="post-metadata">

**Author:** ![AardmanCGI](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@AardmanCGI](https://forums.chaos.com/u/AardmanCGI)\
**Post date:** [June 12, 2012, 2:34pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716/3 "2012-06-12T14:34:10Z")

</div>

Ah, I see that what I need to create is actually a plugin texture. This seems to be working OK. How do I refresh the texture plugin once I have recompiled? So far Maya just crashes when I recompile my shader and cause any sort of swatch re-render.

thanks.

---

<div class="post-metadata">

**Author:** ![AardmanCGI](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@AardmanCGI](https://forums.chaos.com/u/AardmanCGI)\
**Post date:** [June 12, 2012, 4:00pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716/4 "2012-06-12T16:00:54Z")

</div>

Hello again,  
I have my plugin texture working but am struggling to get the results I need from it. I suspect I have made a simple error here.  
I am trying to create a texture which outputs the interpolated shading normal at the current shading point. In the maya hypershade I then plug the output color from my plugin texture into the bumpmap input of a vray BRDF material. I set the bump map type to “normal in world space”.  
Here is a simple version of my code:

AColor TexMyNomals::getTexColor(const VRayContext &rc) {

Vector nrm=rc.rayresult.normal;  
AColor nrmCol (nrm.x, nrm.y, nrm.z, 1.0f);  
return nrmCol;

}

This \*almost\* works as expected but the values seem slightly out of range. It’s as though my normals have all been put through a gamma curve or something. Is the fact that I am passing them as a color causing a color space issue?

Any ideas?

Thanks,

Philip

---

<div class="post-metadata">

**Author:** ![vlado](https://avatars.discourse-cdn.com/v4/letter/v/779978/32.png) [@vlado](https://forums.chaos.com/u/vlado)\
**Post date:** [June 12, 2012, 4:08pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716/5 "2012-06-12T16:08:51Z")

</div>

I believe V-Ray expects normal textures to be compressed into the black-white range; you could try to multiply the normal by 0.5 and add (0.5, 0.5, 0.5) to it before returning it.

Best regards,  
Vlado

---

<div class="post-metadata">

**Author:** ![AardmanCGI](https://avatars.discourse-cdn.com/v4/letter/a/c77e96/32.png) [@AardmanCGI](https://forums.chaos.com/u/AardmanCGI)\
**Post date:** [June 12, 2012, 4:17pm UTC](https://forums.chaos.com/t/help-needed-for-basic-vray-material-plugin-use-in-maya/41716/6 "2012-06-12T16:17:10Z")

</div>

Thanks for the quick reply, That worked!
