Skip to content

Commit f073052

Browse files
committed
dither fix
1 parent e6baaf4 commit f073052

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

init.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ local function get_raw_albedo(column,row)
238238
return albedo:byte(1 + row * albedo_width + column)
239239
end
240240

241-
local function get_interpolated_albedo(longitude,latitude)
241+
local function get_interpolated_block(longitude,latitude)
242242
local row = (half_pi - latitude) * albedo_radians_to_pixels
243243
if longitude < 0 then longitude = longitude + 2 * math.pi end
244244
local column = longitude * albedo_radians_to_pixels
@@ -253,11 +253,9 @@ local function get_interpolated_albedo(longitude,latitude)
253253
local v0 = v00 * (1-dcolumn) + v10 * dcolumn
254254
local v1 = v01 * (1-dcolumn) + v11 * dcolumn
255255
local albedo = v0 * (1-drow) + v1 * drow
256-
return albedo * 58 / 255
256+
return moonstone[math.floor(albedo * 58 / 255+math.random())]
257257
end
258258

259-
260-
261259
local equaldistance
262260

263261
local orthographic = {
@@ -348,7 +346,7 @@ local orthographic = {
348346
local f = math.floor(height_by_longitude_latitude(longitude, latitude) + offset)
349347
local block
350348
if albedo then
351-
block = moonstone[math.floor(get_interpolated_albedo(longitude,latitude)+math.random())]
349+
block = get_interpolated_block(longitude,latitude)
352350
else
353351
block = stone
354352
end
@@ -467,7 +465,7 @@ local sphere = {
467465

468466
if r <= inner_radius_nodes + height_by_longitude_latitude(longitude, latitude) then
469467
if albedo then
470-
return moonstone[get_interpolated_albedo(longitude,latitude)]
468+
return get_interpolated_block(longitude,latitude)
471469
else
472470
return stone
473471
end

0 commit comments

Comments
 (0)