Sketch-A-SNES

Found a bug? Please report it, but remember to follow the bug reporting guidelines.
Missing a sane feature? Let us know!
But please do NOT request ports to other systems.

Moderator: ZSNES Mods

Post Reply
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Sketch-A-SNES

Post by pagefault »

Image

Just playing around with the new OpenGL code using GLSL.
byuu

Post by byuu »

Not the most... useful... pixel shader I've seen, but cool nonetheless.

Care to add the HQ2x one? That would probably give a major performance boost over the software version, and it supposedly works with scaling other than 2x2.

Direct3D can also use these shaders, but it uses a different format and there aren't nearly as many shaders available for it (that I can find) :/
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Yeah it was the most interesting one I could find at the moment, I wrote a sepia one but that was pretty boring. HQ2X could probably be implemented in a shader as could the NTSC filter. Colour space conversion is very fast doing it this way so people on slower systems might be able to run it at full speed, but I am only just starting to learn GLSL so something like that would be way over my head.
Starman Ghost
Trooper
Posts: 535
Joined: Wed Jul 28, 2004 3:26 am

Post by Starman Ghost »

That's pretty damn nifty looking. Would be hard to actually play like that, but cool none the less.
[code]<Guo_Si> Hey, you know what sucks?
<TheXPhial> vaccuums
<Guo_Si> Hey, you know what sucks in a metaphorical sense?
<TheXPhial> black holes
<Guo_Si> Hey, you know what just isn't cool?
<TheXPhial> lava?[/code]
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Starman Ghost wrote:That's pretty damn nifty looking. Would be hard to actually play like that, but cool none the less.
Perhaps.. but if you know the game well enough, this might not hurt you as much.

Though the important thing is that there is shader support in the pipeline... which can and will benefit those that have more current hardware.

Best part is actually getting filtering in hires screens... something most of you that currently use filters will give a damn about.
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
byuu

Post by byuu »

Hm, pagefault, can you share your sepia algorithm? Or just explain how it works? Simply taking the red channel and dropping the rest, or averaging luminance from all three and turning it into red will look way too dark and... red. How exactly do you convert the color to a sepia shade?

On the subject of hires/interlace and filters... always a tricky subject. The SNES can switch between hires and non-hires on every scanline. Interlace is easier because it can only be done at the start of every other frame.

Games like GOD for example will display the top and bottom at 256-width and the middle at 512-width (for the hires textbox). It looks really nasty when no textbox is onscreen and the image is filtered, then you talk to someone and the filtering goes away :/

blargg's filter supports this by use of a scanline width table, but all of my other filters just cop out and use the direct renderer when hires is enabled.

What we need to do is modify HQ2x, etc to support these 512-width scanlines somehow, but I don't know how to modify it to do that :/
CyberBotX
Lurker
Posts: 109
Joined: Sun Jan 30, 2005 10:06 pm
Location: Wouldn't you like to know?
Contact:

Post by CyberBotX »

