diff --git a/scripts/cube_logic.lua b/scripts/cube_logic.lua index 0873815..1cfe8f2 100644 --- a/scripts/cube_logic.lua +++ b/scripts/cube_logic.lua @@ -576,9 +576,9 @@ local function create_room_objects() local wall_outer_edge = wall_offset + room.wall_thickness log_debug("Room walls: inner=%.2f outer=%.2f", wall_inner_edge, wall_outer_edge) - local floor_color = {0.08, 0.26, 0.55} - local wall_color = {0.78, 0.38, 0.18} - local ceiling_color = {0.72, 0.9, 0.96} + local floor_color = {0.18, 0.45, 0.25} + local wall_color = {0.75, 0.35, 0.2} + local ceiling_color = {0.85, 0.85, 0.76} local objects = { create_static_cube({0.0, floor_center_y, 0.0}, diff --git a/shaders/ceiling.frag b/shaders/ceiling.frag index d4a62b9..0a3d455 100644 --- a/shaders/ceiling.frag +++ b/shaders/ceiling.frag @@ -4,6 +4,12 @@ layout(location = 0) in vec3 fragColor; layout(location = 1) in vec3 fragWorldPos; layout(location = 0) out vec4 outColor; +float hash(vec2 p) { + return fract(sin(dot(p, vec2(63.1, 157.9))) * 43758.5453123); +} + +const vec3 SURFACE_TINT = vec3(0.9, 0.93, 0.8); + const vec3 LIGHT_POSITIONS[8] = vec3[8]( vec3(13.0, 4.5, 13.0), vec3(-13.0, 4.5, 13.0), @@ -27,7 +33,14 @@ float calculateAttenuation(float distance) { } void main() { - vec3 baseColor = clamp(fragColor * 1.15, 0.0, 1.0); + vec3 baseColor = clamp(fragColor * 1.15 * SURFACE_TINT, 0.0, 1.0); + vec2 gridUv = fragWorldPos.xz * 0.45; + vec2 grid = abs(fract(gridUv) - 0.5); + float gridLine = step(0.48, max(grid.x, grid.y)); + float speckle = hash(floor(fragWorldPos.xz * 3.0)); + baseColor *= mix(0.94, 1.04, speckle); + baseColor *= mix(1.0, 0.84, gridLine); + vec3 ambient = AMBIENT_STRENGTH * baseColor; vec3 lighting = vec3(0.0); diff --git a/shaders/ceiling.frag.spv b/shaders/ceiling.frag.spv index 650caec..83c0165 100644 Binary files a/shaders/ceiling.frag.spv and b/shaders/ceiling.frag.spv differ diff --git a/shaders/floor.frag b/shaders/floor.frag index ad568f1..38adb52 100644 --- a/shaders/floor.frag +++ b/shaders/floor.frag @@ -4,6 +4,12 @@ layout(location = 0) in vec3 fragColor; layout(location = 1) in vec3 fragWorldPos; layout(location = 0) out vec4 outColor; +float hash(vec2 p) { + return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453123); +} + +const vec3 SURFACE_TINT = vec3(0.35, 0.6, 0.35); + const vec3 LIGHT_POSITIONS[8] = vec3[8]( vec3(13.0, 4.5, 13.0), vec3(-13.0, 4.5, 13.0), @@ -27,7 +33,15 @@ float calculateAttenuation(float distance) { } void main() { - vec3 baseColor = clamp(fragColor * 1.1, 0.0, 1.0); + vec3 baseColor = clamp(fragColor * 1.1 * SURFACE_TINT, 0.0, 1.0); + float checkerScale = 0.55; + float cx = step(0.5, fract(fragWorldPos.x * checkerScale)); + float cz = step(0.5, fract(fragWorldPos.z * checkerScale)); + float checker = abs(cx - cz); + float grit = hash(floor(fragWorldPos.xz * 2.2)); + float pattern = mix(0.82, 1.08, checker) * mix(0.96, 1.04, grit); + baseColor *= pattern; + vec3 ambient = AMBIENT_STRENGTH * baseColor; vec3 lighting = vec3(0.0); diff --git a/shaders/floor.frag.spv b/shaders/floor.frag.spv index 464d0b0..40d4e62 100644 Binary files a/shaders/floor.frag.spv and b/shaders/floor.frag.spv differ diff --git a/shaders/wall.frag b/shaders/wall.frag index 71c2b9f..782bc23 100644 --- a/shaders/wall.frag +++ b/shaders/wall.frag @@ -4,6 +4,12 @@ layout(location = 0) in vec3 fragColor; layout(location = 1) in vec3 fragWorldPos; layout(location = 0) out vec4 outColor; +float hash(vec2 p) { + return fract(sin(dot(p, vec2(91.7, 127.3))) * 43758.5453123); +} + +const vec3 SURFACE_TINT = vec3(0.9, 0.55, 0.3); + const vec3 LIGHT_POSITIONS[8] = vec3[8]( vec3(13.0, 4.5, 13.0), vec3(-13.0, 4.5, 13.0), @@ -27,7 +33,16 @@ float calculateAttenuation(float distance) { } void main() { - vec3 baseColor = clamp(fragColor * 1.05, 0.0, 1.0); + vec3 baseColor = clamp(fragColor * 1.05 * SURFACE_TINT, 0.0, 1.0); + float axisSelector = step(abs(fragWorldPos.z), abs(fragWorldPos.x)); + float coord = mix(fragWorldPos.z, fragWorldPos.x, axisSelector); + float plankScale = 0.4; + float plank = abs(fract(coord * plankScale) - 0.5); + float groove = smoothstep(0.46, 0.5, plank); + float grain = hash(floor(vec2(coord * 1.2, fragWorldPos.y * 2.0))); + baseColor *= mix(0.92, 1.05, grain); + baseColor *= mix(1.0, 0.78, groove); + vec3 ambient = AMBIENT_STRENGTH * baseColor; vec3 lighting = vec3(0.0); diff --git a/shaders/wall.frag.spv b/shaders/wall.frag.spv index 1ecb352..462ff51 100644 Binary files a/shaders/wall.frag.spv and b/shaders/wall.frag.spv differ