A Doc That May Help Squidgesnes Transparency Issues


tetsuomaki

Still Fresh
Joined
Jun 5, 2006
Messages
17
Location
Sheffield, UK
Website
Visit site
Hi guys... been reading around about the SNES background layers after running into problems with the rain in Zelda. After comparing the sources for SquidgeSnes and original Snes9x there seem to be a lot of differences in the file gfx.cpp regards background layer rendering.
Anyway here is a doc that looks like it may help someone fix these probs! Apologies if already posted or you know all this already.

http://oregonstate.edu/~robinsfr/docs/snlayers.txt

One thing that was really confusing to me is that the main screens are
translucent, not the subscreens. I always thought that the main screens were
the opaque layers used by most games, and that subscreens were special layers
which were used for such special effects. Somehow every document I've ever
read on addition/subtraction (of course, there aren't that many) has neglected
to mention that helpful bit of info. They always stated how the subscreens
were added to the mainscreens, when in actuality, the translucent main screens
are added to the opaque subscreens behind it. It really does not matter how
it's actually looked at, since both 1+2=3 and 2+1=3, but the main screens are
still in front of the subscreens. This does not apply with subtraction though.
You can't look at it the other way and have it still turn out alright.
Subscreens are subtracted from main screens, but they are subtracted from
behind. Interestingly, by doing it this way, all the colors of lower
subscreens must be completely rgb inverted so that they appear in their
correct colors on screen. If the main screen was a pure white, a dark blue
would yield a bright yellow. For example, take a look at the level 'Torchlight
Trouble' from 'DK Country'. It looks aweful when not in high color mode.

cheers,
 
It's true that Squidgesnes doesn't do transparency properly, but the simple reason for that is performance. It could do it properly, but then it would be running at anything between half and a third of the speed it does now when it encounters a screen that used such features.
 
its pretty hard to perform donky kong 3 diddys quest, level2 when the whole screen envolves fog
 
You can just turn the fog layer off, can't you? :-\

- Alex
 
It's true that Squidgesnes doesn't do transparency properly, but the simple reason for that is performance. It could do it properly, but then it would be running at anything between half and a third of the speed it does now when it encounters a screen that used such features.

Ah ok, thanks for the reply Squidge that clears some stuff up for me.
The reason why I thought this may have helped was because it always appears as though the rain is rendered behind the other layer and some tiles (often around trees or buildings) become translucent and you can see background layer 1 (the rain) through it. Hence why i was under the impression that it was a rendering issue, I never actually thought it might be the case that the transparency code was disabled presumably because it would take too long to calculate the new rgb values after the ADD or SUB for each pixel.

Thanks for all the effort you guys have put into this, I know it is really appreciated by everyone :)
 
Last edited by a moderator:
SquidgeSnes is probably fast enough now (a lot of games run at 60fps) to get away with real transparancy on some games.
 
If the reason for not having the support is the speed, why couldn't the transparency support be added as an option? Then the user can turn it on or off and save the config for indiviual games. :huh:
 
