diff --git a/assets/materials/static.skm.yaml b/assets/materials/static.skm.yaml index 6029bd5..e796985 100644 --- a/assets/materials/static.skm.yaml +++ b/assets/materials/static.skm.yaml @@ -16,6 +16,16 @@ materials: twoTone: true gSPGeometryMode: clear: [G_LIGHTING] + + gDPSetCycleType: G_CYC_2CYCLE + gDPSetCombineMode: + - color: [PRIMITIVE, "ENVIRONMENT", TEXEL0, "ENVIRONMENT"] + alpha: ["0", "0", "0", "1"] + - color: ["COMBINED", "0", "SHADE", "0"] + alpha: ["0", "0", "0", "1"] + gDPSetRenderMode: + - G_RM_PASS + - G_RM_ZB_OPA_SURF properties: tileSizeS: 1 diff --git a/assets/test_chambers/test_chamber_00/test_chamber_00.blend b/assets/test_chambers/test_chamber_00/test_chamber_00.blend index a06f6bb..5a452da 100644 Binary files a/assets/test_chambers/test_chamber_00/test_chamber_00.blend and b/assets/test_chambers/test_chamber_00/test_chamber_00.blend differ diff --git a/skelatool64/lua/sk_math.lua b/skelatool64/lua/sk_math.lua index d1c9254..294b297 100644 --- a/skelatool64/lua/sk_math.lua +++ b/skelatool64/lua/sk_math.lua @@ -531,6 +531,10 @@ function Color4.__mul(a, b) return color4(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a) end +function Color4.__tostring(v) + return 'color4(' .. v.r .. ', ' .. v.g .. ', ' .. v.b .. ', ' .. v.a .. ')' +end + --- Linearly interpolates between two points --- @function lerp --- @tparam Color4 b diff --git a/tools/level_scripts/static_export.lua b/tools/level_scripts/static_export.lua index 00a4b8b..7944643 100644 --- a/tools/level_scripts/static_export.lua +++ b/tools/level_scripts/static_export.lua @@ -33,7 +33,7 @@ local function proccessStaticNodes(nodes) if chunkV.material.properties.staticLit == "true" then for index, pos in pairs(chunkV.mesh.vertices) do - -- chunkV.mesh.colors[index] = static_lighting.light_vertex(pos, chunkV.mesh.normals[index]) + chunkV.mesh.colors[1][index] = static_lighting.light_vertex(pos, chunkV.mesh.normals[index]) end end diff --git a/tools/level_scripts/static_lighting.lua b/tools/level_scripts/static_lighting.lua index 83e6540..e6f5185 100644 --- a/tools/level_scripts/static_lighting.lua +++ b/tools/level_scripts/static_lighting.lua @@ -46,7 +46,7 @@ local function build_ambient_block(ambient_mesh) end local function evaluate_ambient_block(block, pos, normal) - local lerp_values = block.bb:unlerp(pos) + local lerp_values = block.bb:unlerp(pos):min(sk_math.vector3(1, 1, 1)):max(sk_math.vector3(0, 0, 0)) local x0 = block.colors[1]:lerp(block.colors[2], lerp_values.x) local x1 = block.colors[3]:lerp(block.colors[4], lerp_values.x) @@ -98,6 +98,10 @@ local function find_nearest_ambient_boxes(pos, max_count) end end + if #distances == 1 then + return boxes, {1} + end + local weights = {} local total_weight = 0