ID:2518566
 
Resolved
The displacement map filter used the wrong texture sampler, so it misbehaved for icons whose pixels touched the edge of the icon.
BYOND Version:513.1491
Operating System:Windows 7 Home Premium 64-bit
Web Browser:Chrome 77.0.3865.90
Applies to:Dream Seeker
Status: Resolved (513.1493)

This issue has been resolved.
Descriptive Problem Summary:
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
You wouldn't happen to have the test project for this handy, would you? It would save me a lot of time when I'm investigating the cause.
👍
Lummox JR resolved issue with message:
The displacement map filter used the wrong texture sampler, so it misbehaved for icons whose pixels touched the edge of the icon.