OSL goodness in Vray

Can you post an image of the OSLTex in the attribute editor? Do you get an error message when you load the OSL?

i already posted a pics of my node editor / ae …

i just connected the osl-texture to my reflection color and plugged a osl-file in there
but nothing happened :slight_smile:

You need to turn off the Use Fresnel button and change in VRayTexOSL in Color Output of result for Col_Out. The same as this:

I hope this helps. :slight_smile:

Right. It would probably be good to update the shader from this:

output color Col_Out = color(0.5))
{
    float thetaCos = abs(dot(-I,N));
    float red=fresnel(n[0], k[0], thetaCos);
    float green=fresnel(n[1], k[1], thetaCos);
    float blue=fresnel(n[2], k[2], thetaCos);
Col_Out=color(red, green, blue);
}

to this:

output color result = color(0.5))
{
    float thetaCos = abs(dot(-I,N));
    float red=fresnel(n[0], k[0], thetaCos);
    float green=fresnel(n[1], k[1], thetaCos);
    float blue=fresnel(n[2], k[2], thetaCos);
result=color(red, green, blue);

}

that way it will work by default in Maya.

what about if you want to use the fabric one where will you connect it?
thx

just follow the instructions here:

Im getting this error, where do I set up the path?

// Error: OSL shader error: OSL include path not set

hmm I did test it in maya 2014 and an older version of VRay, nightly pre 3.2.
do you know what it was that was causing problems in maya?
I’ll test again later when we are all up to date here.

“Col_Out” needs to be called “result”

@mayanic:
Your problem is that you’re using the wrong node type - VRayPluginNodeTex:TexOSL instead of VRayTexOSL.
If you create the correct node it will work as expected. After you change the output as mentioned by others.

Did you work out why this was happening? Same thing here, can’t find any info on it…

Are you both using the installer or are you using V-Ray from a network location?

Do you have a variable like VRAY_OSL_PATH_MAYA2014_x64 set?
It should point to the folder that contains oslutil.h and stdosl.h files.

Network location here - that explains it..! Thx

Network locations as well. Thank you for your response!

sorry for the delay
i still don’t get the k value to show up

there is a node (Create > V-Ray > Create form V-Ray Plugin) called OSLTex. should i use that one?

Nope, just used the VRayTexOSL node that is available in the HyperShade windows.
The menu ‘Create > V-Ray > Create form V-Ray Plugin’ should be used to create nodes very rarely and for very special purposes.
Creating OSL nodes is not one of them.

haha - that was easy :slight_smile:
THANKS

one more question - i don’t get n1, n2 and n3 values from websites like refractive index? so one has to guess what green and blue values to choose?

It should reference the website refractiveindex.com, but the process for colored metals like gold is quite complex, so I made a little tutorial about it: http://docs.sharktacos.com/misc.php?action=help&hid=66

If you scroll down to the section Artist Friendly Metal reflections (texture) you’ll get an explanation of how to set it up, and why (at east as far as my non-physicist brain was able to comprehend from the info I’ve learned on these forums). Here’s the relevant part of the tutorial:

The visible spectrum of light is measured in wavelengths. The human eye can see wavelengths from about 390 to 700 nanometers (nm). Because metals such as gold have colored reflections, we need to input the wavelength values for red, green, and blue to get the corresponding IOR values. Using this Wavelength to RGB calculator we can see that red is 645, green is 510, and blue is 440. Next we go to http://refractiveindex.info, choose the measured data we want (for example gold) and enter the wavelength we got for red, green and blue. These are in nanometers (nm), but refractiveindex.info wants micrometers (µm) which would be red 0.645, green is 0.51, and blue is 0.44. From this we will get the n and k values for the red, green, and blue wavelengths which we can then input into our complex_ior shader. For example, here are the values for gold:

n: 0.18627, 0.75314, 1.4324
k: 3.3758, 1.9238, 1.7915

The OSL’s seem to transfer with DR on to nodes as an asset, but blackout during rendering, have anyone tried using those shaders with DR on?

The OSL shaders transfer and render fine on our side.
Which V-Ray for Maya version are you using? Make sure that you are using identical V-Ray version on all nodes.