shonumi / gbe-plus

DMG/GBC/GBA emulator and experimental NDS emulator.
GNU General Public License v2.0
527 stars 79 forks source link

6xBRZ texture scaling #12

Open ADormant opened 9 years ago

ADormant commented 9 years ago

Could you add xbrz texture scaling to GBE. I think it wold be nice even with tile replacement and can be used to scale replacement tiles/textures not to mention not every game will have replacement assets.

https://github.com/tapcio/PeteOpenGL2Tweak/tree/master/gpuPeteOpenGL2Tweak/xBRZ https://github.com/PeterTh/gedosato/tree/master/ext/xbrz https://github.com/devinacker/bsnes-plus/pull/27/files https://sourceforge.net/projects/xbrz/files/xBRZ/ https://sourceforge.net/projects/xbrz/files/?source=navbar https://github.com/gonetz/GLideN64/commit/daf18efabbae16454c83562456a6cc19b53255a1 https://github.com/gonetz/GLideN64/commit/5bf7a4e4dea9bc7f1b0cb68db5781b386a5470b7 https://github.com/gonetz/GLideN64/commit/65f29beba6f32f6887647baf28bdae07ad515b96 https://github.com/gonetz/GLideN64/commit/b81c8404fed4a1eb62d3c7354fb7151d1be9508b https://github.com/gonetz/GLideN64/commit/58c48a8f60e06b77c2dd5133f94b43f7a34218cd https://github.com/gonetz/GLideN64/commit/663b5d1f5e930d755b157a68fc804f0372622584 https://github.com/Tinob/Ishiiruka/commit/d2fb92518f50c6154f33f05be39128e48d6b83be https://github.com/Tinob/Ishiiruka/commit/84f96aec7b2c52fda401e9d2419ab9a8787b349a https://github.com/Tinob/Ishiiruka/commit/6bf5062b7656d9d1d026478a2a639497cad2357b http://ngemu.com/threads/peops-opengl-1-78-xbrz-scalers-mod.173953/ http://ngemu.com/threads/peteopengl2tweak-tweaker-for-peteopengl2-plugin-w-gte-accuracy-hack.160319/ https://github.com/nagadomi/waifu2x http://forum.doom9.org/showthread.php?t=170727

shonumi commented 9 years ago

xBRZ has been planned for a while (since the old GBE project actually) This would have to be implemented as a shader, which depends upon SDL2 (so OpenGL 3.0+ can be used properly). Switching to SDL2 is not a technical problem, just last time I tried, it was 5% slower than SDL 1.2. I'm going to switch eventually (because using shaders is a project goal) but it's on a big TODO list.

I'll get to it eventually, rest assured :)

ADormant commented 9 years ago

xBR and xBRZ are different - xBR is a shader however xBRZ is a CPU filter but it can be used to scale textures directly while xBR is limited to just fullscreen filtering. Thus I think the best course of action would be to implement both and also Super xBR for digitized games. https://github.com/libretro/common-shaders/tree/master/xbr https://github.com/libretro/common-shaders/tree/master/nedi https://github.com/libretro/common-shaders/tree/master/cgp Many good shaders although mostly useful for 3D like DS emulation,

http://forums.pcsx2.net/attachment.php?aid=58711 https://github.com/Tinob/Ishiiruka/blob/master/Data/Sys/Shaders/IshiirukaFX.glsl https://github.com/Tinob/Ishiiruka/blob/master/Data/Sys/Shaders/DolphinFX.glsl https://github.com/Tinob/Ishiiruka/commit/a9560c8e3ae777cb2f57e185220bc9d8a9f0e9a4 https://github.com/Tinob/Ishiiruka/commit/bd3de2dc040520968c2ff63ce33a74cfa2f94a33 https://github.com/Tinob/Ishiiruka/commit/bbccbe938486cb954bc13f0935610abdc5885f45 https://github.com/Tinob/Ishiiruka/commit/d4f525085234d54cc8d81f99eb4efa5e899b7bbc https://github.com/Tinob/Ishiiruka/commit/5fe34864ff93b9010890b7ac8ba04cbebbab0123 @shonumi https://github.com/Tinob/Ishiiruka/commit/d40f9df7ef04e467533ec515ef1c3075d06de12d https://github.com/Tinob/Ishiiruka/commit/3374eb731c5128dcb843cbd17d904a1121f72aa1

shonumi commented 9 years ago

xBR and xBRZ are both scaling methods. They're just mathematical equations and rules that determine how to manipulate pixel data. Both can be implemented as a shader or as a CPU filter. The difference between xBR and xBRZ is that xBRZ uses a different rule set for interpolation, which in turn produces "better" results for most users.

ADormant commented 9 years ago

I see however I heard that GPUs simply don't have capability to apply their effects directly to textures(they can only apply post-processing shaders to the entire screen) and this is why xBR on a GPU can't scale textures while CPU filters can, Is that true? @shonumi

shonumi commented 9 years ago

It's true, it probably won't work just yet on individual textures, but this is only a concern for DS emulation The DS is the only system I plan to emulate that would use the GPU to handle textures, besides a texture representing the final fullscreen.

Rplacement tiles don't use textures (it's all software). If users want xBRZ or xBR applied for custom tiles only, the best method is to apply scaling when editing the actual images, before GBE+ loads them. Otherwise, they can just use a fullscreen filter/shader.

ADormant commented 9 years ago

I wonder if Waifu2x is possible to implement in an emulator? @shonumi

https://github.com/nagadomi/waifu2x http://www.wisdom.weizmann.ac.il/~vision/SingleImageSR.html http://research.microsoft.com/en-us/um/people/kopf/pixelart/paper/pixel.pdf http://forums.ppsspp.org/showthread.php?tid=15623

waifu2x 1x upscale

ADormant commented 9 years ago

@shonumi Optimized versions with AVX1/2 http://forum.videohelp.com/threads/372157-New-upscaling-algorithm-waifu2x . GLSL shader https://github.com/ueshita/waifu2x-converter-glsl https://github.com/lltcggie/waifu2x-caffe https://github.com/MaverickTse/aviutl-waifu2x-gl https://github.com/WL-Amigo/waifu2x-converter-cpp

Garteal commented 8 years ago

@ADormant No, it's way too slow to be used in realtime.

Garteal commented 8 years ago

@ADormant I was referring to Waifu not xbrz.

ADormant commented 8 years ago

https://github.com/tapcio/PeteOpenGL2Tweak/tree/master/gpuPeteOpenGL2Tweak/xBRZ