Alpha discard, adjust lights for no reason

This commit is contained in:
2025-11-27 19:05:41 +01:00
parent 0747e5e880
commit 9d60be86ab
2 changed files with 16 additions and 12 deletions

View File

@@ -85,6 +85,10 @@ vec4 texture2DAA(texture2D tex, vec2 texCoord) {
void main() { void main() {
vec4 baseColorTexel = texture2DAA(_Textures[uint(MATERIAL.baseColorTexture)], var.texCoord); 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 occlusionRoughnessMetallicTexel = texture2DAA(_Textures[uint(MATERIAL.occlusionRoughnessMetallicTexture)], var.texCoord);
vec4 normalTexel = texture2DAA(_Textures[uint(MATERIAL.normalTexture)], var.texCoord); vec4 normalTexel = texture2DAA(_Textures[uint(MATERIAL.normalTexture)], var.texCoord);
vec4 emissiveTexel = texture2DAA(_Textures[uint(MATERIAL.emissiveTexture)], var.texCoord); vec4 emissiveTexel = texture2DAA(_Textures[uint(MATERIAL.emissiveTexture)], var.texCoord);

View File

@@ -602,24 +602,24 @@ pub fn init(allocator: std.mem.Allocator, engine: *Engine, swapchain: *Swapchain
const point_lights_data: []const PointLight = &.{ const point_lights_data: []const PointLight = &.{
.{ .{
.positionWS = .{ 0, 0, 1 }, .positionWS = .{ 0, 0, 0.5 },
.color = .{ 10, 10, 10 }, .color = .{ 1, 1, 1 },
}, },
.{ .{
.positionWS = .{ -7, 7, 1 }, .positionWS = .{ -5, 5, 0.5 },
.color = .{ 5, 0, 0 }, .color = .{ 1, 0, 0 },
}, },
.{ .{
.positionWS = .{ 7, 7, 1 }, .positionWS = .{ 5, 5, 0.5 },
.color = .{ 0, 0, 5 }, .color = .{ 0, 0, 1 },
}, },
.{ .{
.positionWS = .{ -7, -7, 1 }, .positionWS = .{ -5, -5, 0.5 },
.color = .{ 0, 5, 0 }, .color = .{ 0, 1, 0 },
}, },
.{ .{
.positionWS = .{ 7, -7, 1 }, .positionWS = .{ 5, -5, 0.5 },
.color = .{ 5, 5, 0 }, .color = .{ 1, 1, 0 },
}, },
}; };
try point_lights.write(engine, .{ 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 = &.{ const directional_lights_data: []const DirectionalLight = &.{
.{ .{
.directionWS = .{ 0, 0, -1 }, .directionWS = .{ 0, 0, -1 },
.color = .{ 0.2, 0.2, 0.2 }, .color = .{ 0.3, 0.3, 0.3 },
}, },
}; };
try directional_lights.write(engine, .{ try directional_lights.write(engine, .{
@@ -756,7 +756,7 @@ pub fn update(self: *Game, dt: f32) void {
); );
// zig fmt: on // 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 = .{ const global_uniforms_data: GlobalUniforms = .{
.matrixWStoVS = matrix_ws_to_vs.asArray(), .matrixWStoVS = matrix_ws_to_vs.asArray(),