SNES Transparency

Discussion of hardware and software development for Super NES and Super Famicom.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

SNES Transparency

Post by Kannagi »

Hello everyone,
I have a bug on my project, it works on emulator but not on the real machine.
Here I put BG 2 transparency, it works (for example, water), but if I want some tileset BG 2 are not transparent as I do?

Thank you in advance
http://img15.hostingpics.net/pics/343215exempleSNES.png
AWJ
Posts: 433
Joined: Mon Nov 10, 2008 3:09 pm

Re: SNES Transparency

Post by AWJ »

You're going to need to provide more information, it's not at all clear from the screenshot what you're even trying to do. What parts of the screen are on each BG layer and what PPU register settings are you using (particularly TM, TS, CGWSEL and CGADSUB)?
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

Re: SNES Transparency

Post by Kannagi »

Thank you for answering,
Yes sorry it's been a while since I have not programmed SNES.
The sol is the BG2 and BG1 (the white square are the BG2)

Code: Select all

SNES_TM $17
SNES_TS $11
SNES_CGSWSEL $02
SNES_CGADSUB $42
AWJ
Posts: 433
Joined: Mon Nov 10, 2008 3:09 pm

Re: SNES Transparency

Post by AWJ »

So, the water is high-priority BG2 tiles and the part of the ground that's turning white is low-priority BG2 tiles?

Make sure you've initialized COLDATA to black by writing #$e0 to it. Otherwise if there is no layer under BG2 then it will get blended with whatever is in that register, with halving forced off.

Also, what emulator are you using?
Kannagi
Posts: 100
Joined: Sun May 11, 2014 8:36 am
Location: France

Re: SNES Transparency

Post by Kannagi »

Thank you, I have not used well COLDATA, it works perfectly now.
I use SNES9X, but the bug persists Znes and NOSNS.

Thank you again;)
AWJ
Posts: 433
Joined: Mon Nov 10, 2008 3:09 pm

Re: SNES Transparency

Post by AWJ »

Leaving hardware registers or RAM uninitialized is probably the number one source of "My code works on emulators, but..." bugs.
User avatar
Bregalad
Posts: 8036
Joined: Fri Nov 12, 2004 2:49 pm
Location: Caen, France

Re: SNES Transparency

Post by Bregalad »

It is probably not the best ressource ever, but I also was puzzled by the complexity of SNES' transparency, so I typed down my notes about it in a FAQ here : http://www.romhacking.net/documents/428/
Post Reply