Space for 256-colour image plus second background?

Discussion of hardware and software development for Super NES and Super Famicom. See the SNESdev wiki for more information.

Moderator: Moderators

Forum rules
  • For making cartridges of your Super NES games, see Reproduction.
Post Reply
iNCEPTIONAL

Space for 256-colour image plus second background?

Post by iNCEPTIONAL »

Is there enough space in vram to have a fullscreen 256-colour image in BG Mode 3 that's all unique tiles, plus the second background layer with maybe a couple hundred tiles, and the full set of sprites tiles?
creaothceann
Posts: 611
Joined: Mon Jan 23, 2006 7:47 am
Location: Germany
Contact:

Re: Space for 256-colour image plus second background?

Post by creaothceann »

iNCEPTIONAL wrote: Thu Aug 04, 2022 12:14 am fullscreen 256-colour image in BG Mode 3 that's all unique tiles
256x224 is 32x28 = 896 tiles
tile size is 8x8 = 64 bytes
RAM usage is therefore 896 * 64 = 57,344 bytes. Which is exactly 87.5 percent of the VRAM size (64 KiB).

Each BG tile also needs 2 bytes in the tilemap, i.e. 896 * 2 = 1,792 bytes.

Sum: 59,136 bytes (90.2% of VRAM). Which leaves exactly 6,400 bytes of free space.

iNCEPTIONAL wrote: Thu Aug 04, 2022 12:14 am second background layer with maybe a couple hundred tiles
full set of sprites tiles
BG2 and sprite tiles are half the size of BG1 tiles, i.e. 32 bytes.

The 6,400 free bytes would therefore be enough for exactly 200 tiles. Note though that BG2 would also need a tilemap, which is the same size as the BG1 tilemap (1,792 bytes).

(6,400 - 1,792) / 32 = 144 tiles for BG2 and sprites.


EDIT: if you want to scroll the backgrounds in less than 8 pixel steps you'd need another column/row per tilemap.
Last edited by creaothceann on Thu Aug 04, 2022 2:57 am, edited 1 time in total.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
iNCEPTIONAL

Re: Space for 256-colour image plus second background?

Post by iNCEPTIONAL »

I can skip most of the second background to be honest and do most of it with a handful of repeated tiles (if I even really need it at all), and the 256 colour BG image will actually have some repeated tiles, also, there's still an option to switch out-in a few tiles on the fly too*, so I think that's just aboot gonna work. :beer:

*How many of those 256-colour BG tiles can SNES switch in-out every frame?

For context, I'm going to have a bunch of arcade cabinets in a scene something like this and will be animating the screen or similar on some of them (I'm thinking with animated tiles):
Image.png
Image.png (40.03 KiB) Viewed 1407 times
Image2.png
Myself086
Posts: 158
Joined: Sat Nov 10, 2018 2:49 pm

Re: Space for 256-colour image plus second background?

Post by Myself086 »

iNCEPTIONAL wrote: Thu Aug 04, 2022 2:37 am *How many of those 256-colour BG tiles can SNES switch in-out every frame?
At least 4KB worth of CHR depending on what else is going on and whether the CHR's are in a row or not.

At 64 bytes per CHR, that's 64+ CHR that you can change per frame.

You can change even more CHR per frame if you use mode 1 instead. Here's what it looks like on a 4bpp background with 7 palettes (using a friend's tool in development):

Image

This is just using 1 BG but it could look better by using 2 BGs and adjusting a few of the colors.
iNCEPTIONAL

Re: Space for 256-colour image plus second background?

Post by iNCEPTIONAL »

Myself086 wrote: Thu Aug 04, 2022 5:40 am
iNCEPTIONAL wrote: Thu Aug 04, 2022 2:37 am *How many of those 256-colour BG tiles can SNES switch in-out every frame?
At least 4KB worth of CHR depending on what else is going on and whether the CHR's are in a row or not.

At 64 bytes per CHR, that's 64+ CHR that you can change per frame.

You can change even more CHR per frame if you use mode 1 instead. Here's what it looks like on a 4bpp background with 7 palettes (using a friend's tool in development):

Image

This is just using 1 BG but it could look better by using 2 BGs and adjusting a few of the colors.
Not to sound like a total noob, but does CHR just mean a tile?

So, I'd be able to switch in/out around 64 tiles per frame in 8bpp, give or take, and obviously more in 4bpp?
Myself086
Posts: 158
Joined: Sat Nov 10, 2018 2:49 pm

