Closed avahe-kellenberger closed 1 year ago
Ping @grimfang4 if you have any insight, I'd really like to get this working.
Nice effect!
The simplest way to think of post-processing with SDL_gpu is to insert a render stage. Instead of rendering to the screen, create a "fake screen" render texture with the same dimensions. Use this everywhere you would normally draw to the screen. Then at the end of each frame, you activate your post-processing shader and render this fake screen onto the real one.
Thanks, that seems to work just fine!
I'm porting a game I've made with Godot over to use sdl-gpu and have successfully converted some shaders, but I'm unsure how do a post-processing shader.
The setup:
GPU_DeactivateShaderProgram
GPU_DeactivateShaderProgram
Part of the problem is, Godot has a variable provided to their shaders called
SCREEN_TEXTURE
, which I'm not sure how to use with sdl-gpu.I've attempted to recreate this by using
GPU_SetShaderImage
, and providing a copy of the currentGPU_Target
(usingGPU_CopyImageFromTarget
). This resulted in every draw call rendering the entire screen, scaled to the size of other image draws, etc.The shader I'm trying to translate is very small and simple:
If you can point in me the right direction, I'd appreciate it. I've been trying to figure this out for a while and haven't been making much progress.
Here's an example of what it looks like in Godot: shockwave.webm