When an object that has pixels with any opacity at the edge of its surface and a displacement map applied, those pixels will, after being displaced, continue to be drawn to the edge of the original boundary of the icon.
Numbered Steps to Reproduce Problem:
1. Take icon with opaque pixels on its edge
2. Give it a displacement map filter with a render target
Here's a picture demonstrating the issue at hand:
The green square is the displacement map (all pixels are #0f0f). The white circle and square on the right are the icons without the displacement map applied and the left is them with the map applied. The circle touches the edge of its canvas while the square does not.
Code Snippet (if applicable) to Reproduce Problem:
/obj/screen/displacement_map
screen_loc = "1,1"
/mob
var/obj/screen/displacement_map/dis_map
var/dis_filter
/mob/Login()
..()
dis_map = new()
dis_map.render_target = dis_map.name = "displacement"
dis_filter = filter(type = "displace", render_source = dis_map.render_target, size = 16)
client.screen += dis_map
/mob/verb/displacement_test()
var/obj/testing/test_obj = new(locate(x, y-2, z))
// test_obj.icon_state = "border_inverse"
test_obj.filters += dis_filter
var/obj/testing/test_obj_nofilter = new(locate(x+2, y-2, z))
test_obj_nofilter.icon_state = test_obj.icon_state
var/obj/testing/test_obj2 = new(locate(x, y+2, z))
// test_obj2.icon_state = "circle"
test_obj2.filters += dis_filter
var/obj/testing/test_obj2_nofilter = new(locate(x+2, y+2, z))
test_obj2_nofilter.icon_state = test_obj2.icon_state
Expected Results:
Edge pixels are displaced
Actual Results:
Edge pixels are displaced and then redrawn to the edge
Does the problem occur:
Every time? Or how often?
Yes