Community
Arnold General Rendering Forum
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OSL Programming tutorial: Let's write a proper Normal Blend Map

8 REPLIES 8
Reply
Message 1 of 9
madsd
835 Views, 8 Replies

OSL Programming tutorial: Let's write a proper Normal Blend Map

5403-normalblend.jpg


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.

8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: madsd

really nice
Maya5360-mtoa-nmb.jpg
Houdini
5421-htoa-nmb.jpgmtd & aeTemplate here:
NormalBlend.zip

Message 3 of 9
madsd
in reply to: Anonymous

ah so you need some complimentary ui files for those 2 hosts.
Thanks for the files.
Ill try ship shaders I am rolling out on my site with these files as well so maya/houdini folks will get these along the downloaded shader.

I may be back to ask for testing or ask for some coop QA for UI 🙂

Message 4 of 9
Anonymous
in reply to: madsd

it's a pleasure to test your beautiful shaders
I'm ready

Message 5 of 9
Anonymous
in reply to: madsd

Update for c4D

5423-c4d-nmb.jpg

Just add
ARNOLD_PLUGIN_PATH in the OS variable
NormalBlend.zip

Message 6 of 9
madsd
in reply to: Anonymous

Perfect, now we got 4 supported ui entries.

Message 7 of 9
madsd
in reply to: Anonymous

Great.
I stole your images and will make a 4th for MAX, then submit a post in my OSL Shaders category on my site with some explainations and so on, full credit for the UI file work OFC.

Ill attempt to make a template that other shaders can follow.

Message 8 of 9
madsd
in reply to: Anonymous

Message 9 of 9
Anonymous
in reply to: madsd

Nice
Thank you

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report