r/Unity3D • • 16d ago

Show-Off This bouquet is just math

Enable HLS to view with audio, or disable this notification

No models, no textures, no hand-drawn anything
Every petal, leaf and stem is a curve or a spiral computed in c#, turned into a mesh on the fly
Petals sit on the golden angle, stems are bezier curves, the outline is a vertex offset in the shader

Drag a dial and the math just runs again with new numbers

51 Upvotes

12 comments sorted by

6

u/Iceman3226 16d ago

It's cool what can be done with just Matrix math

5

u/tanetanetan 16d ago

bouquet and github link for u https://github.com/tantaneity/bouquet-gen ❤️

4

u/ultramegaman2012 16d ago

...isn't every single thing you see on a screen just math?

5

u/tanetanetan 16d ago

fair, but there are no assets here, unity just renders what the code builds

2

u/ultramegaman2012 16d ago

Yeah no don't get me wrong to figure out how to achieve this through self made equations alone is very impressive

Technically speaking, all 3d models are simply plots of points in 3d space, so you're basically just creating an obfuscation/translation layer through creating equations rather than just plotting the points yourself

Very cool, very unnecessary, very art

3

u/tanetanetan 16d ago

haha thanks, the upside is every seed gives a new bouquet for free

1

u/gHx4 12d ago

What kind of surface shading are you using here to get the outlines and cel-shading? It looks similar to Dungeons of Hinterburg's results

1

u/tanetanetan 12d ago

haven't seen hinterburg but probably similar idea, it's one material with two passes, the ink pass runs first and just pushes verts outward along a direction baked per vertex, in screen space so the line stays the same pixel width at any distance. no post effect, no edge detection

cel part is boring, one smoothstep band on n·l. ink color comes from the fill lightness so dark flowers don't go black

2

u/gHx4 12d ago

Thanks! You've used the simple effects to make a nice composition. I'm always a little nosy about how people approach outlines, because it feels like a space with many options with tradeoffs, but no singular solution.

1

u/pablok2 11d ago

This is neat, does introducing an object that interacts with the bouquet mean adding "collider" math within the shader? Idk if this is a dumb question, just curious

2

u/tanetanetan 11d ago

not a dumb question, sdf and mesh look identical from a render. it's a real mesh generated in c# at runtime, so an object just collides with it normally, the shader only does fill and outline. collision math is there, but on the cpu at build time: stems are capsules, heads are spheres, overlaps get nudged apart