Hi Hyllian and the libretro community,
As this is my first time posting/replying here, if there is anything that I did wrong, please let me know.
Firstly, thank you Hyllian for sharing the this shader. While I don’t use retroarch, I learned about your work while trying to do some post-processing for my own game. Out of all the crt shader that has bezel reflection (I looked at the Mega Bezel, kokoaio), yours was the easiest to understand and easiest to implement in my OpenGL engine.
For the most part, I was able to apply this in the game; however, there’s one part of the ‘uborder-reflections.slang’ shader that I don’t seem to understand fully. So it would be great if you could explain some of the details here:
The reflection for the horizontal and vertical direction is symmetric, so I will just quote a block from the horizontal bezel reflection:
if((abs(uv.x-0.5) >= (0.5*c_frame.x) && abs(uv.x-0.5) <= (0.5*c_frame.x+bezel_w)) && abs(uv.y-0.5) <= (0.5*c_frame.y+bezel_h))
{
uv.x = (uv.x >= 0.50) ? 1.0 + c_frame.x - uv.x + reflection_scr_distance_x : 1.0 - c_frame.x - uv.x - reflection_scr_distance_x;
reflex.rgb = mix(texture(BlurPass, uv + vec2(bezel_center_x, bezel_center_y)).rgb, vec3(0.0, 1.0, 0.0), params.AdjustView);
**reflex.rgb = mix(reflex.rgb, frame.rgb, frame.a);**
reflex.rgb *= (1.0-smoothstep(0.5*c_frame.y-0.1, 0.5*c_frame.y, abs(uv.y-0.5)));
border.rgb = clamp(border.rgb + reflection_strength*reflex.rgb, 0.0, 1.0);
}
The bolded part is what I’m confused over. From the images you showcased (and please correct me if I’m wrong), I suppose that the blurred color that is reflected on the bezel is mirror and curved from the main game framebuffer, right? And it seems like the bolded part is not reflecting the main game framebuffer when I was using it.
TLDR:
If possible, could you explain where and how in the shader you reflected the main game image on the bezel? I do know that this line uv.x = (uv.x >= 0.50) ? 1.0 + c_frame.x - uv.x + reflection_scr_distance_x : 1.0 - c_frame.x - uv.x - reflection_scr_distance_x;
is x-flipping the uv, but it seems to me that this new uv is only applied for the blurred texture, not the main game framebuffer.
Again, thank you, Hyllian, for open-sourcing your work. Attached is a the ported shader that I did.
I’m sorry if I didn’t get the point across clearly, as English is not my native language.