Thursday, September 2, 2010

Round Corners in Houdini

It's been a while since my last post, sorry about that...

I was playing with Houdini for the last 1 year, did a couple of jobs with it. It saved my ass a couple of times and I can say that I completely felt in love with it, and I really felt sorry for the years I spent without Houdini. Anyway, after a while later I decided to try to complete the jobs more and more with Houdini and try to go away from Maya a little bit. I'm not going to enter the valley of the differences of the two programs and how awesome Houdini is etc. but I need to say that it feels awesome.

Yet, there is another job that I need to finish up (the deadline is tomorrow). The job is about a tire brand etc. Lets cut the chase, the object was not looking good just because they've sent us the production model that they are using to produce the product in the factory, and you now this kind of nurbs models are a little bit too perfect, has sharp edges and a lot of details. In Maya, to break this perfection, I generally use the round corner shader to smooth the sharp edges and it works perfectly. But in Houdini you don't have this kind of already built in shader but you have the powerful VEX.

I've first searched for it on the web, there was microBevel from Simon Barrick but it was not working with Houdini 11 (by the way I need to thank Simon, for his fast and friendly responses to my e-mails).

Then I tried to find a paper about how to smooth edges of geometries in render time. And I found a document about the round corner shader in mental ray from Hakan Andersson (the famous master zap). So it was pretty obvious actually...

Here are the results of my round corner OTL with different curving choices:



and here, the tire with and without round corner shader:

Edit: I've removed the OTL links because they are not working with Houdini 13 anymore, but good news! I've created a simple shader that does the trick without needing any OTLs. You can download it here: round_corners.hipnc Also I've did it from scratch, it should be much cleaner, faster and easy to follow. Please let me know if you have any suggestions for the shader. Have fun!

28 comments:

Lorenz said...

I really appreciate, that you put your OTLs online, but I have problems using them. I put down the tangent SOP after a box and connected a material with the roundCorners shader put into the normals of the lighting model, but nothing meaningful happens and the result doesn't change when I change the values.

Ozgur said...

sorry about my late response...

use the round corner in slots that accepts surface normals.

So with the new materials in houdini 11 create a round corner node and attach its result to the "surface normal" attribute of the "surface model" or just follow what is connected to it and try to replace any "global variables" nodes that has its "surface normal" slot connected to some other nodes with the "roundCorners node. Then increase the samples to 6 or more in roundCorners then promote the radius and bias parameters or just connect a constant to them, and set the bias to 0.001 to start and play with it incase you get artifacts, and then set your radius according to your objects scale... hope it is clear enough...

Lorenz said...

NICE, one fine bevel - never without anymore!
It was the BIAS - I never had it that low. It's always the same - I try every possible combination, but not the right one.

Lorenz said...

You made my day! It even works with NURBS. Thank you so much! :D

Ozgur said...

It is nice to hear that it helped someone. You're welcome.

reno said...
This comment has been removed by the author.
reno said...

Hi I want to download your otl but the link is dead. Can you share the otls again? Thanks in advanced!

Ozgur said...

ooh, yes, my site is down let me attach the otl to this post...

Ozgur said...

I've updated the links.

Ronald Chew said...
This comment has been removed by the author.
reno said...

Hi Ozgur, thanks for fixing the link, this is a very interesting asset. May I ask which document you are referring to for the theory of the round corner? I try go to Master Zap's blog but don't find such document. Thank you.

Rattanin sirinaruemarn said...

Hi I'm really interested in your otl but unfortunately Filesonic was closed. Is there the other way to download your files?

Thank you so much

Ozgur said...

I've uploaded the files to Dropbox so the links are working again...

GustavoEB said...

Would you mind pointing to the Document you found about the Round Corner shader and how it works?

Cheers

Ozgur said...

http://www.patentgenius.com/patent/8049753.html

There should be a PDF version also...

SomeSanctus said...

did you make otl for newer version of houdini&

Yaniv Gorali said...

Great work! Unfortunately i havent been able to get it working in v12.5. Anyone having success with newer versions or know of a fix?
Thanks!

Erkan Özgür Yılmaz said...

Unfortunately I have not tested it with 12.5, I'll update it as soon as I have time.

Yaniv Gorali said...

Thanks that would be awesome!
(tested on v11 and works)

Yaniv Gorali said...

Hi
I've updated your otl to work with v12.5. I haven't put it through rigorous testing but if you'd like to post it and get some feedback, let me know. I'd also be interested to hear any suggestions to further speed up the calculations.

Yaniv Gorali said...
This comment has been removed by the author.
Erkan Özgür Yılmaz said...

Hi Yaniv,

It would be great to have your version.

And regarding to the speed improvements, the shader is simply firing rays perpendicular to the normal at the rendered pixel and tries to find some other objects to blend the normal with. So the only speed gain can be obtained through limiting the search distance and limiting the amount of search directions (samples), and as I remember I was already doing it by using the user supplied radius and sample count.

Also I was both searching for concave and convex edges. So limiting the search for only one type of edge should double the speed.

Also Hakan Anderson's version (the mentalray version) were using only 6 rays but I was only be able to get good results with 12 rays.

Jonathan Alenskas said...

hi guys

tell me does this allow rounding between 2 seperate intersecting surfaces like the one in mental ray XSI ?

i see some people have modified and updated the script created here. where is a good place to get the latest best version ?

thanks
jono

Artur Mandas said...

Could someone share an example network utilizing these two .otls? It is not clear how to use them. Thank you for creating this great asset!

Matthias Kappenberg said...

Hi Ozgur,
is there any chance that you'll create a version for Houdini 13?

Erkan Özgür Yılmaz said...

I've updated the post and included a hipnc file, please download it.

Artur Mandas said...

Thank you!

Matthias Kappenberg said...

Many thanks for the v13 file Ozgur.
Sorry for the late response, I didn't notice your update.