found nice regressions for star colors / star sizes
This commit is contained in:
parent
6d98a0e459
commit
52e5b09ffa
|
@ -3,7 +3,7 @@ actor 300000 0 500000 jupiter
|
|||
rotationy -1.40
|
||||
angularmomentum 0 0.0001 0
|
||||
|
||||
actor 2000 2000 0 asteroid1
|
||||
actor 2000 0 0 asteroid1
|
||||
scale 200
|
||||
|
||||
actor -2300 10 0 pizzeria
|
||||
|
|
37
src/world.rs
37
src/world.rs
|
@ -145,47 +145,24 @@ pub fn setup(
|
|||
// Generate starmap
|
||||
let sphere_handle = meshes.add(Sphere::new(1.0));
|
||||
for star in nature::STARS {
|
||||
//let clr = {|c: f32| c * 0.01 * (brightness * 50.0).powf(1.2).clamp(0.1, 100000.0) };
|
||||
//let clr = {|c: f32| c * 0.15 };
|
||||
//let clr = {|c: f32| c * 1.78136 * c.ln() + 5.03726 };
|
||||
//let clr = {|c: f32| c * 1.9293*c.powf(0.1382) };
|
||||
//let clr = {|c: f32| c * 0.0431866*brightness*brightness - 0.688256*brightness + 2.90952 };
|
||||
//let clr = {|c: f32| c * 0.0275015*mag*mag - 0.59251*mag + 2.93566 };
|
||||
//let size = {|mag: f32| 10.0 * 8.0*mag*mag - 100.0*mag + 400.0 };
|
||||
//let size = {|mag: f32| 10.0 * 8.0*mag*mag - 100.0*mag + 400.0 };
|
||||
let mag = star[3];
|
||||
let clr = {|color: f32|
|
||||
let scale_color = {|color: f32|
|
||||
if mag < -20.0 {
|
||||
color * 13.0 // Sun
|
||||
} else if mag < 0.0 {
|
||||
color * 5.0
|
||||
} else if mag < 0.5 {
|
||||
color * 4.2
|
||||
} else if mag < 1.5 {
|
||||
color * 3.5
|
||||
} else if mag < 2.5 {
|
||||
color * 2.0
|
||||
} else if mag < 3.5 {
|
||||
color * 1.0
|
||||
color * 13.0f32 // Sun
|
||||
} else {
|
||||
color * 0.15
|
||||
color * (0.0659663 * mag * mag - 1.09862 * mag + 4.3)
|
||||
}
|
||||
};
|
||||
let size = {|mag: f32|
|
||||
let scale_size = {|mag: f32|
|
||||
if mag < -20.0 {
|
||||
40000.0f32 // Sun
|
||||
} else if mag < 0.0 {
|
||||
20000.0f32
|
||||
} else if mag < 2.0 {
|
||||
10000.0f32
|
||||
} else {
|
||||
5000.0f32
|
||||
1000.0 * (0.230299 * mag * mag - 3.09013 * mag + 15.1782)
|
||||
}
|
||||
};
|
||||
let (r, g, b) = nature::star_color_index_to_rgb(star[4]);
|
||||
let star_color_handle = materials.add(StandardMaterial {
|
||||
base_color: Color::rgb(clr(r), clr(g), clr(b)),
|
||||
//emissive: Color::rgb_linear(r*brightness, g*brightness, b*brightness),
|
||||
base_color: Color::rgb(scale_color(r), scale_color(g), scale_color(b)),
|
||||
unlit: true,
|
||||
..default()
|
||||
});
|
||||
|
@ -200,7 +177,7 @@ pub fn setup(
|
|||
dist * star[1],
|
||||
dist * star[2],
|
||||
)
|
||||
.with_scale(Vec3::splat(size(mag))),
|
||||
.with_scale(Vec3::splat(scale_size(mag))),
|
||||
..default()
|
||||
}
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue