How to post process? (SOLVED)

Hi guys.
I’m trying to make a simple color manipulation post fx.
I have read the docs and searched for post processing examples here on the forum and in the defold-examples repository but I can’t understand how to use my shader and draw the results to the screen.
What are the steps to achieve this in the render script and wich data it will expect from the .material file?
Here’s what I understood so far.

...
render.enable_render_target(self.my_render_target)
render.draw(self.my_pred)
render.disable_render_target(self.my_render_target)
render.enable_texture(0, self.my_render_target, render.BUFFER_COLOR_BIT)
...

I managed to make it work. I did not realize before that the material can only be applied to an object, instead of applying to the screen itself.

    render.enable_render_target(self.my_render_target)
    render.clear({[render.BUFFER_COLOR_BIT] = self.clear_color, [render.BUFFER_DEPTH_BIT] = 1, [render.BUFFER_STENCIL_BIT] = 0})
    render.draw(self.tile_pred)
    render.disable_render_target(self.my_render_target)

    render.enable_material("mat")
    render.enable_texture(0, self.my_render_target, render.BUFFER_COLOR_BIT)
    render.draw(self.quad_pred)
    render.disable_texture(0, self.my_render_target, render.BUFFER_COLOR_BIT)
    render.disable_material("mat")
3 Likes