Gamma correction and add missing light intensity
This commit is contained in:
parent
70ff9c17b5
commit
6e46c54e6e
@ -38,8 +38,12 @@ void main() {
|
||||
|
||||
float ndotl = max(dot(L, normal), 0);
|
||||
|
||||
finalColor += ndotl * lights[i].color.xyz * att * diffuseColor;
|
||||
finalColor += ndotl * lights[i].color.w * lights[i].color.xyz * att * diffuseColor;
|
||||
|
||||
}
|
||||
|
||||
FragColor = vec4(finalColor, 1.0f);
|
||||
|
||||
float gamma = 2.2;
|
||||
FragColor.rgb = pow(FragColor.rgb, vec3(1.0/gamma));
|
||||
}
|
||||
|
@ -419,7 +419,7 @@ export fn game_init(global_allocator: *std.mem.Allocator) void {
|
||||
_ = g_mem.world.addEntity(.{
|
||||
.transform = .{ .pos = Vec3.new(1, 1, 0) },
|
||||
.flags = .{ .point_light = true, .rotate = true },
|
||||
.point_light = .{ .color_intensity = Vec4.new(1.0, 0.5, 0.2, 1.0), .radius = 1 },
|
||||
.point_light = .{ .color_intensity = Vec4.new(1.0, 0.3, 0.1, 100.0), .radius = 0.1 },
|
||||
.rotate = .{ .axis = Vec3.up(), .rate = 60 },
|
||||
});
|
||||
|
||||
@ -427,10 +427,10 @@ export fn game_init(global_allocator: *std.mem.Allocator) void {
|
||||
.transform = .{ .pos = Vec3.new(-1, 1, 0) },
|
||||
.flags = .{ .point_light = true, .rotate = true },
|
||||
.point_light = .{
|
||||
.color_intensity = Vec4.new(0.2, 0.5, 1.0, 1.0),
|
||||
.radius = 1,
|
||||
.color_intensity = Vec4.new(0.2, 0.5, 1.0, 100.0),
|
||||
.radius = 0.1,
|
||||
},
|
||||
.rotate = .{ .axis = Vec3.up(), .rate = -60 },
|
||||
.rotate = .{ .axis = Vec3.up(), .rate = -20 },
|
||||
});
|
||||
|
||||
// Plane
|
||||
|
Loading…
x
Reference in New Issue
Block a user