Hello
I'm trying to write a GLSL shader for Dolphin that simply downscales the raster to a resolution of my choosing, eg. 854x480, 1280x720, 1920x1080 etc. The raster should not change in size though, i.e no black borders around the sides, and no cropping of the image.
I tried using DolphinFX's BicubicScaler function, but it gives compilation errors. I managed to get it to compile after fixing some bad cast but the output was all black pixels like 0.0, 0.0, 0.0 I think.
Then I saw this GLSL code sample for bicubic scaling: https://stackoverflow.com/questions/1350...de-in-glsl
But I'm a bit lost - I'm not even sure what I'm supposed to be doing in terms of the logic of how I should be "sampling" pixel values to get my final downscaled output pixels. I've never written a scaling shader before so I don't really know what I'm doing here.
I can see that the shader gets applied to every pixel (like a "for each pixel, do this..."). If that is true, then should I be doing something like this:
1. calculate the coordinates of the nearest surrounding pixel locations that correspond to my target resolution
2. "sample" from (1) based on current pixel coordinate?
Is there an easier way to do this using GLSL built in functions without having to manually implement bicubic algorithm, like eg. SampleLocation(sample_coords) as in this example: https://forums.dolphin-emu.org/Thread-zo...ent-evil-4
Any help appreciated, thanks
I'm trying to write a GLSL shader for Dolphin that simply downscales the raster to a resolution of my choosing, eg. 854x480, 1280x720, 1920x1080 etc. The raster should not change in size though, i.e no black borders around the sides, and no cropping of the image.
I tried using DolphinFX's BicubicScaler function, but it gives compilation errors. I managed to get it to compile after fixing some bad cast but the output was all black pixels like 0.0, 0.0, 0.0 I think.
Then I saw this GLSL code sample for bicubic scaling: https://stackoverflow.com/questions/1350...de-in-glsl
But I'm a bit lost - I'm not even sure what I'm supposed to be doing in terms of the logic of how I should be "sampling" pixel values to get my final downscaled output pixels. I've never written a scaling shader before so I don't really know what I'm doing here.
I can see that the shader gets applied to every pixel (like a "for each pixel, do this..."). If that is true, then should I be doing something like this:
1. calculate the coordinates of the nearest surrounding pixel locations that correspond to my target resolution
2. "sample" from (1) based on current pixel coordinate?
Is there an easier way to do this using GLSL built in functions without having to manually implement bicubic algorithm, like eg. SampleLocation(sample_coords) as in this example: https://forums.dolphin-emu.org/Thread-zo...ent-evil-4
Any help appreciated, thanks