libretro / common-shaders

Collection of commonly used Cg shaders. These shaders are usable by either HLSL and/or Cg runtime compilers. The cg2glsl script will translate most of these into GLSL shaders.
http://www.libretro.com
1.03k stars 250 forks source link

"super-4xbr-3d" Possible to remove 3d mask? #113

Open Mickevincent opened 6 years ago

Mickevincent commented 6 years ago

I am experimenting some with different shaders, and I am wondering if anyone can help to remove the 3d mask on -

super-4xbr-3d-pass0 super-4xbr-3d-pass1 super-4xbr-3d-pass2 super-4xbr-3d-pass3

If it is possible to just open these with a text document and just remove some code line to make them filter everything. I really need this to be done on these certain xbr filters, so if anyone could help me I would be very glad!

I should add that the reason I want super-4xbr is because it's the only xbr filter I can get to work nice with 4x gpu resolution.

OR if anyone can tell me why super-xbr-6p wont work with 4x gpu resolution but only with native. If it is easier to make that work instead?

I also wonder if it is possible to use texture filtering at higher than native gpu resolution without it screwing up pre-rendered backgrounds?

hizzlekizzle commented 6 years ago

The way xBR works is by looking around a pixel at its neighbors to find patterns that it recognizes as lines, curves and corners. It can't do that without knowing how far away a given pixel is from its neighbors, and having 2 different pixel sizes (that is, some are 4x larger than others) breaks that.

Have you tried using the texture filtering core options combined with (non-3D) xBR shaders?

Mickevincent commented 6 years ago

Texture filtering on pre - rendered games gives me wierd lines if I run at higher than native resolution, no matter what.

But I am just wondering if it is possible to make "super-4xbr-3d" filter everything. It looks awesome at the backgrounds in RE / FF but since I cannot use texture filtering the models and for example battles in Final Fantasy looks horrible.

I discovered that when I run in native resolution then "super-xbr-6p" do filter EVERYTHING. But "super-xbr-6p" wont work when I run in 2x, 4x or 8x native :( Why is that?!

So that would also be a solution for me, making "super-xbr-6p" work with 4x gpu resolution.

Here is an example. http://imgur.com/UXvHQY4 You can see under Vivi that he is not effected by xbr filtering, yet the arrow pointing at him is. All I want is xbr to always filter everything.

hizzlekizzle commented 6 years ago

My previous reply explains why the non-3D versions don't work with increased internal res. The 3D versions are designed to compensate for the additional scale when looking for neighbors, but it's not going to see high-resolution 3D elements.

Mickevincent commented 6 years ago

Ok, well thats a bummer. So what about texture filtering messing with the pre rendered backgrounds at higher gpu resolution? Can I do anything about that?

hizzlekizzle commented 6 years ago

I don't know what causes it, unfortunately.

Hyllian commented 6 years ago

If you do this, all 3D elements on screen will be horribly filtered. That's why there's a 3D mask.

When you increase internal resolution, 3D elements are rendered in a new resolution while 2D elements are just upscaled with nearest neighbor. The 3D shaders work by detecting the 3D elements (already in high res) and filtering only 2D elements. The drawback is that the 3D detection isn't perfect, so here and there some artifacts appear.

Mickevincent commented 6 years ago

Thanx Hylian. But I play with 4x internal and with a setup of your super-xbr. However 3d elements like battle scenes is very pixelated since I cannot use texture filtering with 4x internal (pre rendered backgrounds gets messed up). Do you know any way I can play like this with the same quality on 3d elements texture filtered? Is it possible at all in any kind of way? Thanx in advance.

Hyllian commented 6 years ago

You could try the aa shader from guest.

It's at shaders/anti-aliasing/aa-shader-4.o.cgp. It should work well with 2D and 3D elements at the same time. Just adjust the parameter called internal_res accordingly. You can tweak it through preview parameters.

Mickevincent commented 6 years ago

I will try that Hylian. I am back home at friday so I will say here wether or not it worked good :)

Mickevincent commented 6 years ago

Yeah it looks better at 3d scenes, but it blurs pixel quite alot so it isnt as smooth on the pre-rendered backgrounds. Still looking nice :)