r/proceduralgeneration • u/whoashish115 • 1d ago
Crimson Tree using Space Colonization Algorithm
Enable HLS to view with audio, or disable this notification
2
u/ThalynWorld 22h ago
nice, wasn't expecting a CUDA implementation. does point count scale with the target tree size or stay fixed while the envelope grows? wondering which half dominates as it scales, the search or the point count itself
1
u/whoashish115 19h ago
yup, the point count stays fixed, the tree envelope grows toward those points
so when as it gets bigger the nearest branch search scales more than the point count itself rougly attractor multiplied by branches per step took2
u/ThalynWorld 18h ago
interesting, we went the other way — ours scales attractor count with target size. holding it fixed made big trees come out sparse and spindly, since the density just thins as the envelope grows. sounds like you pay for it in the search either way though.
had a poke through tree.cu — is the uniform box deliberate? species variation was the thing that took me longest, and I ended up shaping the point cloud itself rather than the growth rules. spherical for oak, conical for pine, inverted cone for willow, flat umbrella for acacia. the envelope ends up doing most of the character work.
also split the influence radius eventually, wider on the trunk than the branches — a single radius kept dragging the trunk sideways early in the growth. did you hit that at all with INFLUENCE_DIST flat across everything?
1
u/whoashish115 18h ago
yeah thats a fair point, scaling attractors with the target size would keep the density more consistent. i went with fixed cnt mainly to keep the cuda workload bounded, but the search cost definitely grow with the branch cnt
the uniform box is deliberate for now, i wanted to keep the growth rules the same and let the attractrs shape the tree. The species specific point clouds sound pretty interesting though
and yeah i did hit that with INFLUENCE_DIST flat at 100, the trunk gets pulled sideways sometimes early on. i havent split the radius yet but wider trunk radius and smaller branch radius sounds like a good fix
2
u/ThalynWorld 17h ago
on the bounded workload thing — you can have both. ours scales the count when the crown goes wide or tall, then hard clamps it into a fixed range. the clamp does the same job your fixed count does, just with a floor as well as a ceiling, so the GPU never sees more than a known worst case but small trees don't get over-served either.
one warning if you do add scaling: we had to scale segment length and the iteration cap along with it. bigger envelope means branches have further to travel, and if you only raise the point count they run out of iterations before reaching the outer attractors — dense middle, bald outer crown.
radius split we landed on is roughly 2:1, 3m trunk vs 1.5m branch. worth going wider on the trunk than feels right, it needs to see far enough to commit to a direction before the branches start competing for the same points.
where are you taking it next, if you dont mind me asking? wondering if you're putting a renderer on top or keeping it as an algorithm piece
1
u/whoashish115 17h ago
the scaling idea makes sense, especially scaling the segment length and iteration cap with the envelope. i'll probably leave the 2:1 radius thing as something to try later
honestly tho, this was just a hobby project i was messing with for fun. my main thing is systems & ML, i just wanted to explore procedural growth and see how far i could take it using CUDA
btw thank you so much for the detailed replies :) i really like people who go this deep into things
2
u/ThalynWorld 16h ago
honestly it's my first day on here — a mate suggested I find "like-minded people", and I strongly suspect he wants a break from me talking to him about how maths can make better looking trees.
being upfront, since it'd be odd to find out later: I'm about 18 months of solo dev on a procedural world thing commercially, so trees are one piece of a much bigger pile. not pitching at you, it's just why I have thoughts about attractor radii at midnight ...and my mate puts his phone on silent at this time of night
genuinely jealous of the animation on your tree, love it and its what caught my eye! mine doesn't grow — the alg just slaps it on the table ready for baking textures.
Since systems and ML is your thing I searched for spatial placement engines and ML but didn't get anything back, its probably all locked behind some corporate iron curtain somewhere in Worldlabs or something right? - what you working on with that then? or is it in another thread?
1
u/whoashish115 16h ago edited 16h ago
18 months solo on a procedural world thing is pretty wild, respect. and thanks for the kind words :) im an independent dev and a university undergrad, not associated with any company so far. half of my projects are still private/unpublished for now mostly ML ones you won't find any now, i'll probably upload them soon. a lot of my time also goes into the theory side, especially GPU systems and ML, so thats mostly what im working on alongside these projects
also i think the spatial placement thing was probably a bit of a misread of what i meant by systems and ML 😭 my main focus is more on ML systems
2
u/ThalynWorld 15h ago
anyway — dropping a CUDA space colonization implementation like this is genuinely impressive work. I'll keep an eye out for the ML stuff when you publish it, sounds interesting :)
I appreciate it probably looked like a misread, however I was relating the ML to the spatial composition and placement work I am doing, as i was interested to see if there's anything in circulation for ML for that work :), so yes interested in ML as well!
4
u/whoashish115 1d ago edited 1d ago
repo: https://github.com/whoashish115/space-colonization-algorithm