Page 1 of 1
Convert Height to Normal OSL
Posted: Tue Sep 25, 2018 1:54 pm
by anklove
Im not into shader coding at all but i think this would be a script with big potential. I am really bored of making normal maps via CrazyBump/Knald etc apps so it would be cool to just use OSL node to convert grayscale image to normal map.
Have anyone created or found such script?
Re: Convert Height to Normal OSL
Posted: Tue Sep 25, 2018 3:21 pm
by milanm
I've been looking into this. I'm going to post a OSL node for correct layering of normal maps soon-ish here on the forums so I thought about including this functionality too, we'll see, I can't promise anything.
I have this proof of concept node graph for now. If anyone (that has a loving relationship with vectors) wants to give it a shot and turn it into OSL that would be sweet. The method is from
here.
Orbx:
C4D:
Cheers
Milan
Re: Convert Height to Normal OSL
Posted: Tue Sep 25, 2018 5:45 pm
by anklove
milanm wrote:I've been looking into this. I'm going to post a OSL node for correct layering of normal maps soon-ish here on the forums so I thought about including this functionality too, we'll see, I can't promise anything.
I have this proof of concept node graph for now. If anyone (that has a loving relationship with vectors) wants to give it a shot and turn it into OSL that would be sweet. The method is from
here.
Bump to TangentN.PNG
Orbx:
BumpToNormal.orbx
C4D:
BumpToNormal.zip
Cheers
Milan
Thanks for your approach Milan! I checked your file and it works just fine, but lacks some options. The good thing about Knald / Crazy Bump is that they have some mixing option between different radiuses/sizes of bumpiness. I usually do some text embossing with those programs and reflections works really well after mixing. I think its really easy to implement to your concept tho. You "just" need to mix few offsets and blurs together, but it will be spiderweb node system, so approaching that via osl would be great!
Keep on going, and thanks again.

Re: Convert Height to Normal OSL
Posted: Tue Sep 25, 2018 7:05 pm
by milanm
Yeah, I'm looking into different ways to "smooth" it out and I will definitely check out how others (apps/tools) approach this. I'm not a big fan of how it works now but it's easy to implement so it would be great if I could find a way to "improve" it.
Node graph is just for fun, or communication, it might help others. It's much less intimidating when you have node grouping--which is something we don't have in C4DOctane.
Btw. you'll definitely get better results than any of those apps by just applying displacement on a plane using your height map and either rendering a normal pass or baking it.
Kind of like this:
Cheers
Milan
Re: Convert Height to Normal OSL
Posted: Fri Feb 22, 2019 6:27 pm
by Jolbertoquini
milanm wrote:Yeah, I'm looking into different ways to "smooth" it out and I will definitely check out how others (apps/tools) approach this. I'm not a big fan of how it works now but it's easy to implement so it would be great if I could find a way to "improve" it.
Node graph is just for fun, or communication, it might help others. It's much less intimidating when you have node grouping--which is something we don't have in C4DOctane.
Btw. you'll definitely get better results than any of those apps by just applying displacement on a plane using your height map and either rendering a normal pass or baking it.
Kind of like this:
DisplacementToNormal.orbx
DisplacementToNormal.zip
Cheers
Milan
Hi Milan,
Really strange there is know Octane setup here, is just a render target scene rendering the shading normal output. I think is nice Idea but yeah this doesn't do on the fly on the rendering as a node to just transform luminescence to normal. Just adding this point for those who are expecting that.
Thanks anyway for the idea.
Cheers,
JO
Re: Convert Height to Normal OSL
Posted: Fri Feb 22, 2019 6:28 pm
by Jolbertoquini
anklove wrote:milanm wrote:I've been looking into this. I'm going to post a OSL node for correct layering of normal maps soon-ish here on the forums so I thought about including this functionality too, we'll see, I can't promise anything.
I have this proof of concept node graph for now. If anyone (that has a loving relationship with vectors) wants to give it a shot and turn it into OSL that would be sweet. The method is from
here.
Bump to TangentN.PNG
Orbx:
BumpToNormal.orbx
C4D:
BumpToNormal.zip
Cheers
Milan
Thanks for your approach Milan! I checked your file and it works just fine, but lacks some options. The good thing about Knald / Crazy Bump is that they have some mixing option between different radiuses/sizes of bumpiness. I usually do some text embossing with those programs and reflections works really well after mixing. I think its really easy to implement to your concept tho. You "just" need to mix few offsets and blurs together, but it will be spiderweb node system, so approaching that via osl would be great!
Keep on going, and thanks again.

on this setup just blur the displacement on the filter option at diffuse shader. you can get same effect but again this is just to save output out.

Re: Convert Height to Normal OSL
Posted: Sat Feb 23, 2019 5:56 am
by milanm
@Jolbertoquini
Hi
The setup is in my
first post above. Inside OctDiffuse node. There is also a link about the method.
My second post is just an old idea from Beppe originally that is still technically a better alternative to offline apps (paid or free) in terms of quality.
In the meantime Mads Drøschler posted an OSL script that uses that same method and it could work just fine in Octane with some small tweaks.
I don't use Facebook, so if anyone would be kind to ask for permission from Mads via OSL Shaders public group to make an Octane version of that shader I would be glad to help right away. It's a separate repository than the official one from Autodesk and I'm not sure if it's covered by Apache 2.0 license (whitch would be great).
Here is the relevant post: https://www.facebook.com/groups/OSL.Sha ... 150856077/.
EDIT: Never mind, I wrote my own script in the meantime. I will post a link here. If the one from Mads becomes available under Apache 2 I will post a version for Octane here.
Cheers
Milan