Created
May 23, 2026 08:14
-
-
Save danbri/76b3c752d6d93f799b7ca13699f45cc0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (scene "Flower Meadow" | |
| :version "1.2" | |
| :subtitle "Poppies and sunflowers with per-instance variation" | |
| (params | |
| (flowerSpacing :type scalar :value 0.5 :min 0.3 :max 1 :desc "Distance between flowers") | |
| (poppyColor :type color3 :value [0.9 0.1 0.1] :desc "Poppy petal color") | |
| (sunflowerColor :type color3 :value [1 0.85 0.1] :desc "Sunflower petal color") | |
| ) | |
| (defs | |
| (poppy | |
| (union | |
| (capsule :h 0.25 :r 0.012 :color [0.2 0.5 0.15]) | |
| (sphere :r 0.07 :color $poppyColor :translate [0 0.28 0] :scale [1 0.4 1]) | |
| (sphere :r 0.025 :color [0.1 0.1 0.1] :translate [0 0.3 0]))) | |
| (sunflower | |
| (union | |
| (capsule :h 0.35 :r 0.018 :color [0.25 0.45 0.1]) | |
| (sphere :r 0.12 :color $sunflowerColor :translate [0 0.4 0] :scale [1 0.3 1]) | |
| (sphere :r 0.06 :color [0.4 0.25 0.1] :translate [0 0.42 0]))) | |
| ) | |
| (root | |
| (union | |
| (repeat :period [$flowerSpacing 0 $flowerSpacing] | |
| (select {"type":"select","notes":"Select poppy (hash<0.6) or sunflower (hash>=0.6) - no translation hacks!","cond":{"expr":"step","args":[0.6,{"expr":"hash","args":[{"var":"flowerId"}]}]},"a":{"type":"ref","id":"poppy","notes":"Poppies when hash < 0.6 (60% of field) - large jitter breaks grid pattern","transform":{"translate":[{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},50]}]},0.5]},0.22]},0,{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},150]}]},0.5]},0.22]}],"rotate":[{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},200]}]},0.5]},25]},{"expr":"mul","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},300]}]},360]},{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},250]}]},0.5]},25]}],"scale":[{"expr":"add","args":[0.7,{"expr":"mul","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},600]}]},0.5]}]}]}},"b":{"type":"ref","id":"sunflower","notes":"Sunflowers when hash >= 0.6 (40% of field) - large jitter breaks grid pattern","transform":{"translate":[{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},70]}]},0.5]},0.2]},0,{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},170]}]},0.5]},0.2]}],"rotate":[{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},400]}]},0.5]},18]},{"expr":"mul","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},500]}]},360]},{"expr":"mul","args":[{"expr":"sub","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},450]}]},0.5]},18]}],"scale":[{"expr":"add","args":[0.75,{"expr":"mul","args":[{"expr":"hash","args":[{"expr":"add","args":[{"var":"flowerId"},700]}]},0.4]}]}]}}})))) | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment