Filtering games with 2D and 3D elements

I’m working on a solution to filter games that combine 2d sprites with 3d polygons.

The last image show that background and PRESS START BUTTON text is well filtered by xbr, but the fighters aren’t. That’s because sega has used 2d sprites with different resolutions. Anyway, the polygons aren’t touched, so it’s possible to filter even with High Internal Res enabled.

It should work in some cases. The cores need to increase internal res and output perfect square pixels, or else the sprites can’t be detected.

1 Like

Ah, very clever! Could you have different detection passes tuned to the different pixel sizes in CvS, for example, or are the fighters scaled in such a way as to make identifying them unreliable?

It’s a possibility and a future evolution. But first I have to test and test…

There are some chalenges. For example, in Mupen64 the only gpu core that works with it is gnl64. Glide64 and Rice just don’t output square pixels when you increase internal resolution. They mess up with it big time and the shader fails to detect any sprites. Using gnl64 it works very well. The problem is that gnl64 doesn’t have a good compatibility and have a nasty bilinear filter hardcoded on some sprites that I can’t turn off in order to use xbr. Example: http://screenshotcomparison.com/comparison/158707

EDIT: Ikaruga run perfect with this enabled using 3x internal res!

:open_mouth:

That looks like the Steam/360 version! Very cool!

looks great Hyllian!

I’ve managed to make the shader for xbr level2. It works on ePSXe:

Nice work, companies keep feeding us remakes we have to buy all over again but I think its more fun to tweak the classics and see what mileage you can get out of them.

Yes. I think I have an idea to create a mask3D and use any other shader to filter the low res part of the image. It should be doable with multipass shaders. Anyway, it’s a long way ahead.

I took some more shots from other games:

I’ve managed to make it work at 60fps on ePSXe!

Using this config:

And this shader attached.

1 Like

Now I ported three more shaders that work well with 3D in High Res (the same way the xBR). They’re Jinc2-Sharper-3D, Lanczos2-Sharper-3D and Jinc2-Sharpest-3D.

The second to last shot with vivi looks amazing

Nothing beats scanlines imo.

It would be cool to have it use super xBR instead of classic xBR since for environments, superxbr pretty much rendered xBR obsolete. Classic xBR works great for NES and games with more defined colors, but it doesn’t work well with photorealistic environments the same way super xBR does.

Yes, and I have already released the shaders you’re talking about:

  • super-2xbr-3d (for use with 2x internal res);
  • super-4xbr-3d (for use with 4x internal res).

They’re already in common-shaders.

[QUOTE=Hyllian;33988]Yes, and I have already released the shaders you’re talking about:

  • super-2xbr-3d (for use with 2x internal res);
  • super-4xbr-3d (for use with 4x internal res).

They’re already in common-shaders.[/QUOTE]

I’m trying to get these to work. I tried using the presets(those containing 3d) but they don’t load for some reason. I can load for example “super-xbr-2p.cgp” just fine and it got me thinking if I could just rename “super-2xbr-3d-pass0.cg” and “super-2xbr-3d-pass1.cg” to “super-xbr-pass0.cg” and “super-xbr-pass1.cg” they should load when I try using the preset “super-xbr-2p.cgp” but nope, they don’t. So I updated the shaders using the online updater(to reset) and tried to do it manually and it does say “super-2xbr-3d-pass0.cg” under “Shader #0” etc but I don’t see anything different, it’s behaving as if I have zero filters.

I tried them with Mednafen-PSX with the latest nightly build & everything up to date. Resolutions I tried with were 640x480 & 1280x960. (2x & 4x native res iirc).

I’m not sure what I’m missing.

[QUOTE=pralinen;34311]I’m trying to get these to work. I tried using the presets(those containing 3d) but they doesn’t load for some reason. I can load for example “super-xbr-2p.cgp” just fine and it got me thinking if I could just rename “super-2xbr-3d-pass0.cg” and “super-2xbr-3d-pass1.cg” to “super-xbr-pass0.cg” and “super-xbr-pass1.cg” they should load when I try using the preset “super-xbr-2p.cgp” but nope, they don’t. So I updated the shaders using the online updater(to reset) and tried to do it manually and it does say “super-2xbr-3d-pass0.cg” under “Shader #0” etc but I don’t see anything different, it’s behaving as if I have zero filters.

