Difference between Filter and Shader?


#1

I’ve seen that there are two ways to apply a shader to a h2d.Object. Which are the major differences between these two cases?

class MyShader extends hxsl.Shader {}
class MyFilter extends h3d.shader.ScreenShader {}

spr.addShader(new MyShader());
spr.filter = new h2d.filter.Shader(new MyFilter());

#2

From what I’ve seen Filters are also shaders but apply to the display tree, so can be used to create screen effects.


#3

Shader effects are drawn without using additional render textures (single pass rendering).
And filter effects use additional render textures (multiple render passes), so they allows you to have more complex effects but they have more effect on game’s performance and memory.


#4

It’s good to know, thank you both! :+1: