[READ-ONLY] Mirror of https://github.com/flo-bit/tiny-planets. procedurally generated tiny planets in the browsers
flo-bit.dev/tiny-planets/
low-poly
planets
procedural-generation
threejs
4.8 kB
291 lines
1import { type BiomeOptions } from "./biome";
2import { PlanetOptions } from "./planet";
3
4const beachBiome: BiomeOptions = {
5 noise: {
6 min: -0.05,
7 max: 0.05,
8 octaves: 4,
9 lacunarity: 2.0,
10 gain: {
11 min: 0.1,
12 max: 0.8,
13 scale: 2,
14 },
15 warp: 0.3,
16 scale: 1,
17 power: 1.5,
18 },
19
20 colors: [
21 [-0.5, 0x994400],
22 [-0.0, 0xccaa00],
23 [0.4, 0xcc7700],
24 [1.0, 0x002222],
25 ],
26
27 seaColors: [
28 [-1, 0x000066],
29 [-0.55, 0x0000aa],
30 [-0.1, 0x00f2e5],
31 ],
32 seaNoise: {
33 min: -0.008,
34 max: 0.008,
35 scale: 6,
36 },
37
38 vegetation: {
39 items: [
40 {
41 name: "Rock",
42 density: 50,
43 minimumHeight: 0.1,
44 colors: {
45 Gray: { array: [0x775544] },
46 },
47 },
48 {
49 name: "PalmTree",
50 density: 50,
51 minimumHeight: 0.1,
52 colors: {
53 Brown: { array: [0x8b4513, 0x5b3105] },
54 Green: { array: [0x22851e, 0x22a51e] },
55 DarkGreen: { array: [0x006400] },
56 },
57 ground: {
58 color: 0x229900,
59 radius: 0.1,
60 raise: 0.01,
61 },
62 },
63 ],
64 },
65};
66
67const forestBiome: BiomeOptions = {
68 noise: {
69 min: -0.05,
70 max: 0.05,
71 octaves: 4,
72 lacunarity: 2.0,
73 gain: {
74 min: 0.1,
75 max: 0.8,
76 scale: 2,
77 },
78 warp: 0.3,
79 scale: 1,
80 power: 0.8,
81 },
82
83 tintColor: 0x113322,
84
85 colors: [
86 [-0.5, 0x332200],
87 [-0.0, 0x115512],
88 [0.4, 0x224411],
89 [1.0, 0x006622],
90 ],
91
92 seaColors: [
93 [-1, 0x000066],
94 [-0.52, 0x0000aa],
95 [-0.1, 0x0042a5],
96 ],
97 seaNoise: {
98 min: -0.005,
99 max: 0.005,
100 scale: 5,
101 },
102
103 vegetation: {
104 items: [
105 {
106 name: "Rock",
107 density: 5,
108 minimumHeight: 0.1,
109 colors: {
110 Gray: { array: [0x888888, 0x616161, 0x414141] },
111 },
112 },
113 {
114 name: "CommonTree",
115 density: 5,
116 minimumHeight: 0.0,
117 },
118 {
119 name: "Bush",
120 density: 5,
121 minimumHeight: 0.0,
122 },
123 {
124 name: "CommonTree_Dead",
125 density: 5,
126 },
127 {
128 name: "PineTree",
129 density: 5,
130 },
131 {
132 name: "TreeStump",
133 density: 1,
134 },
135 {
136 name: "TreeStump_Moss",
137 density: 1,
138 },
139 {
140 name: "Willow",
141 density: 5,
142 },
143 {
144 name: "Willow_Dead",
145 density: 5,
146 },
147 {
148 name: "WoodLog",
149 density: 1,
150 },
151 {
152 name: "BirchTree",
153 density: 5,
154 },
155 {
156 name: "BirchTree_Dead",
157 density: 5,
158 },
159 ],
160 },
161};
162
163const snowForestBiome: BiomeOptions = {
164 noise: {
165 min: -0.05,
166 max: 0.05,
167 octaves: 4,
168 lacunarity: 2.0,
169 gain: {
170 min: 0.1,
171 max: 0.8,
172 scale: 2,
173 },
174 warp: 0.3,
175 scale: 1,
176 power: 0.8,
177 },
178
179 tintColor: 0x119922,
180
181 colors: [
182 [-0.5, 0xff99ff],
183 [-0.0, 0xffffff],
184 [0.4, 0xeeffff],
185 [1.0, 0xffffff],
186 ],
187
188 seaColors: [
189 [-1, 0x8899cc],
190 [-0.52, 0xaaccff],
191 [-0.1, 0xaaccff],
192 ],
193 seaNoise: {
194 min: -0.0,
195 max: 0.001,
196 scale: 5,
197 },
198
199 vegetation: {
200 items: [
201 {
202 name: "Rock_Snow",
203 density: 5,
204 minimumHeight: 0.1,
205 colors: {
206 Gray: { array: [0x888888, 0x616161, 0x414141] },
207 },
208 },
209 {
210 name: "CommonTree_Snow",
211 density: 5,
212 minimumHeight: 0.0,
213 },
214 {
215 name: "Bush_Snow",
216 density: 5,
217 minimumHeight: 0.0,
218 },
219 {
220 name: "CommonTree_Dead_Snow",
221 density: 5,
222 },
223 {
224 name: "PineTree_Snow",
225 density: 5,
226 },
227 {
228 name: "TreeStump_Snow",
229 density: 1,
230 },
231 {
232 name: "TreeStump_Snow",
233 density: 1,
234 },
235 {
236 name: "Willow_Snow",
237 density: 5,
238 },
239 {
240 name: "Willow_Dead_Snow",
241 density: 5,
242 },
243 {
244 name: "WoodLog_Snow",
245 density: 1,
246 },
247 {
248 name: "BirchTree_Snow",
249 density: 5,
250 },
251 {
252 name: "BirchTree_Dead_Snow",
253 density: 5,
254 },
255 ],
256 },
257};
258
259export const biomePresets: Record<string, BiomeOptions> = {
260 beach: beachBiome,
261 forest: forestBiome,
262 snowForest: snowForestBiome,
263};
264
265const beachPlanet: PlanetOptions = {
266 biome: {
267 preset: "beach",
268 },
269
270 material: "caustics",
271};
272
273const forestPlanet: PlanetOptions = {
274 biome: {
275 preset: "forest",
276 },
277
278 material: "normal",
279};
280
281const snowForestPlanet: PlanetOptions = {
282 biome: {
283 preset: "snowForest",
284 },
285};
286
287export const planetPresets: Record<string, PlanetOptions> = {
288 beach: beachPlanet,
289 forest: forestPlanet,
290 snowForest: snowForestPlanet,
291};