At the moment, the current graphics source base doesn't support transparency. So if you want that, you'll have to either implement it, or recompile with the transparent version of the graphics source (which isn't as optimised).
 
It is amazing that we have full speed CPS2 and NeoGeo but complete SNES still seems so far away :( It is strange that SNES is so much harder to do.
 
It is amazing that we have full speed CPS2 and NeoGeo but complete SNES still seems so far away :( It is strange that SNES is so much harder to do.

I'm probably talking out of my arse, but I vaguely remember people talking about, in a completely unrelated emulation forum, that 68k chips are emulated pretty well nowaday, and its all pretty standard. I think Neo Geo and CPS2 both use 68k chips.

The 68000 was the main CPU of many arcade systems during the late 1980s and early 1990s, such as Sega's System 16, Capcom's CPS-1 and CPS-2, and SNK's Neo Geo.
http://en.wikipedia.org/wiki/Motorola_68000

I've heard before that 68k chips are very well documented and easily emulated on many platforms.

I dont really know anything, but I thought I would toss that one into the air.

Edit: Of course, that doesn't explain why we dont have Sharp X68000 support yet :(
 
Last edited by a moderator:
I'm probably talking out of my arse, but I vaguely remember people talking about, in a completely unrelated emulation forum, that 68k chips are emulated pretty well nowaday, and its all pretty standard. I think Neo Geo and CPS2 both use 68k chips.

It is not really the CPU that is the problem. The CPU core in Squidgesnes is ASM. The SNES CPU is very weak too. I bet the GP2X could emulate 5 SNES CPUs at once. I think the problem is the graphics hardware. It seems very hard to emulate and that is not well documented.
 
Last edited by a moderator:
It is not really the CPU that is the problem. The CPU core in Squidgesnes is ASM. The SNES CPU is very weak too. I bet the GP2X could emulate 5 SNES CPUs at once. I think the problem is the graphics hardware. It seems very hard to emulate and that is not well documented.

That is correct, but you will have almost perfect snes eventually, when it happens is another question entirely though. It could be next month/next 6 months/next year.
 
Last edited by a moderator:
It is amazing that we have full speed CPS2 and NeoGeo but complete SNES still seems so far away :( It is strange that SNES is so much harder to do.
Snes9x is the only portable emulator, but it has hell of the mess in it's code. It's nearly unmaintainable, the code is difficult to understand (at least for me), so it feels much more convenient to hack some SegaCD stuff in PicoDrive, where most stuff is written by me and I know (at least can feel in some way) the purpose of every line of code.
 
Last edited by a moderator:
So... erm.... a SNES emulator from scratch then Notaz? ;) lol

EDIT: Yes I know what you mean, just the style of coding (indentations etc) to be different and it makes the code so much more difficult to read and understand.
 
The best way of hacking it is certainly to start from scratch, but unlike megadrive where you can get some instant results to keep you going whilst you tweak it to perfection, there is a lot of crap in the snes9x graphics hardware. I might have a look at it again when I get some time/etc. The problem you have to think is that you have to process the graphics a scanline at a time because of HDMA/Window effects/sprites/color subtraction and addition/etc otherwise it just looks crap.
 
It is amazing that we have full speed CPS2 and NeoGeo but complete SNES still seems so far away :( It is strange that SNES is so much harder to do.
Snes9x is the only portable emulator, but it has hell of the mess in it's code. It's nearly unmaintainable, the code is difficult to understand (at least for me), so it feels much more convenient to hack some SegaCD stuff in PicoDrive, where most stuff is written by me and I know (at least can feel in some way) the purpose of every line of code.

Any chance that maybe you would consider a SNES re-write someday? You did a great job speeding up SquidgeSNES. I am not sure how far the GP2X can go with SegaCD. That is cool too but those damn CDs eat up so much card space.

Maybe there is some trick that can be used to speed up the graphics rendering. Maybe the transparencies could just be a checkerboard fill pattern or something so that it doesn't have to average the layers etc.

SNES seems to be the holy grail of 2D emus. I know near full speed SNES with transparency support would be a huge hit.
 
Last edited by a moderator:
Any chance that maybe you would consider a SNES re-write someday? You did a great job speeding up SquidgeSNES. I am not sure how far the GP2X can go with SegaCD. That is cool too but those damn CDs eat up so much card space.
A complete rewrite from scratch would be a huge project, would take a couple of years maybe. Given the fact that my knowledge of the system is very limited, there is not much documentation available, It would take even longer. By the time I would finish there will already be hardware to handle direct port I think.
But there are still a lot of things to be done with Snes9x, I think SNES situation will improve sooner or later.
 
Last edited by a moderator:
Apologies in advance if this is a dumb suggestion, but has anyone looked at porting the Linux/SDL ZSnes?

http://www.zsnes.com/
Source: http://prdownloads.sourceforge.net/zsnes/zsnes150src.tar.bz2
edit: v1.5 released 22nd Dec 2006

They did replace a lot of x86 asm with that release according to the changelog,
but there probably still is a lot of it in the source which would need to be rewritten to be able to port it, which is a huge effort.

There may be other reasons as well.
 
Last edited by a moderator:
Back
Top