help needed for basic vray material plugin use in maya

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 :slight_smile:
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

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

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.

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

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

Thanks for the quick reply, That worked!