Convert Height to Normal OSL

Generic forum to discuss Octane Render, post ideas and suggest improvements.
Forum rules
Please add your OS and Hardware Configuration in your signature, it makes it easier for us to help you analyze problems. Example: Win 7 64 | Geforce GTX680 | i7 3770 | 16GB
Post Reply
anklove
Licensed Customer
Posts: 42
Joined: Wed Feb 17, 2016 8:31 am

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?
i7 10700k | Win 10 64 bit | RTX 3090
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

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
(92.34 KiB) Downloaded 274 times
C4D:
BumpToNormal.zip
(73.9 KiB) Downloaded 368 times
Cheers
Milan
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
anklove
Licensed Customer
Posts: 42
Joined: Wed Feb 17, 2016 8:31 am

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.

Image
i7 10700k | Win 10 64 bit | RTX 3090
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

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
(169.97 KiB) Downloaded 249 times
DisplacementToNormal.zip
(134.63 KiB) Downloaded 325 times
Cheers
Milan
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
User avatar
Jolbertoquini
Licensed Customer
Posts: 1067
Joined: Sun Aug 31, 2014 7:08 am
Location: London
Contact:

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
Octane Render for Maya.
https://vimeo.com/jocg/videos
https://www.linkedin.com/in/jocgtd
http://www.hmxmedia.com/
--------------------
Join MAYA OCTANE USERS Skype discussion here :
https://join.skype.com/LXEQaqqfN15w
User avatar
Jolbertoquini
Licensed Customer
Posts: 1067
Joined: Sun Aug 31, 2014 7:08 am
Location: London
Contact:

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.

Image
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.

;)
Octane Render for Maya.
https://vimeo.com/jocg/videos
https://www.linkedin.com/in/jocgtd
http://www.hmxmedia.com/
--------------------
Join MAYA OCTANE USERS Skype discussion here :
https://join.skype.com/LXEQaqqfN15w
milanm
Licensed Customer
Posts: 261
Joined: Tue Apr 30, 2013 7:23 pm

@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
Colorist / VFX artist / Motion Designer
macOS - Windows 7 - Cinema 4D R19.068 - GTX1070TI - GTX780
Post Reply

Return to “General Discussion”