OSL Programming tutorial: Let's write a proper Normal Blend Map
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Blending normals is not just a question about adding them up in some way, linear blend, overlay tricks or partial derivatives, has been seen through history as attempts to overcome blending multiple normals, while trying to preserve as many details as possible.
These methods does not represent the current front end.
So if you want to blend normals like a BOSS and on the same time, take your first step into writing OSL shaders for Arnold, take a look here and dive in.
The shader is based around an article by Colin Barré-Brisebois and Stephen Hill, where they show many popular blend modes and then their own superior construct called reoiriented normal blending. https://blog.selfshadow.com/publications/blending-in-detail/
VIDEO:
https://youtu.be/d462neeNXyk
I also put up a perma link on the git.
https://github.com/gkmotu/OSL-Shaders/blob/master/NormalBlend.osl
If you skipped directly to shader download, remember to revise your 2 bitmap loaders gamma space.
You want to make sure you work in linear space on everything you send into the shader.
So, and that means, set gamma to 1.0.
Shader should work in any host.
In MAX 2020.3:
- Viewport in High Quality mode with a Physical Material + Legacy normal map + 2 OSL bitmaps and this RNM shader returns normals on mesh in the viewport.
- Arnold renders them in a higher quality simultaniously.
Let me know if you have any questions or suggestions to updates, corrections of errors and so forth.
And if you have other blend functions laying around, let's try put them though the shader.
We can even make a drop down with blend mode types, which I would not realy like 😄 But its possible.
Its best to just have the most efficient function in main shader and everything else is legacy instantly and gets pulled from shader chains when the master on disk gets updated by TD folks, which could be huge facility injection or 1 man band, makes no difference, its eaqually easy/hard to update master assembly in both scenarios.
If we put up 50 texture artists for a year on some mission for honor and glory, we would give them new shading tools ad hoc as needs/requests comes in. And their shaders when working with them would update in their scenes when we updated the shader on disk, so all artists active open scenes gets this upgrade automatically, no buttons touched. Small latency delay from TD area to artists Shading node canvas, but nothing serious, mili seconds on good network.