Jump to content

Java to houdini vex,Generative Design


aoisaki

Recommended Posts

I watch houdini workshop about vex wrangle

 

Then i buy the book Generative Design

 

I like the noisy movie very much!

 

But when i want to work that in houdini 

 

There are too many stuff is different

 

Something I can find like TWO_PI

 

but something I can't

 

like noise function  noise ( noiseX,noiseY)

 

void setup

 

void draw

 

PVector

 

Did there some website have java to vex translate 

 

thank you!

Edited by aoisaki
Link to comment
Share on other sites

You need to understand both languages on some intermediate level. Essential part is to understand which code pieces are interchangeable and which are not. Implementation and architecture-related things usually cannot be translated, except cases where frameworks are very similar. On the other side, the algorithms itself usually can be translated from math formulas, pseudo-code from Wikipedia or pieces of code written in other programming languages. Syntax may be very similar and types, constants, functions are usually same too. Trigonometry, linalg, ray-trace, noises and PRNGs may be implemented differently but do the same job.

 

For example, it will take you about an hour to translate 2D intersection algorithm written in C to VEX version. The bonus is the VEX code tends to be more accurate, taking less lines. Authors of libraries usually provides some utility functions and classes taking thousands of lines of hard C++ code, but we always have big and friendly framework called Houdini. Sometimes it is better to go outside VEX and place couple of SOP nodes computing some useful attributes.

 

void setup and void draw routines seems to be part of Java/Processing framework doing internal stuff unrelated to visual algorithms, there is no VEX alternative. PVector looks like normal VEX's vector type, probably treated as position (you want to transform positions when doing some deforming, but you do not want to transform colors, in all other cases both position and color vectors can be treated as same 3-float structs). You need to understand what exactly that noise function returns and gets as an arguments. noise(noiseX, noiseY) looks like a Perlin/Simplex noise getting a position as an argument, like all normal noises does. It returns a float and gets a 2D vector as an argument (actually, 2 floats, not 2D vector, but it is implementation details). There is no float noise(vector2) function signature in VEX at this moment, but float noise(vector) is available.

vector pos = @P;             // Obtain position.
pos = set(pos.x, pos.y, 0);  // Set Z value to zero, simulating 2D input.
float result = noise(pos);   // Call "float noise(vector)" function.
@Cd = result;                // Set point colors to that noise value to see the result.

The last line is poor man's "draw" functionality. Place an XY-grid, connect a Point Wrangle and paste the above code in it. You will see the noise. See attached scene.

noise.hipnc

  • Like 1
Link to comment
Share on other sites

You need to understand both languages on some intermediate level. Essential part is to understand which code pieces are interchangeable and which are not. Implementation and architecture-related things usually cannot be translated, except cases where frameworks are very similar. On the other side, the algorithms itself usually can be translated from math formulas, pseudo-code from Wikipedia or pieces of code written in other programming languages. Syntax may be very similar and types, constants, functions are usually same too. Trigonometry, linalg, ray-trace, noises and PRNGs may be implemented differently but do the same job.

 

For example, it will take you about an hour to translate 2D intersection algorithm written in C to VEX version. The bonus is the VEX code tends to be more accurate, taking less lines. Authors of libraries usually provides some utility functions and classes taking thousands of lines of hard C++ code, but we always have big and friendly framework called Houdini. Sometimes it is better to go outside VEX and place couple of SOP nodes computing some useful attributes.

 

void setup and void draw routines seems to be part of Java/Processing framework doing internal stuff unrelated to visual algorithms, there is no VEX alternative. PVector looks like normal VEX's vector type, probably treated as position (you want to transform positions when doing some deforming, but you do not want to transform colors, in all other cases both position and color vectors can be treated as same 3-float structs). You need to understand what exactly that noise function returns and gets as an arguments. noise(noiseX, noiseY) looks like a Perlin/Simplex noise getting a position as an argument, like all normal noises does. It returns a float and gets a 2D vector as an argument (actually, 2 floats, not 2D vector, but it is implementation details). There is no float noise(vector2) function signature in VEX at this moment, but float noise(vector) is available.

vector pos = @P;             // Obtain position.
pos = set(pos.x, pos.y, 0);  // Set Z value to zero, simulating 2D input.
float result = noise(pos);   // Call "float noise(vector)" function.
@Cd = result;                // Set point colors to that noise value to see the result.

The last line is poor man's "draw" functionality. Place an XY-grid, connect a Point Wrangle and paste the above code in it. You will see the noise. See attached scene.

 

 

Thank you very much ! 

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