fix ambient light
This commit is contained in:
parent
afcfee789b
commit
7152d9d274
2 changed files with 6 additions and 5 deletions
|
@ -144,14 +144,15 @@ fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
|||
);
|
||||
|
||||
// ambient
|
||||
let ambient_light_color = vec3(1.0);
|
||||
let ambient_strength = 0.025;
|
||||
let ambient_color = ambient_light_color * ambient_strength;
|
||||
let ambient_strength = 0.01;
|
||||
let ambient_color = ambient_strength * albedo;
|
||||
|
||||
var result = ambient_color + total_radiance;
|
||||
|
||||
// tonemap
|
||||
result = result / (result + vec3(1.0));
|
||||
// gamma correction
|
||||
// TODO: seems to already be handled by wgpu?
|
||||
// result = pow(result, vec3(1.0/2.2));
|
||||
|
||||
return vec4<f32>(result, object_color.a);
|
||||
|
|
|
@ -120,7 +120,7 @@ impl State {
|
|||
|
||||
let camera_controller = CameraController::new(400.0, 2.0);
|
||||
|
||||
let light_uniform = LightUniform::new([100.0, 60.0, 0.0], [1.0, 1.0, 1.0, 100000.0]);
|
||||
let light_uniform = LightUniform::new([100.0, 60.0, 0.0], [1.0, 1.0, 1.0, 200000.0]);
|
||||
|
||||
// We'll want to update our lights position, so we use COPY_DST
|
||||
let light_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue