For this morning, I gone through the wrangle workshop. For this workshop, I'm being taught what are some of the VEX expressions means and some of the operators how can we use it. For example, I want to make one torus to shift up by 2 units from the y-axis, I'll add in a "point wrangle" node firstly. Next, I'll start to write down the codes.
@P+={0,2,0}
This code would allow me to shift the torus up and it's in the y-axis.
Basically in this code, I learned that:
@ represent fetch
P represent the position
+= represents that regardless which point the object is at, we'll add the value to it
I'll also have to remember that every statement that I wrote has to end with a ;
It represents the end of my expression, something similar to the full-stop.
Other than that, I can also write my code this way:
@P = @P + {0,2,0};
This is exactly the same as my first code. So after that, I went on to explore the other code function. This time round, I noted down this expression.
v@P1 = set(0,2,0);
@P += @P1;
The "v" represents that I'm declaring the variable for the first time. So after the "v", whatever code that I write will be valid the next time I'm using it. The "v" also represents vector. So if I want to add in a new variable for int or float, I can use "i" and "f" to represent it. Then if I want to make the new variable that I'm creating to work, I can add in the last sentence.
So next, if I want to add a controller and make it an interface to the VEXpression, I can go to parameter interface and create e.g float and name it trans_y (if we intend to create a control for y-axis) then I'll have to go back to the VEXpression and change the value for y-axis to ch("trans_y"). I do not need to put ch("../") because it's in the same level. It'll look something like this:
To create the mountain shader, I can type in these expressions.
vector P1 = set(0,ch("trans_y"),0);
float rand_y = random(@ptnum + ch("seed"));
v@rand_v = set(0,rand_y*ch("noise_amp"),0);
@P += P1 + @rand_v;
Next, to type some notes beside the code, we can use this: //
When we insert it, whatever text that entered behind will not cause any errors.
We can also use this:
/*
Enter text here
*/
I can also make a specific area to become mountain by using a paint and paint on those spot that I want it to blend. I'll have to create a controller for blend to control how deep I want the mountain to dense. After that, I'll have to go to the pointwraggle and add in this expression:
@P = lerp(@P, point(@OpInput2, "P", @ptnum), ch("blend")* f@blendweight);
Lastly, I tried on the exercise that he gave by looking at his file and referencing it from there. I followed accordingly and create out the parameter interface then I typed in the pointwrangle those expressions. I tried around with the colours and adjusting it.
No comments:
Post a Comment