Re: Space for 256-colour image plus second background?

Post by Myself086 »

iNCEPTIONAL wrote: Thu Aug 04, 2022 5:51 am Not to sound like a total noob, but does CHR just mean a tile?
CHR is short for "character", it's the 8x8 pixel tile within the tileset. It's called character because this rendering technique is derived from text computers.

I use the word "tile" only for an element of the tilemap and use "CHR" for an element of the tileset.
iNCEPTIONAL

Re: Space for 256-colour image plus second background?

Post by iNCEPTIONAL »

Myself086 wrote: Thu Aug 04, 2022 6:27 am
iNCEPTIONAL wrote: Thu Aug 04, 2022 5:51 am Not to sound like a total noob, but does CHR just mean a tile?
CHR is short for "character", it's the 8x8 pixel tile within the tileset. It's called character because this rendering technique is derived from text computers.

I use the word "tile" only for an element of the tilemap and use "CHR" for an element of the tileset.
Got it. Cheers.
iNCEPTIONAL

Re: Space for 256-colour image plus second background?

Post by iNCEPTIONAL »

If I have an image something like this, which I then convert to use 256 colours for everything (imagine it's already posterized to 32 levels in Photoshop to be SNES accurate):
Image3.png
Is there some easy way to set the index of the specific sprite palettes without affecting the index of the colours for the background image (which in Mode 3's 8bpp 256 mode uses both the background and sprite palettes together), so the background image doesn't get all messed up once the palettes get organized properly.

Probably need to figure out how that works for the second background too, which doesn't use 8bpp 256 mode, so the background palettes still technically need to be organized for use in that background similarly.

Note: For now, I don't want to just cut the background colours down to 128 and have the 128 sprite colours not shared with the background image at all, as I really do want to try to get all 256 colours in the background. And figuring out the way to use all 256 colours in the background image while still setting up the ones for the sprites palettes [and second background too] as described above will help with other examples in the future in general, so I'd like to know if there is a way to do that in whatever program, ideally Photoshop for me to be honest, but, if not, then the one that works.

And I'm asking from the point of view of the artist setting up the palettes, both as I would see them and make sense of them in whatever art package or the like, but at the same time, making sure they're ready to be saved and output correctly for the SNES and how its palettes specifically work.

Hopefully what I'm asking here makes sense, because I can tell I've not said it in a particularly concise way.
Myself086
Posts: 158
Joined: Sat Nov 10, 2018 2:49 pm

Re: Space for 256-colour image plus second background?

Post by Myself086 »

Just use the same colors as your 256-color image and don't organize colors within the 256-color palette, your programmer will know what to do (if it's me). You're wasting too much time on details that can be automated. As I explained in a previous thread, scale your art down only when necessary rather than trying to match what the SNES will take, especially when you don't have a programmer. I hope I'm being clear.

Look at the mode 1 version of your image I posted, you don't need to be extremely precise about your colors. This is coming from a student programmer of mine. Something similar can be done with 8bpp.

Focus on making more assets, you can retouch this one later once you know exactly what needs to be removed.
iNCEPTIONAL

Re: Space for 256-colour image plus second background?

Post by iNCEPTIONAL »

Myself086 wrote: Thu Aug 04, 2022 1:12 pm Just use the same colors as your 256-color image and don't organize colors within the 256-color palette, your programmer will know what to do (if it's me). You're wasting too much time on details that can be automated. As I explained in a previous thread, scale your art down only when necessary rather than trying to match what the SNES will take, especially when you don't have a programmer. I hope I'm being clear.

Look at the mode 1 version of your image I posted, you don't need to be extremely precise about your colors. This is coming from a student programmer of mine. Something similar can be done with 8bpp.

Focus on making more assets, you can retouch this one later once you know exactly what needs to be removed.
Yeah, I expect you are correct on that.
Last edited by iNCEPTIONAL on Fri Aug 05, 2022 1:28 am, edited 1 time in total.
TrekkiesUnite118
Posts: 92
Joined: Fri Mar 08, 2013 5:56 pm

Re: Space for 256-colour image plus second background?

Post by TrekkiesUnite118 »

Not trying to be mean here but do you understand the actual math going on here and how everything relates to each other? The reason I ask is that it would probably be more worthwhile for you to have that explained to you if you don't understand it. That way you can do these kind of calculations yourself, and don't have to keep asking others "Will this fit in VRAM?" or "Is this too many tiles to transfer?". You could instead figure it out yourself.
Post Reply