Jump to content

WLVL

Members
  • Content count

    45
  • Joined

  • Last visited

Community Reputation

13 Good

1 Follower

About WLVL

  • Rank
    Peon

Personal Information

  • Name
    Davide

Recent Profile Visitors

1,197 profile views
  1. “I'm having a hard time; I'm preparing my next mistake.” B.Brecht

  2. ok i found that using PolyCut instead of the Fuse/unique solved the problem. So F1 code + separation post solver. Convert line doesn't keep attributes, but is definitely useful in other situation. thanks again
  3. I found the piece of code that i was looking for to modify the algorithm in the creation stage. I asked for a "post" solution at first because i knew some side fx would come along, but now i got everything under control. My code generates one prim at each iteration, the advantage of this approach is that i can separate the various branches in chunks after the creation stage. That's what i do using a FuseSOP set to Unique, acting only on a group of points ("primchunk_node" group). This primchunks are used later for the "flip/unfold effect". F1 code is much better optimized since it creates only one primitive per branch. But in this way i can't separate them afterwards, or at least not with the FuseSOP/Unique approach. I modified the code to create one prim also for each primchunk_node. The only downside is that while tweaking the unfold effect, if i want to change the primchunk distribution i have to re-run the solver. Thanks for helping once again! ///Original - Primchunk selection after solver int new_pt = addpoint(0, newP); int new_prim = addprim(0, "polyline"); addvertex(0, new_prim, @ptnum); addvertex(0, new_prim, new_pt); ///F1's - Primchunk selection in solver int new_pt = addpoint(0, newP); if (neighbourcount(0, @ptnum) == 1 && !@group_primchunk_node ) { // Add new point to existing polyline. int new_prim = pointprims(0, @ptnum)[0]; addvertex(0, new_prim, @ptnum);//addded addvertex(0, new_prim, new_pt); } else { // Create new generation. Seed case + branching nodes + primchunk nodes int new_prim = addprim(0, "polyline"); addvertex(0, new_prim, @ptnum); addvertex(0, new_prim, new_pt); int old_prim = pointprims(0, @ptnum)[0]; int new_branch = prim(0, "branch", old_prim) + 1; setprimattrib(0, "branch", new_prim, new_branch); Attached you find the project im working on, I started from a already done space colonization algorithm. I customized it and worked mainly on the post solver effects to randomize growth speed and other attributes, and on the unfold effect. I will publish a cleaner network, when ill be done! If you have any question feel free to ask space_colonizer_v11.hip
  4. ps. sorry for the mistyping, editing the post doesn't seem to work for me.
  5. ... i can't modify the algorhitm at this time, i will need a "post" solution. so maurits's option are not an option unluckily. mestela's technique is nice but it doesn't support the branched structure, for what i experienced. i'd like to have one prim for each primchunk ( = my id attribute in the example file).
  6. thanks for helping. Maybe i oversimplified the example hip. attached you will find the geometry i am working with. It's a geo created throught a space colonization algorithm, for no branched_structure.193.bgeo.sc
  7. Hello Odforce, i have several curves made of 1 prim every 2 points. Each curve is identified by an id attribute. I'd like to have only one primitive per curve. I tried the join SOP for each id without success. Example hip attached. thanks for helping multiprim_reduce.hip
  8. polygon creation in VEX - ptnum order

    Attached the finished tool, time to move to something else! thank you Odforce huge thanks to F1! ring_segmentizer_v001.hip
  9. polygon creation in VEX - ptnum order

    Hi F1! thank you for the support very last questions on this project (i hope!) 1 How come that if i simplify these two lines the result changes? should it? float angle_lon = arc_width; float arc_length_lon = r_max*radians(angle_lon); 2 how would i keep track of the segment id? i would like to pull it off as an attribute. The problem is that it resets for each ring. I would need a way to store how many while loop have been done before, and use that as the initialization number of seg_id. this is not strictly necessary for this code since i could just use a connectivity after the wrangle to get that segment_id. I am asking just for better understanding
  10. polygon creation in VEX - ptnum order

    thanks F1!!! 1,2 and 2b solved and updated. 0. I can't understand what I'm supposed to do. I mean i understand i could use if statements based on a integer menu. What I was wondering is if there is a more direct way because i have more than 2 rotation type to choose from, let's say we have 10 different kind. With my basic knowledge of coding i would do 10 if statements. but maybe there are better ways
  11. polygon creation in VEX - ptnum order

    Hello Odforce! hip attached of the first version of the " VEX sphere slices geo generator " (i am still thinking about the proper fancy name ) Please tell me what you think about it, do you think some important features are missing? To take it a step further i will need some help. QUESTION 0 ORDERED MENU IN VEX I want to be able to switch among different rotation type. float spin_rnd = ...; float spin_trig = ...; float spin_reg = ...; string spin_type = chs("spin_type"); //ordered menu with names corresponding to the different types of rotation float w = amp*spin_type; // this gives me an error : call to undefined binary operator `float = float*string` how do i make him interpret that spin_type string as the float variable? QUESTION 1 RESOLUTION I'd like the resolution of the segments to be proportional/based on their size. When using many rings (say 100) the inner ones don't need the same res of the outers. this would be a nice optimization of the asset when generating a high number of rings. currently the generation of the segments is "angle based", (theta+theta_step) what i am thinking is to convert the logic to "arc based"... i tried this but doesn't work as aspected //proportional resolution if(theta_step*r_max < ch("test_theta_step")){ res_lon -=1; theta_step = (end_theta - start_theta) / (res_lon - 1); } QUESTION 2 the code runs once over detail. why can't I use @Frame? isn't it a global variable? (right now i'm channel referencing to a $FF for animations) QUESTION 2bis is there a way to export attributes even if we run on detail? i think would be cool to have ring_id down the line. createVEX_v02.hip VEXgeo_creation - v001.wmv
  12. polygon creation in VEX - ptnum order

    that's perfectly clear now, thank you a ton F1!!!!
  13. polygon creation in VEX - ptnum order

    Hi F1, thank you again! your help is very much appreciated, So what you are doing is making sure that for every segment in/out the pt order is the same (that's given by the creation order), and that the vertex assignment order for every prim is also in the same turn (right-hand rule, thumb toward the inside of the segment). I get lost when i try to understand how you do that.. but I will try my best to reveal the mistery and get back here if I really can't in the meantime i am expanding the script to make multiple rings, to randomize stuff, and to prepare for animation (randomized based on segments). I will post the script when I have some nice results. Thanks for now!
  14. polygon creation in VEX - ptnum order

    Hello F1, Would you mind clarify the vertex creation process? I am not sure i understand how you manage to create the vertex with the right order, especially on the sides. what im doing now, is create multiple copies of the sphere-slice along a ring. I am missing the side faces. I basically insert your script in a function, and then i call that function in a for loop. Thank you for helping! int segment(int res_lon; float start_theta; float end_theta; int res_lat; float start_phi; float end_phi; float r_min; float r_max;){ // Inner surface. float theta_step = (end_theta - start_theta) / (res_lon-1); float phi_step = (end_phi - start_phi) / (res_lat-1); for (int i = 0; i < res_lat ; i++) { for (int j = 0; j < res_lon; j++) { // Calculate longitude arc point position. float theta = start_theta + theta_step * j; float phi = start_phi + phi_step * i; matrix r = ident(); vector pos = set(cos(theta), 0, sin(theta)) * r_min; vector axis = cross(normalize(pos), {0,1,0}); rotate(r, phi, axis); int pt = addpoint(geoself(), pos * r); if (i > 0 && j > 0) { // Create a new quad. int prim = addprim(geoself(), "poly"); addvertex(geoself(), prim, pt - res_lon); addvertex(geoself(), prim, pt - res_lon - 1); addvertex(geoself(), prim, pt - 1); addvertex(geoself(), prim, pt); } } } // Outer surface. Same except r_max used and reversed vertex order. for (int i = 0; i < res_lat ; i++) { for (int j = 0; j < res_lon; j++) { // Calculate longitude arc point position. float theta = start_theta + theta_step * j; float phi = start_phi + phi_step * i; matrix r = ident(); vector pos = set(cos(theta), 0, sin(theta)) * r_max; vector axis = cross(normalize(pos), {0,1,0}); rotate(r, phi, axis); int pt = addpoint(geoself(), pos * r); if (i > 0 && j > 0) { // Create a new quad (reverse vertex order). int prim = addprim(geoself(), "poly"); addvertex(geoself(), prim, pt); addvertex(geoself(), prim, pt - 1); addvertex(geoself(), prim, pt - res_lon - 1); addvertex(geoself(), prim, pt - res_lon); } } } // Side surfaces. for (int i = 1; i < res_lon; i++) { int prim; int surface_ptnum = res_lon * res_lat; // Bottom. prim = addprim(geoself(), "poly"); addvertex(geoself(), prim, i - 1); addvertex(geoself(), prim, i); addvertex(geoself(), prim, i + surface_ptnum); addvertex(geoself(), prim, i - 1 + surface_ptnum); // Top. prim = addprim(geoself(), "poly"); addvertex(geoself(), prim, i + surface_ptnum - res_lon); addvertex(geoself(), prim, i - 1 + surface_ptnum - res_lon); addvertex(geoself(), prim, i - 1 + surface_ptnum + surface_ptnum - res_lon); addvertex(geoself(), prim, i + surface_ptnum + surface_ptnum - res_lon); } for (int i = 1; i < res_lat; i++) { int prim; int surface_ptnum = res_lon * res_lat; // Side A. prim = addprim(geoself(), "poly"); addvertex(geoself(), prim, i * res_lon); addvertex(geoself(), prim, i * res_lon - res_lon); addvertex(geoself(), prim, i * res_lon - res_lon + surface_ptnum); addvertex(geoself(), prim, i * res_lon + surface_ptnum); // Side B. prim = addprim(geoself(), "poly"); addvertex(geoself(), prim, i * res_lon - 1); addvertex(geoself(), prim, i * res_lon - 1 + res_lon); addvertex(geoself(), prim, i * res_lon - 1 + res_lon + surface_ptnum); addvertex(geoself(), prim, i * res_lon - 1 + surface_ptnum); } //return prim; } //RING CREATION int res_lon = chi("res_lon"); // Longitude resolution. float s_theta = radians(ch("start_theta")); float e_theta = radians(ch("end_theta")); int res_lat = chi("res_lat"); // Latitude resolution. float s_phi = radians(ch("start_phi")); float e_phi = radians(ch("end_phi")); float r_min = ch("r_min"); float r_max = ch("r_max"); float theta = 0; float phi = 0; for ( int j=0; j<3; j++){ segment(res_lon, theta, theta+1, res_lat, phi, phi+.5, r_min, r_max); theta += 1 + 0.5; } PS. there is not a VEX syntax highlighting on odforce?
×