Jump to content

Torus Procedural


faxingberlin

Recommended Posts

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

F4.large.jpg

http://www.pnas.org/content/110/1/34/F4.large.jpg

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.

z.thumb.JPG.bfcb51485071ecce9b28a07ce8598d31.JPG

topographically.hip

Edited by faxingberlin
Link to comment
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

sqrt(x^2+y^2+z^2)=1

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 

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

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

ISO_torus.hip

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

noise($X,$Y,$Z)

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. 

ISO_torus_repetition.hip

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 5
Link to comment
Share on other sites

  • 1 year later...
On 2017. 11. 19. at 11:44 PM, djiki said:

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

sqrt(x^2+y^2+z^2)=1

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 

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

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

ISO_torus.hip

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

noise($X,$Y,$Z)

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. 

ISO_torus_repetition.hip

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. 

 

 

  

 

 

Wow Really Thank u!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...