Hi,
Not sure if this is a bug or not. I guess it was confusing to me so I'll share it.
I'm trying to play around with OSL again. One thing I noticed is that V-Ray caches OSL "surface" shaders by name internally to the VRayOSLMtl. And it seems to do so forever, even if you change the source code to the OSL shader and reload it.
Here is how to reproduce the caching forever issue:
Save it to disk as test.osl. Then create a simple scene and add a VRayOSLMtl with this as its shader. It will render fine. Now modify the above OSL code, like remove "+ d" to remove the diffuse BRDF closure. Now try to get V-Ray to render this new OSL shader. You can try to reload it in the VRayOSLMtl, or you can load a different *.osl file and then reload this *.osl file, but it will always render with both "s + d" even though the code doesn't read that way.
The only want to get the new *.osl file to load is to either create a new VRayOSLMtl, or you need to change the Name of the shader in the first line of the OSL shader and then reload it -- thus there seems to be forever caching of valid OSL shaders per VRayOSLMtl that is based on the OSL shader name.
Best regards,
Ben Houston
Not sure if this is a bug or not. I guess it was confusing to me so I'll share it.
I'm trying to play around with OSL again. One thing I noticed is that V-Ray caches OSL "surface" shaders by name internally to the VRayOSLMtl. And it seems to do so forever, even if you change the source code to the OSL shader and reload it.
Here is how to reproduce the caching forever issue:
Code:
shader Test ( color diffuseColor = color(1.0,0.0,0.0), color specularColor = color(1.0), float glossiness = 1.0, output closure color Result = diffuse(0.8) ) { closure color d = diffuseColor * diffuse(N); closure color s = specularColor * vray_blinn(N, glossiness, 0.0, 0.0, "trace_reflections", 1 ); Result = s + d; // render once, and then uncomment out s or d, and run again, no change will be visible in viewport. }
The only want to get the new *.osl file to load is to either create a new VRayOSLMtl, or you need to change the Name of the shader in the first line of the OSL shader and then reload it -- thus there seems to be forever caching of valid OSL shaders per VRayOSLMtl that is based on the OSL shader name.
Best regards,
Ben Houston
Comment