It is about time that we announce another community challenge! This time we’d like to challenge you to create some cool looking post-processing effects. Post-processing effects can be used to control the overall look and feel of the game by rendering the game world and applying various effects in sequence to produce the final result.
Share your post-processing effects here (must be open source) and in January we’ll pick three projects and award the authors with Steam Gift Cards.
In Defold the default render script will draw all components (sprites, tilemaps, particle effects etc) directly to the screen by copying the pixels from the atlas/tilesource texture to the screen using the default materials. From the default render script:
When applying post-processing effects an additional step is introduced where the components are first drawn to an off-screen buffer (a render target) before drawing the entire off-screen buffer to the screen using a mesh (quad) which covers the screen and a custom material which applies the post-processing effect. Example:
-- step 1: render sprites, tilemaps, particle effects etc to a render target named 'my_render_target'
render.set_render_target(my_render_target)
render.enable_state(graphics.STATE_BLEND)
render.draw(predicates.tile, camera_world.frustum)
render.draw(predicates.particle, camera_world.frustum)
render.disable_state(graphics.STATE_DEPTH_TEST)
render.set_render_target(render.RENDER_TARGET_DEFAULT)
-- step 2: render 'my_render_target' using 'my_material' to a model quad with a material with tag 'my_predicate'
render.enable_texture(0, my_render_target, graphics.BUFFER_TYPE_COLOR0_BIT)
render.enable_material(my_material)
render.draw(my_predicate)
render.disable_material()
render.disable_texture0)
Tutorials and sample projects
Here’s a collection of tutorials and sample projects to get you started:
I would love if this would be extended a bit, because I was very busy lately and there were also Holidays, which instead of ensuring some more time postponed everything I am preparing few shaders and maybe few other people have the same as me?
I had half forgotten this at times. Could have used a pin job.
I didn’t have any good ideas nor much time but I did manage to make something and more or less learned how post-processing and render targets work along way. This was very helpful: Mastering Render Targets.
After figuring out how to use Lumiere (very nice btw). I ported this cool rain thing from shadertoy to work with it.
Thanks for these examples.
The defold-pixelart-shader-example contains a model called character,
Which is a gltf file with multi materials.
In the demo above, all the colours are visible on the model (on the bridge).
Only the first colour works for me; otherwise everything works nicely and looks the same as the demo.
I am running Ubuntu 22.
Any idea what might fix this for me?
The only change I had to make was to remove the App Manifest from game.project
Do I need this to make multi mats work?
With it included Defold crashes (1.9.6 and 1.9.7 beta) . The beta gives an error message:
graphics_vulkan_surface.cpp:(.text+0xa): undefined reference to `dmPlatform::VulkanCreateWindowSurface(VkInstance_T*, dmPlatform::dmWindow*, VkSurfaceKHR_T**)'
...
I have no idea how to fix this error or where to go to get info on it:-)
Thanks.
The app manifest file is used to set the graphics backend to Vulkan. However, I’m not sure if Vulkan is supported on Linux by Defold. If it is supported, you might need to install Vulkan drivers or simply update the drivers.
Perhaps @jhonny.goransson can provide more insight on this.
You can simply change the graphics backend in the app manifest file from Vulkan to OpenGL.
It should work with both OpenGL and Vulkan; it shouldn’t matter. I don’t know why, but it stopped working for me as well. I’m going to look into it—this might be related to the latest Defold update.
You might have an old driver. I recommend updating the driver.
Additionally, you can change the OpenGL version in the game.project file. If this is not going to help you can report the issue from Help->Report Issue