Remove glare
This commit is contained in:
parent
ae6b1f6b0d
commit
84b8e9c9a5
|
|
@ -112,8 +112,6 @@ impl Renderer {
|
|||
trace::Aperture {
|
||||
radius: 0.0003,
|
||||
focal_distance: std::f32::INFINITY,
|
||||
glare_strength: 0.1,
|
||||
glare_radius: 0.1,
|
||||
},
|
||||
location,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,8 +22,6 @@ pub struct Viewport {
|
|||
pub struct Aperture {
|
||||
pub radius: f32,
|
||||
pub focal_distance: f32, // from 0 (exclusive) to +∞ (inclusive)
|
||||
pub glare_strength: f32,
|
||||
pub glare_radius: f32, // at distance 1
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
|
|
@ -50,8 +48,6 @@ struct CameraData {
|
|||
aperture: f32,
|
||||
eye: Vec3,
|
||||
antifocal: f32,
|
||||
glare_strength: f32,
|
||||
glare_radius: f32,
|
||||
}
|
||||
|
||||
impl From<(Viewport, CameraLocation, Aperture)> for CameraData {
|
||||
|
|
@ -65,8 +61,6 @@ impl From<(Viewport, CameraLocation, Aperture)> for CameraData {
|
|||
height: value.0.corner.y / value.0.corner.z,
|
||||
aperture: value.2.radius,
|
||||
antifocal: 1. / value.2.focal_distance,
|
||||
glare_strength: value.2.glare_strength,
|
||||
glare_radius: value.2.glare_radius,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,9 +12,6 @@ struct Params {
|
|||
aperture: f32,
|
||||
eye: vec3f,
|
||||
antifocal: f32,
|
||||
|
||||
glare_strength: f32,
|
||||
glare_radius: f32,
|
||||
}
|
||||
|
||||
struct Sphere {
|
||||
|
|
@ -82,13 +79,7 @@ fn trace_fragment(in: Varying) -> vec3f {
|
|||
pos = params.eye + aperture_offset_abs;
|
||||
let off_px = vec2(rand_float(), rand_float()) - .5;
|
||||
let off_w = mat2x3(dpdx(in.dir), dpdy(in.dir));
|
||||
var dir = in.dir + off_w * off_px;
|
||||
if (rand_float() < params.glare_strength) {
|
||||
let p = rand_float();
|
||||
let d = params.glare_radius * pow(p, 2.);
|
||||
let glare_off = d * rand_disc();
|
||||
dir += view_mtx * vec3(glare_off, 0.);
|
||||
}
|
||||
let dir = in.dir + off_w * off_px;
|
||||
ray = normalize(dir - params.antifocal * aperture_offset_abs);
|
||||
|
||||
for (var k = 0; k < params.max_reflections; k++) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user