From 9d60be86abce0d8e6030b67daa940d50f4ec8e20 Mon Sep 17 00:00:00 2001 From: Szymon Nowakowski Date: Thu, 27 Nov 2025 19:05:41 +0100 Subject: [PATCH] Alpha discard, adjust lights for no reason --- assets/shaders/main.frag | 4 ++++ src/Game.zig | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/assets/shaders/main.frag b/assets/shaders/main.frag index ebaf365..800e554 100644 --- a/assets/shaders/main.frag +++ b/assets/shaders/main.frag @@ -85,6 +85,10 @@ vec4 texture2DAA(texture2D tex, vec2 texCoord) { void main() { vec4 baseColorTexel = texture2DAA(_Textures[uint(MATERIAL.baseColorTexture)], var.texCoord); + if (baseColorTexel.a < 0.5) { + discard; + } + vec4 occlusionRoughnessMetallicTexel = texture2DAA(_Textures[uint(MATERIAL.occlusionRoughnessMetallicTexture)], var.texCoord); vec4 normalTexel = texture2DAA(_Textures[uint(MATERIAL.normalTexture)], var.texCoord); vec4 emissiveTexel = texture2DAA(_Textures[uint(MATERIAL.emissiveTexture)], var.texCoord); diff --git a/src/Game.zig b/src/Game.zig index d152248..40be509 100644 --- a/src/Game.zig +++ b/src/Game.zig @@ -602,24 +602,24 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain const point_lights_data: []const PointLight = &.{ .{ - .positionWS = .{ 0, 0, 1 }, - .color = .{ 10, 10, 10 }, + .positionWS = .{ 0, 0, 0.5 }, + .color = .{ 1, 1, 1 }, }, .{ - .positionWS = .{ -7, 7, 1 }, - .color = .{ 5, 0, 0 }, + .positionWS = .{ -5, 5, 0.5 }, + .color = .{ 1, 0, 0 }, }, .{ - .positionWS = .{ 7, 7, 1 }, - .color = .{ 0, 0, 5 }, + .positionWS = .{ 5, 5, 0.5 }, + .color = .{ 0, 0, 1 }, }, .{ - .positionWS = .{ -7, -7, 1 }, - .color = .{ 0, 5, 0 }, + .positionWS = .{ -5, -5, 0.5 }, + .color = .{ 0, 1, 0 }, }, .{ - .positionWS = .{ 7, -7, 1 }, - .color = .{ 5, 5, 0 }, + .positionWS = .{ 5, -5, 0.5 }, + .color = .{ 1, 1, 0 }, }, }; try point_lights.write(engine, .{ @@ -630,7 +630,7 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain const directional_lights_data: []const DirectionalLight = &.{ .{ .directionWS = .{ 0, 0, -1 }, - .color = .{ 0.2, 0.2, 0.2 }, + .color = .{ 0.3, 0.3, 0.3 }, }, }; try directional_lights.write(engine, .{ @@ -756,7 +756,7 @@ pub fn update(self: *Game, dt: f32) void { ); // zig fmt: on - const ambient_light = Vector3.init(0.1, 0.1, 0.1); + const ambient_light = Vector3.init(0.2, 0.2, 0.2); const global_uniforms_data: GlobalUniforms = .{ .matrixWStoVS = matrix_ws_to_vs.asArray(),