fix light position offset
This commit is contained in:
parent
7830d735b8
commit
7c6062dced
3 changed files with 3 additions and 7 deletions
|
@ -15,16 +15,13 @@ Controls:
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Physically based shading
|
- PBS
|
||||||
- (F: Fresnel-Schlick approximation)
|
|
||||||
- (G: Smith's Schlick-GGX)
|
|
||||||
- (D: Trowbridge-Reitz GGX)
|
|
||||||
- glTF models
|
- glTF models
|
||||||
- 1 realtime pointlight
|
- 1 realtime pointlight
|
||||||
- Simple wgsl preprocessor for includes
|
- Simple wgsl preprocessor for includes
|
||||||
- Runs on WASM and native desktop
|
- Runs on WASM and native desktop
|
||||||
- Tested on:
|
- Tested on:
|
||||||
- `Manjaro Linux 22.0.1 (6.1.7-1-MANJARO)`
|
- `Ubuntu 22.04 (Mesa 23.1.0-devel)`
|
||||||
- `Windows 10 Pro 21H2`
|
- `Windows 10 Pro 21H2`
|
||||||
- `Firefox 109.0`
|
- `Firefox 109.0`
|
||||||
- `Chrome 109.0.5414.120`
|
- `Chrome 109.0.5414.120`
|
||||||
|
|
|
@ -100,7 +100,7 @@ fn fs_main(vert: VertexOutput) -> @location(0) vec4<f32> {
|
||||||
|
|
||||||
var in_light = 0.0;
|
var in_light = 0.0;
|
||||||
for (var i: i32 = 0; i < 6; i++) {
|
for (var i: i32 = 0; i < 6; i++) {
|
||||||
in_light = sample_direct_light(i, light.matrices[i] * vert.world_position);
|
in_light = sample_direct_light(i, light.matrices[i] * (vert.world_position - vec4<f32>(light.position, 0.0)));
|
||||||
if (in_light > 0.0) {
|
if (in_light > 0.0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,7 +561,6 @@ impl State {
|
||||||
|
|
||||||
light_depth_render_pass.set_vertex_buffer(1, self.instance_buffer.slice(..));
|
light_depth_render_pass.set_vertex_buffer(1, self.instance_buffer.slice(..));
|
||||||
light_depth_render_pass.set_pipeline(&self.light_depth_pass.pipeline);
|
light_depth_render_pass.set_pipeline(&self.light_depth_pass.pipeline);
|
||||||
// TODO separate func
|
|
||||||
light_depth_render_pass.draw_model_instanced(
|
light_depth_render_pass.draw_model_instanced(
|
||||||
&self.model,
|
&self.model,
|
||||||
0..self.instances.len() as u32,
|
0..self.instances.len() as u32,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue