ID:2783058
 
(See the best response by Lummox JR.)
Code:
/*
These are simple defaults for your project.
*/


world
fps = 25 // 25 frames per second
icon_size = 32 // 32x32 icon size by default

view = 6 // show up to 6 tiles outward from center (13x13 view)


// Make objects move 8 pixels per tick when walking


#define SPECIAL_RENDER_ID "plane_master"
#define MOB_PLANE 50
#define OBJ_PLANE 40
#define WATER_PLANE 30
#define GROUND_PLANE 20
#define NULL_PLANE 10

mob
step_size = 8
icon = 'icons.dmi'
icon_state = "mob"
color = "red"
plane = MOB_PLANE

/mob/Login()
. = ..()
color = "blue"
//Create the plane master
var/obj/PM = new(src)
PM.render_target = SPECIAL_RENDER_ID
PM.appearance_flags = PLANE_MASTER
PM.plane = WATER_PLANE
PM.blend_mode = BLEND_OVERLAY
PM.icon = null
PM.screen_loc = "CENTER"
PM.filters += filter(type="outline", size=2) //This confirms that the plane master is working.
client.screen += PM



/mob/New(loc)
. = ..()
//Create the mask
var/obj/mask = new(src)
mask.vis_flags = VIS_INHERIT_PLANE | VIS_INHERIT_LAYER
mask.appearance_flags = RESET_COLOR
mask.icon_state = "mask"
mask.filters += filter(type="blur", size=1) //This confirms that filters are working for the mask.
mask.filters += filter(type="alpha", x=0, y=0, render_source=SPECIAL_RENDER_ID) //For some reason this does not work.
src.vis_contents += mask //Add the mask to the mob's vis_contents.


//This confirms that the render target is working.
var/obj/map_hud = new(src)
map_hud.render_source = "plane_master"
map_hud.transform *= 1/world.maxx
map_hud.appearance_flags = RESET_COLOR
map_hud.pixel_x = 32
map_hud.pixel_y = 32
src.vis_contents += map_hud

/turf/
plane = NULL_PLANE

/turf/ground
icon = 'icons.dmi'
icon_state = "turf"
plane = GROUND_PLANE

/turf/special
icon = 'icons.dmi'
icon_state = "water"
plane = WATER_PLANE

/obj/
step_size = 8
icon = 'icons.dmi'
icon_state = "obj"
plane = OBJ_PLANE
density = 0


Problem description:

https://i.imgur.com/akLdsJC.png

I'm trying to make a test case for alpha filters having a strange effect when used with plane masters, however I can't even get the test case to work.

The intentional effect is that the white ground effect below mobs (the lowercase Is) is only supposed to be shown when inside the water (/turf/special), but for some reason it shows on ALL turfs (/turf/, /turf/ground), even though it is not supposed to.

Any ideas what I'm doing wrong?

Best response
You can't currently use a plane master as an alpha mask for something that isn't itself a plane master. That's probably why you're having a problem.

The way to handle this would be for the ground effect to be on a different plane than the mob, rather than using VIS_INHERIT_PLANE, and give that plane a plane master of its own. That plane master can then use the water plane as a mask.
Thank you for the help. This has saved me a headache.

Is there any plans for the future to change that? The thing that I was working on is depth effects for water, as seen below.

https://i.imgur.com/R6k4K8o.png

With it being limited to plane masters, it is not possible to trim the mask so it doesn't affect other mobs.