Took me a second to realize what game you were using, but I recognized Lucca still. <.< That's a pretty sweet test image. :P You mind if I ask what GLSL is?
[url=http://www.cyberbotx.com/]SNES Sprite Animations[/url], made by an Insane Killer Robot.
I'm a computer programmer (in C++) and a future game designer.
Clements
Randomness
Posts: 1172
Joined: Wed Jul 28, 2004 4:01 pm
Location: UK
Contact:

Post by Clements »

CyberBotX wrote:You mind if I ask what GLSL is?
OpenGL Shading Language - the OpenGL equivalent of DirectX shaders.

I'm very excited about this - Offloading complex filters onto the GPU is a great thing, as is importing custom shaders. Is this implemented in the Windows port or is this a Linux-only thing as it is OpenGL? Seems too good to be true.
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Fragment program based on one from a post on Pete's GPU forum which I cleaned up and added some comments for explaination. The vertex shader shouldn't be needed for our purposes.

Basically all we need to do is convert RGB to YIQ and we don't even need the I and Q values for sepia.

http://www.razyboard.com/system/index.p ... id=1431795

Code: Select all

void main()
{
// We take the RGB colour and we map it to YIQ
vec3 colour = texture2D(OGL2Texture, gl_TexCoord[0].st).rgb;

float Y = dot(vec3( 0.299, 0.587, 0.114),colour);

// these values blatently ripped off from Pete's GPU forums
float red = Y + 0.1912;
float green = Y - 0.0544;
float blue  = Y - 0.2210;

// 0.0 alpha unless you want some sort of transparency
gl_FragColor = vec4(red,green,blue,0.0);
}

As for HQ2X, ZSNES does have a scanline width table of some sort, but I do not know how it works. MaxSt has made use of it though in his assembly versions of the HQ filters and they support hi-res mode beautifully. I'll look into what exactly is going on in these filters and get back to on it so maybe we can get the NTSC filter and the C versions of the HQ filters using hires mode also. It seems the 2xSaI filter also uses this table.

That algorithm is GLSL btw, not C. But as you can see it's very similar and easy to use :)
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

Clements wrote:
CyberBotX wrote:You mind if I ask what GLSL is?
OpenGL Shading Language - the OpenGL equivalent of DirectX shaders.

I'm very excited about this - Offloading complex filters onto the GPU is a great thing, as is importing custom shaders. Is this implemented in the Windows port or is this a Linux-only thing as it is OpenGL? Seems too good to be true.
What I was told by pagefault is that this code is currently in "sekret CVS"...

It is strictly OpenGL.. and if I recall correctly.. OpenGL has been implemented in the Windows port...

Current requirement is having a card that supports GLSL (which is effectively any video card that supports SM2 or better).
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

The "sekret" CVS is more a CVS for WIP work, we are going to be using it for code that is currently being worked on and is not complete then when that is done it is moved into the sourceforge server and marked stable. This prevents WIP's from coming out that are full of incomplete code and bugs that were not finished.
DataPath
Lurker
Posts: 128
Joined: Wed Jul 28, 2004 1:35 am
Contact:

Post by DataPath »

In Pete's GPU forum, there's a storybook shader that's pretty cool - it looks like the scene is being sketched live
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

You will be able to use your own custom shaders. I have added support for this. Just store it any text file.
-_pentium5.1_-
Lurker
Posts: 110
Joined: Sat Sep 04, 2004 7:55 pm
Location: USA

Post by -_pentium5.1_- »

Deathlike2 wrote:OpenGL has been implemented in the Windows port [CVS code]...
Really? Are there any other threads discussing this?
This signature intentionally contains no text other than this sentence.
Deathlike2
ZSNES Developer
ZSNES Developer
Posts: 6747
Joined: Tue Dec 28, 2004 6:47 am

Post by Deathlike2 »

-_pentium5.1_- wrote:
Deathlike2 wrote:OpenGL has been implemented in the Windows port [CVS code]...
Really? Are there any other threads discussing this?
Some of this stuff was discussed in IRC...

I believe there were some prior threads about shaders being needed for filters so they can be applied while using a hires mode...
Continuing [url=http://slickproductions.org/forum/index.php?board=13.0]FF4[/url] Research...
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

I have finished porting the DirectDraw code to Direct3D so HLSL shaders will now be possible as wel as GLSL in OpenGL. Although you still need a SM 2.0 card to use them.
Agozer
16-bit Corpse | Nyoron~
Posts: 3534
Joined: Sun Aug 01, 2004 7:14 pm
Location: Nokia Land

Post by Agozer »

pagefault wrote:I have finished porting the DirectDraw code to Direct3D so HLSL shaders will now be possible as wel as GLSL in OpenGL. Although you still need a SM 2.0 card to use them.
Excellent. Now all I need is a build.
whicker: franpa is grammatically correct, and he still gets ripped on?
sweener2001: Grammatically correct this one time? sure. every other time? no. does that give him a right? not really.
Image
pagefault
ZSNES Developer
ZSNES Developer
Posts: 812
Joined: Tue Aug 17, 2004 5:24 am
Location: In your garden

Post by pagefault »

Will be a while, we have a lot we are working on right now.
Post Reply