Jump to content
Sign in to follow this  

Torus Procedural

Recommended Posts

Hello, I try to make this model to show chemical structure.



I am a beginner.. Is there good way to make this through procedural method?


I try to this. and attach file. Hard to make like the picture.



Edited by faxingberlin

Share this post

Link to post
Share on other sites

Images you attached are probably generated by some mathematical software like Wolfram Mathematica or MatLab. So if you have exact math function for generating those you can use them in Houdini too. For such Math approach (not really procedural in manner of combining full potential of Houdini), you can use ISO Surface node. Basically that node will accept any function of X,Y,Z coordinate in implicit form. For example if you want to define surface of sphere with radius 1. You actually thinking of function which will give you all points which are at exact 1 unit from let say center of scene. Function which cover that in 3D space would be


If x,y,z represent coordinate of point then any point with such x,y,z that satisfy equation will be at surface of that one unit sphere.

Making power of 2 on both sides of equation of unit radius sphere gives you

x^2+y^2+z^2 = 1

That is explicit form of function.

If you transfer right part to left:

x^2+y^2+z^2- 1 = 0 

Now when right part is 0 it could be removed (but think on it as if it exists and is equal to zero) and it leaves you with implicit form of equation 


and that example is default expression value in ISO Surface node. Unit length sphere.

That node samples 3D space in ranges you set and for any point in that range generate surface (iso surface) if point's coordinates ($X,$Y,$Z) satisfy implicit equation you entered.

Equation of simple torus in implicit form would be

(R - sqrt(X^2 + Z^2))^2 + Y^2 - r^2

where R and r are large and small radius of torus


Without proper formulas for exact definition of your surfaces everything else is just guessing. If that is good enough you can try modify equation. Btw. any kind of function can be processed even something like


Doing proper math for repetition of many radius levels involve some of repetition functions like Modulus or trigonometry sin or cos. Rearranging arguments for solving for small r gives

r = sqrt((R - sqrt(X^2 + Z^2))^2 + Y^2)

replacing that instead of r in original function gives you 0 because any point doesn't matter of its coordinate satisfy equation, but if you expand that expression like this

r = int(N * sqrt((R - sqrt(X^2 + Z^2))^2 + Y^2)) / N

you actually quantize only those points which match quantized radius satisfy equation. 


As you can see in example you can also use logical function to clamp calculation in some segment. Expression length($X,0,$Z)<R clamp calculation only inside tube of radius R.

That example gives your image 1

On image 2 and 3 you can see that changing over Y axis bends toruses.   

so you have to put that in equation etc. This is NOT procedural approach, it is just pure math of surface representation for some equation and since you have images from Math software I suppose you also have exact function so you can use it on the same way in Houdini. 






  • Like 3

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this