I tried them with Mednafen-PSX with the latest nightly build & everything up to date. Resolutions I tried with were 640x480 & 1280x960. (2x & 4x native res iirc).

I’m not sure what I’m missing.[/QUOTE]

Run it with Retroarch_debug.exe and copy here the log (enable log to level3 in Retroarch options). The log will appear at the command window. Probably your GPU doesn’t support the number of registers needed to run these shaders (they’re very heavy!).

Ah, I had to enable “Logging Verbosity” as well.

RetroArch [INFO] :: CG: Destroying programs. RetroArch [INFO] :: CG: Destroying context. RetroArch [INFO] :: [Cg]: Vertex profile: gp5vp RetroArch [INFO] :: [Cg]: Fragment profile: gp5fp RetroArch [INFO] :: Loading Cg meta-shader: D:\Spel\retroarch\shaders\shaders_cg\xbr\super-2xbr-3d-2p.cgp RetroArch [INFO] :: Found #pragma parameter Xbr - Edge Strength p0 (XBR_EDGE_STR) 2.000000 0.000000 5.000000 0.500000 RetroArch [INFO] :: Found #pragma parameter Xbr - Filter Weight (XBR_WEIGHT) 1.000000 0.000000 1.500000 0.050000 RetroArch [INFO] :: Found #pragma parameter Xbr - Filter Weight2 (XBR_WEIGHT2) 1.000000 0.000000 1.500000 0.050000 RetroArch [INFO] :: Found #pragma parameter Xbr - Anti-Ringing Level (XBR_ANTI_RINGING) 0.000000 0.000000 1.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Xbr - WP1 (WP1) 2.000000 -20.000000 20.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Xbr - WP2 (WP2) 1.000000 -20.000000 20.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Xbr - WP3 (WP3) -1.000000 -20.000000 20.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Xbr - WP4 (WP4) 4.000000 -20.000000 20.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Xbr - WP5 (WP5) -1.000000 -20.000000 20.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Xbr - WP6 (WP6) 1.000000 -20.000000 20.000000 1.000000 RetroArch [INFO] :: Found #pragma parameter Window Sinc Param (JINC2_WINDOW_SINC) 0.420000 0.000000 1.000000 0.010000 RetroArch [INFO] :: Found #pragma parameter Sinc Param (JINC2_SINC) 0.920000 0.000000 1.000000 0.010000 RetroArch [INFO] :: Found #pragma parameter Anti-ringing Strength (JINC2_AR_STRENGTH) 0.000000 0.000000 1.000000 0.100000 RetroArch [INFO] :: Loading Cg shader: “D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg”. RetroArch [ERROR] :: CG error: The compile returned an error. RetroArch [ERROR] :: Fragment: D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(236) : error C1008: undefined variable “XBR_WEIGHT2” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(236) : error C1008: undefined variable “XBR_WEIGHT2” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(236) : error C1008: undefined variable “XBR_WEIGHT2” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(236) : error C1008: undefined variable “XBR_WEIGHT2” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(96) : error C1008: undefined variable “WP1” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(96) : error C1008: undefined variable “WP2” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(96) : error C1008: undefined variable “WP3” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(96) : error C1008: undefined variable “WP4” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(96) : error C1008: undefined variable “WP5” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(96) : error C1008: undefined variable “WP6” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(101) : error C1008: undefined variable “WP4” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(101) : error C1008: undefined variable “WP1” D:\Spel\retroarch\shaders\shaders_cg\xbr\shaders/super-xbr/super-2xbr-3d-pass0.cg(101) : error C1008: undefined variable “WP3”

RetroArch [ERROR] :: Failed to load shaders … RetroArch [INFO] :: CG: Destroying programs. RetroArch [INFO] :: [Cg]: Vertex profile: gp5vp RetroArch [INFO] :: [Cg]: Fragment profile: gp5fp RetroArch [INFO] :: Loading stock Cg file. RetroArch [WARN] :: [GL]: Failed to set multipass shader. Falling back to stock.

Compile errors? Hm…

Thanks for the log. I have indeed made a mistake letting some debug vars inside the shaders (LOL). Amazing how you’re the first one to notice it after more than one week after the release.

Anyway, I just fixed, please download these shaders from common-shaders and test again.

1 Like