I’ve been noticing camera jitter whenever the player moves. I’m using the orthographic camera asset here but this issue happens with everything using the camera component. I’ve been trying to figure out how to get pixel perfect rendering in Defold, and this is my first hurdle.
Since It seems video doesnt display it well, here is the project. I’ve been trying to follow this in the manual: Adapting graphics to different screen sizes
rendering-testing.zip (30.8 KB)
The jitter appears because you have disabled subpixels in your game project settings.
Your player gets rendered on even pixels (like 1,2,3) however his actual position seems to be something like ~1.51, 2.34, 3.14, etc.
You need to round down/round up the positions to full numbers. Something like:
if vmath.length_sqr(dir) > 0 then
local p = go.get_position()
local distance_x = p.x + dir.x * speed * dt
local distance_y = p.y + dir.y * speed * dt
if dir.x > 0 then
p.x = math.ceil(distance_x)
else
p.x = math.floor(distance_x)
end
if dir.y > 0 then
p.y = math.ceil(distance_y)
else
p.y = math.floor(distance_y)
end
go.set_position(p)
end
1 Like