forums.PPSSPP.org
The potential of the programmable pipeline - Printable Version

+- forums.PPSSPP.org (https://forums.ppsspp.org)
+-- Forum: PPSSPP - Playstation Portable Simulator Suitable for Playing Portably (/forumdisplay.php?fid=1)
+--- Forum: Development (/forumdisplay.php?fid=3)
+--- Thread: The potential of the programmable pipeline (/showthread.php?tid=14036)

Pages: 1 2


The potential of the programmable pipeline - SkyBladeCloud - 12-05-2014 09:56 PM

Just passing by to share my experience tweaking PPSSPP's shader generator.

As you may already know, the emulator uses OpenGL ES's programmable pipeline to emulate the PSP's fixed one. This is done generating GLSL shaders based on the state of the GE.

Now the interesting thing here is that the shader generator can be tweaked to implement custom blending algorithms or even new lightning models. This is different than custom post-processing shaders, since one can even apply effects based of the actual geometry.

For example, in the following video I show FF Type-0 using a very basic Phong implementation (a per-fragment color illumination model), as opposed to the default per-vertex lightning it originally uses for characters:

dailymotion.com/video/x2buwaw_ppsspp-custom-lightning-model_videogames

Notice how lightning flows through the model. The downside is that PSP games don't normally upload enough material information for complex lightning models to look 100% ok. This is why characters look like porcelain in my video xD. Of course, it can be tweaked further until it matches one's expectations (lowering the specular component on the Phong shading lightning looks more realistic, and not so plastic).

Another example are custom blending models + on-the-fly normal mapping. Given this original scene:

i57.tinypic.com/2ujjfqc.jpg

We can generate in-shader normal maps (reading surroinding texels) and apply them to slightly increase the level of detail. Possibilities are endless, here is one possible result (and yeah, I messed up character's shaders on this one lol):

i58.tinypic.com/xbfl1h.jpg

Again, tweaking the shader generator it's possible to achieve different (and most likely better) result. In this case, there was no light information for static meshes, so normal mapping hardly works with hard coded lights, showing a crispier image.

Aaaand.... here's is a mix of both, to kinda keep the original color feel ^_^":

i59.tinypic.com/2por78k.jpg

I bet many games could benefit from alternative (probably game-specific) shader generators. One could argue if possible improvements do worth it, considering you'd be getting altered results, which is opposed to the concept of emulation. At least type-0 looks pretty good like this, and I think I'm gonna use it to finally (win!) play the game ^_^".

UPDATE: Video showing some cool effects:





Regards:

~Sky


RE: The potential of the programmable pipeline - toofan - 12-06-2014 08:56 AM

Very informative post. Thanks.


RE: The potential of the programmable pipeline - cybercjt - 12-06-2014 12:22 PM

This is just... wow Exclamation


RE: The potential of the programmable pipeline - vnctdj - 12-07-2014 09:58 AM

Moved.


RE: The potential of the programmable pipeline - GuilhermeGS2 - 12-12-2014 05:08 PM

Could it, for example, add ENB Series effect? Lol


RE: The potential of the programmable pipeline - GamerzHell9137 - 12-13-2014 03:08 PM

This looks awesome.


RE: The potential of the programmable pipeline - SkyBladeCloud - 12-14-2014 12:27 AM

(12-12-2014 05:08 PM)GuilhermeGS2 Wrote:  Could it, for example, add ENB Series effect? Lol

haha, not sure if it's a joke but something similar can be done, in fact, let me try to do some cool stuff...

...


RE: The potential of the programmable pipeline - SkyBladeCloud - 12-14-2014 08:01 PM

Here, looks pretty cool IMO ^_^"





~Sky


RE: The potential of the programmable pipeline - GuilhermeGS2 - 12-14-2014 10:33 PM

No, was not a joke. ^^
Nice job, keep up. Can it be used on all games?


RE: The potential of the programmable pipeline - SkyBladeCloud - 12-14-2014 10:42 PM

Yes, as long as new shaders are compatible with the target game (which ultimately depends on the vertex type used by that game). One could also completely rewrite the shader generator to support these effect. In such case, game specific shaders would be automatically generated with new effects on them.

About EMB Series, the main issue is that those are HLSL shaders, and I'm currently using OpenGL (which uses GLSL), so some translation is required...

...


RE: The potential of the programmable pipeline - cybercjt - 12-15-2014 04:56 AM

(12-14-2014 08:01 PM)SkyBladeCloud Wrote:  Here, looks pretty cool IMO ^_^"





~Sky

Damn great great job man looks amazing Big Grin


RE: The potential of the programmable pipeline - GuilhermeGS2 - 12-15-2014 12:59 PM

(12-14-2014 10:42 PM)SkyBladeCloud Wrote:  Yes, as long as new shaders are compatible with the target game (which ultimately depends on the vertex type used by that game). One could also completely rewrite the shader generator to support these effect. In such case, game specific shaders would be automatically generated with new effects on them.

About EMB Series, the main issue is that those are HLSL shaders, and I'm currently using OpenGL (which uses GLSL), so some translation is required...

...

OK, thanks for the reply. I really don't understand anything about programing, so I have no idea how this works. Big Grin


RE: The potential of the programmable pipeline - Henrik - 12-22-2014 09:08 AM

Dolphin does this with it's "per-pixel lighting" functionality - it reformulates the lighting equations to run in the pixel shader instead of the vertex shader. PPSSPP could indeed do the same, and as you have shown also do other interesting things.

Patches welcome, as long as they take care not to slow down the "regular" path Smile


RE: The potential of the programmable pipeline - cybercjt - 12-22-2014 10:50 AM

(12-22-2014 09:08 AM)Henrik Wrote:  Dolphin does this with it's "per-pixel lighting" functionality - it reformulates the lighting equations to run in the pixel shader instead of the vertex shader. PPSSPP could indeed do the same, and as you have shown also do other interesting things.

Patches welcome, as long as they take care not to slow down the "regular" path Smile

ohohoho Cool

Seems like this feature might be implemented sooner... can't wait to test this on PPSSPP Big Grin


RE: The potential of the programmable pipeline - GuilhermeGS2 - 12-23-2014 05:27 PM

Could this effect make colors more natural instead this sepia? I think would look better. Smile