CSG routines
Community Forums/Showcase/CSG routines
| ||
Download here: http://abcbasic.comyr.com/csg.zip (updated with improved routines) Finally I made progress with CSG routines. I started over again, this time using BSP trees. The result is better than what I tried before when using the Laidlaw approach. I'm very happy. |
| ||
Nice. |
| ||
You're my man! |
| ||
Impressively cool |
| ||
would love to see code to do this :) |
| ||
Laidlaw? http://en.wikipedia.org/wiki/Laidlaw |
| ||
You're my man! No, the man. He's the man. |
| ||
How do you know? :P |
| ||
ok so what exactly is csg? I know it means constructive solid geometry but what does that do? sorry. I just never understood it. and yeah I googled it and did a forum search but found out nothing more than it stood for constructive solid geometry |
| ||
If you've used an 3d modelling programs, you've probably heard it called boolean operations. CSG means modelling using the boolean operations : Union, Difference and Intersection. Union is effectively glueing two objects together. Difference is cutting Object B out of Object A. Intersection is.. well it's finding the geometry in Object B which is also part of Object A. The special thing about CSG is that it creates new vertices where necessary so that you don't actually end up with any hidden bits of intersecting geometry tucked away inside the visible geometry. It also preserves UV coordinates. |
| ||
oh. that sounds hard to do. thanks for the explanation. |
| ||
WTF has a school bus firm got even the slightest thing to do with CSG |
| ||
Sure, I was refering to that company, they were a great help. Also this page: http://www.flipcode.com/archives/Constructive_Solid_Geometry.shtml |
| ||
![]() I've made some progress. BSP trees are now merged when an object is added/substracted. To try out the routines I've made a testing program. You can download it here: http://abcbasic.comyr.com/csg.zip |
| ||
looks good, but you need to sort out uv scaling to unify between shape sizes. If I make a small shape the UVs are tiny, but if I make a large one, the UVs are also scaled. Making it look like a circus of UV scaling :). Perhaps have uv scaling optional? |
| ||
Thanks RifRaf. I have uploaded a new version, with unified UV coordinates on the cubes. This wasn't intended to be a serious editor for now, though. It is just a program to show/test how the CSG operations are working. EDIT: Again, updated. The new routines are working properly. Also, I first add a bounding box for new shapes, so the whole mesh doesn't get as fragmented as before when adding for example spheres. |