How can I simulate color genetics?

Hello everyone!

I am very new to unreal engine and the whole digital stuff in general – Hence all some of my questions might be a bit dumb. Apologies for that!
I think the best would be to start in the beginning because there are some uncertainities from my side as well…

I (finally) managed to sculp a semi-decent horse model in blender. It has 10k quads - complete with eyes and inside mouth and all - in case that this matters. I hope that this is fine.
I started with creating the material for the horse and already here I’m facing some problems which I struggle to solve all by myself…

I wanted the horses coat color to be nuanced and somewhat realistic.
At first I tried to create a dynamic material instance in the construction script which was randomly modified through parameters that where driven by random float or int values in range so as randomly picked texture maps from array. It was very hard to balance the values of this approach and even tho many variations it created looked nice and realistic, there where also alot errors in it.
What bothered me the most was the lack of a logic that followed the basic rules of genetics. It was all random in the end. (And it was a bloody mess in general…)
Since my endgoal is a simulation where the horses can walk around, fullfilling their needs and ofc reproduce and have plausible offspring in terms of their appereance, I started all over again.

In my current approach I created a struct of arrays. The arrays resemble only the solid colors horses can have. For now thats fine for me, since the inheritance of patterns is mostly dominant and a very simple true/false. The Macro pulls 2 times from each individual array and appends the chars to a string. This is the genetic code for the base color.


I admit these strings do not look very pretty but they are basically the same logic as in the punnett square just with the information of all mutations that are possible. Even tho I don’t really intend to spawn the horses like that in the end result I thought it would be beneficial to have a material that is potentially able to express all possibilities to see where it goes after a while… :x

More realistic versions of this genetic code at spawn would look like a simplified version of the ones above because there wouldn’t be as many dilution genes inherited from the beginning.


With that strings assigned to the horses in the level I wanted to go through my material instance and set the conditions for the different branches. But I gave up on that method after a few hours, because after looking at what I created there I was sure that this is most likely not how it works…
Again – I am fairly new to all this computer stuff, so please don’t laugh at my not even half completed „thingy“…

Some google research I did pointed to recursive functions or some looping. But even tho I think I understand it roughly I don’t really know how to do it because I’m lacking the experience, I guess… (And I am really scared that I crash everything in an instant if I try it out randomly)
Also I I found the

Has any of you an idea/solution how to create a realistic genetic system that simulates rezessive, dom, co-dom and polygenetic inheritance?

Please let me know if I have to provide any further information
Thank you very much! :slight_smile: