colorofblack Posted October 12, 2020 Share Posted October 12, 2020 Hi everyone, I'm currently trying to fit as many bounding boxes (from buildings) onto city blocks as possible. As the way described (I followed a tutorial on pluralsight) didn't provide me with the result I wanted (more tightly packed city blocks) I tried to combine other methods with it. The most promising approach seemed to be using the UV Layout node to pack as many bounding boxes onto the city block as possible and in later stages of the process "pull them to the streets" and save out the points of the bounding boxes, replacing them with the actual building geometry. The problem I'm now facing is the following: While the UV Layout SOP rotates, packs and prepares my bounding boxes fine on the city blocks, it doesn't affect the normals of the primitives I want to be packed. I'm giving them a normal of 1|0|0 and even though they are clearly rotated, the normal still points into the same direction. This results in a wrong rotation when I'm later copying the real buildings onto the points as only the changed rotation by the sim that pulls them to the streetside is applied to the normal. The rotation that was already there by the UV Layout SOP gets lost. The question now would be: Is there a way to somehow access the rotation of the primitives that gets applied via the UV Layout SOP? If no, does anyone have another idea how to rather tightly pack the cityblocks with geometry ? I can't seem to find another solution for geometry packing onto surfaces really. Any help would be greatly appreciated! Cheers Daniel Quote Link to comment Share on other sites More sharing options...
Librarian Posted October 13, 2020 Share Posted October 13, 2020 I use this for mine Patterns on points prims and vertices .Hope it Helps #include <voplib.h> vector N_A; vector N_B; vector crossprod; int nb1ptnum; int nb2ptnum; float product; float dotprod; float trig; float deg; if(@ptnum==0){ nb1ptnum = (npoints(0)-1); nb2ptnum = 1; }else if(@ptnum==(npoints(0)-1)){ nb1ptnum = @ptnum-1; nb2ptnum = 0; }else{ nb1ptnum = @ptnum-1; nb2ptnum = @ptnum+1; } N_A=point(@OpInput1,"P",@ptnum)-point(@OpInput1,"P",nb1ptnum); N_B=point(@OpInput1,"P",@ptnum)-point(@OpInput1,"P",nb2ptnum); crossprod = vop_cross(normalize(N_A), normalize(N_B)); dotprod = vop_dot(normalize(N_A), normalize(N_B)); trig = vop_acos(dotprod); deg = vop_degrees(trig); if(crossprod.y > 0){ f@degree360=360-deg; }else{ f@degree360=deg; } Quote Link to comment Share on other sites More sharing options...
Librarian Posted October 13, 2020 Share Posted October 13, 2020 Or use this File Hope it Helps!!! @colorofblack or take the contact with Pluralsight you have pay for Tutorial they maybe gonna Help UVDIR.rar 1 Quote Link to comment Share on other sites More sharing options...
colorofblack Posted October 13, 2020 Author Share Posted October 13, 2020 Hey @Librarian thanks for your input! That's a really neat approach! I was able to produce a "fix" for my problem. As I have the base primitives that are going to be packed (non rotated) with an id and the packed primitives (rotated but without changed normal / orientation), I used an extract transform SOP to get the orientation change. This seems to work. Maybe not the most elegant solution but that was what I got after banging my head against this problem for a day Asking Pluralsight (or the teacher) wasn't really an option, as I changed from their approach (building clusters where only the buildings fitting completely onto the city block get cut out..which resulted in not really packed blocks for me) to using the UV Layout SOP to get a nice packing before the simulation they use later on. Cheers and thanks a lot! Daniel 1 Quote Link to comment Share on other sites More sharing options...
Librarian Posted October 13, 2020 Share Posted October 13, 2020 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.