Posted: 19 Feb 2015 17:05
This release improves again OSL integration within XRT (although a fair share of bugs have been fixed). The new available features are:
- primitive variables are fully functional for all kinds of primitives (except vertex interpolation type for subdivision surfaces)
- shaders accept unsized arrays as parameters. The actual size is determined at run-time when shaders are instantiated.
- message passing between different shader groups (and not only within the layer) is supported. For instance, a surface shader can retreive a value computed by a displacement group or can ask a light whether it supports specular or diffuse emission.
- any bump-mapped surface seen through a refractive material will have its shading normal properly oriented
- differential quantities are properly propagated through reflection, refraction or shadowing.
This last feature matters a lot to me because it was one of the major compelling reasons to switch to OSL. Let's have an example.
Pretty lame compared to my previous post, isn't it ? Worse, I am so proud of it that it is part of XRT examples (in the differentials folder). Let's pretend it's for educational purposes only.
Both spheres have nearly the same shader, a metallic surface onto which a screen pattern is applied. The left sphere shader (screen.osl) computes sharp transitions between metal and void while the right sphere shader (screen_aa.osl) smooths them using differential quantities. Because the picture is computed with only one sample per pixel (to make it even uglier), the left sphere aliases badly while the right sphere is smoother. Its shadow is also smoother, like its reflection and its shadow in the mirror. The depth in the ray tree increases but that does not prevent the screen_aa shader to perform antialiasing correctly.
If you're still here, there is a more interesting "lantern" effect in the differentials examples waiting for you to try out.
Rate this post: