@vertex fn vs_main(input: VertexInput) -> VertexOutput { var output: VertexOutput; let instance_model = mat4x4( input.instance_model_0, input.instance_model_1, input.instance_model_2, input.instance_model_3 ); let world_pos = instance_model * vec4(input.position, 1.0); output.world_position = world_pos.xyz; output.clip_position = uniforms.projection * uniforms.view * world_pos; let normal_matrix = mat3x3( instance_model[0].xyz, instance_model[1].xyz, instance_model[2].xyz ); output.world_normal = normalize(normal_matrix * input.normal); output.light_space_position = uniforms.light_view_projection * world_pos; return output; } @fragment fn fs_main(input: VertexOutput) -> @location(0) vec4 { let shadow = sample_shadow_map(input.light_space_position); let tile_scale = 1.0; let flowmap_strokes = flowmap_path_lighting_with_shadow(input.world_position, input.world_normal, tile_scale, shadow); let point_strokes = point_lighting_with_shadow(input.world_position, input.world_normal, vec3(0.0, 100.0, 0.0), tile_scale, shadow); let brightness = max(flowmap_strokes, point_strokes); return vec4(brightness, brightness, brightness, 1.0); }