Remove color variance

It didn’t look all that well on the new background
This commit is contained in:
numzero 2024-12-29 22:13:17 +03:00
parent cb500033c0
commit 221fbfbcb8

View File

@ -3,7 +3,6 @@ use rand_distr::{Bernoulli, Distribution, Uniform};
pub struct SphereParams { pub struct SphereParams {
pub radius: f32, pub radius: f32,
pub color: Vec3,
pub alpha: f32, pub alpha: f32,
pub glossiness: f32, pub glossiness: f32,
pub origin: Vec3, pub origin: Vec3,
@ -15,7 +14,6 @@ pub struct SphereParams {
pub struct SphereParamsDistribution { pub struct SphereParamsDistribution {
pub drad: Uniform<f32>, pub drad: Uniform<f32>,
pub dpos: Uniform<f32>, pub dpos: Uniform<f32>,
pub dcol: Uniform<f32>,
pub demit: Bernoulli, pub demit: Bernoulli,
pub dampl: Uniform<f32>, pub dampl: Uniform<f32>,
pub dfreq: Uniform<f32>, pub dfreq: Uniform<f32>,
@ -28,7 +26,6 @@ impl Default for SphereParamsDistribution {
Self { Self {
drad: Uniform::new(0.01, 0.10), drad: Uniform::new(0.01, 0.10),
dpos: Uniform::new(-1.0, 1.0), dpos: Uniform::new(-1.0, 1.0),
dcol: Uniform::new(0.0, 1.0),
demit: Bernoulli::new(0.1).unwrap(), demit: Bernoulli::new(0.1).unwrap(),
dampl: Uniform::new(0.3, 0.8), dampl: Uniform::new(0.3, 0.8),
dfreq: Uniform::new(0.2, 1.5), dfreq: Uniform::new(0.2, 1.5),
@ -43,7 +40,6 @@ impl SphereParamsDistribution {
SphereParams { SphereParams {
origin: self.dpos.sample3(rgen), origin: self.dpos.sample3(rgen),
radius: self.drad.sample(rgen), radius: self.drad.sample(rgen),
color: self.dcol.sample3(rgen).normalize(),
alpha: if self.demit.sample(rgen) { 10.0 } else { 0.0 }, alpha: if self.demit.sample(rgen) { 10.0 } else { 0.0 },
glossiness: self.dgloss.sample(rgen), glossiness: self.dgloss.sample(rgen),
amplitudes: self.dampl.sample3(rgen), amplitudes: self.dampl.sample3(rgen),
@ -57,9 +53,9 @@ impl SphereParams {
pub fn to_sphere(&self, time: f32) -> crate::Sphere { pub fn to_sphere(&self, time: f32) -> crate::Sphere {
let center = self.origin + self.amplitudes * (self.frequencies * time + self.phases).map(|x| x.sin()); let center = self.origin + self.amplitudes * (self.frequencies * time + self.phases).map(|x| x.sin());
let radius = self.radius; let radius = self.radius;
let emit_color = self.alpha * self.color; let emit_color = self.alpha * vec3(0.9, 0.6, 0.1);
let glossiness = self.glossiness; let glossiness = self.glossiness;
let reflect_color = 0.6 * self.color + Vec3::splat(0.2); let reflect_color = Vec3::splat(0.8);
crate::Sphere { crate::Sphere {
center, center,
radius, radius,