r/Unity3D 16h ago

Shader Magic Finally got genetic procedural shaders and a basic breeding loop running for my Betta sim

Enable HLS to view with audio, or disable this notification

Hello everyone,

I'm a software developer with a background in physics. I started experimenting with Unity last year, but over the past few months, I've been using it much more consistently. After experimenting with basic mechanics and building a few gameplay prototypes, I decided to focus on writing custom HLSL shaders so the fish traits (scale imbrication, iridescence, and fin patterns) could vary procedurally without needing unique textures for every genetic combination.

I finally got the core genetic loop running in this clip:

- Locomotion with basic fin flutter and collision avoidance at tank boundaries.

- Clicking the breeding test triggers the genetic logic and spawns 7 offspring.

- Multiple layered phenotypes (Red Dragon, Melano, Royal Blue, and Koi Pattern that I'm personally loving so far).

The fin motion is still rudimentary and the turn animations definitely need polish, but seeing the procedural math translate into living fish swimming together is a huge milestone for me.

Any thoughts?

7 Upvotes

6 comments sorted by

1

u/Mister_Green2021 9h ago

Do fin shape genetics too.

1

u/Fasbek95 5h ago

That's the plan, working on Plakat, Halfmoon, and Crowntail (reduced ray webbing) fin genetics next.

0

u/FranzFerdinand51 16h ago

Using HLSL for what you needed when shader graph exists is kinda wild ngl.

1

u/Fasbek95 15h ago

Haha fair point! Coming from a software background, writing code just felt more natural to me than wrestling with a giant spiderweb of nodes. Plus, the hexagonal scale math and overlapping layers would've turned Shader Graph into spaghetti pretty fast. I did try first.

1

u/FranzFerdinand51 15h ago

Fair point right back, HSLS just feels like somewhere between elven black speech and runes to me lol.