Questions on graphical capabilities

For anything related to VDP (plane, color, sprite, tiles)

Moderators: BigEvilCorporation, Mask of Destiny

Post Reply
Trihook
Newbie
Posts: 5
Joined: Sun May 01, 2016 7:22 am

Questions on graphical capabilities

Post by Trihook » Mon May 09, 2016 9:18 pm

Hello, I am new here!

I'm an artist, and recently I tried to make graphics for a computer game, and decided I'd do it following the capabilities of my favorite console. This is where things get tricky. I was hoping if some of you can help me to clear up some difficulties that I ran into. If I happen to get enough information, I will cross post the essentials here too: http://pixelation.org/index.php?topic=1 ... #msg115062

Please bear in mind my point of view here, I'm not a coder but an artist. Also this is only referencing the genny, not the cd or 32x addons.

320px mode:
resolution - 320x224
sprite pixels per scanline - 320

256px mode:
Resolution - 256x224
sprite pixels per scanline - 256

Palette: 512 colors https://en.wikipedia.org/wiki/List_of_m ... #9-bit_RGB
4x16 palettes available
1 palette for BG layer A
1 palette for BG layer B
2 palettes for sprites
index 0 of each palette is the transparent color.

BG layers scrolling:
horizontally per scanline (1 px) or tile (8px)
vertically in 2 tile increments (16 px)

Layering:
BG layers A and B can have a priority flag set/unset thus can be displayed behind/infront of each other per tile basis. Sprites have this flag also, but a lowest priority sprite will still be displayed over the lowest priority BG layer. (not sure about this last one)

GFX storage: (found somewhere on the forums)
system tiles = 0x0000 (16 plain tiles used which can be used for fast fill operation)
user tiles = 0x0200 (1296 tiles)
font tiles = 96 tiles = window map address - 0x0C00
window map = 0xB000
H scroll table = 0xB800
Sprite table = 0xBC00
B Plan map= 0xC000
A Plan map = 0xE000

Extra features:
shadow and highlight mode
interlace mode 2

Notes:
TV viewable area is slightly smaller due to PAL/NTSC and different TV manufacturers. Safe bet is to not use the top and bottom tile rows for anything vital, and not use the first and last two tile columns for anything vital.

---

Questions:
Sprites
What are sprite sizes?
Is it allowed to mix sprite sizes?
How many sprites and of what size are allowed on screen at once? (without multiplexing)

Resolutions
What are the limitations and considerations of interlace mode 2?
How does interlace mode 2 affect other graphics like sprites and the window plane?
What other modes are available for the system?

Scrolling
How costly is to use scrolling effects, and how costly is to have large 8 way directional scrolling maps?

GFX storage
How configurable is the VDP ram for gfx storage?
Are system tiles are always full color tiles, and if not, how else can they be used?
How much space is there for tiles for the window layers and sprites?
How costly is to load new tiles for animation and such purposes?
How costly is to load new plan map data to get larger non repeating maps?

Shadow and highlight mode
How does this actually work?
How costly is to use shadow and highlight?
Does it work per tile or pixel basis?
Does it affect sprites, and in what way?

Misc
In case of TV signal moving the picture what is the color that is shown beyond the renderable resolution?
Is this "border" color editable?
Do sprites render off screen or do they pop in when their mid point reaches the renderable area?
What is the color that is used if all pixels on a certain part of the screen use the 0 index (transparent color) and is it editable?
What are some common cartridge memory sizes and how does this translate to available memory for gfx?
I an ordinary game, how much of the cartridge size is used for sound/gfx/code?

If I made any mistakes, please correct my ignorance. If I forgot to ask anything that affects graphics, and you think it would help, please do write it down, or point me with a link. I tried gathering as much data as I could, but no one is perfect and the gaps in my knowledge of the system graphical capabilities is very large.

Thanks!

BTW, if you are bored by all this text, please click and see some of my art:

http://s32.postimg.org/vwuutxqf9/image.png
http://s32.postimg.org/x16jgcjd1/all.png
http://s32.postimg.org/buuv9p8g5/shump.png
http://s32.postimg.org/sdnnzn285/Copy_of_Flips.png
http://s32.postimg.org/8si15sa9x/Copy_of_minimap.png
http://s32.postimg.org/3yha42z29/image.png
http://s32.postimg.org/47jwr4i6d/PC_BG_2.png
http://s32.postimg.org/vai1lwr2d/image.png
http://i.imgur.com/20eqjKb.png

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Re: Questions on graphical capabilities

Post by Mask of Destiny » Mon May 09, 2016 10:59 pm

Trihook wrote: GFX storage: (found somewhere on the forums)
system tiles = 0x0000 (16 plain tiles used which can be used for fast fill operation)
user tiles = 0x0200 (1296 tiles)
font tiles = 96 tiles = window map address - 0x0C00
window map = 0xB000
H scroll table = 0xB800
Sprite table = 0xBC00
B Plan map= 0xC000
A Plan map = 0xE000
All of those addresses are configurable and the exact amount of space available for tiles depends on how you organize things and what size certain tables are configured for.
Trihook wrote:What are sprite sizes?
8-32 pixels in 8-pixel increments.
Trihook wrote:Is it allowed to mix sprite sizes?
Yes.
Trihook wrote:How many sprites and of what size are allowed on screen at once? (without multiplexing)
In H40 mode (that's the 320 pixel wide one), you can display 80 sprites per frame. On any give line you have a limit of 20 sprites and 320 sprite pixels (including transparent ones). In H32 mode, these limits are reduced to 64 sprites per frame, 16 sprites and 256 sprite pixels per line.
Trihook wrote:What are the limitations and considerations of interlace mode 2?
You need twice as much VRAM for tiles (since the vertical resolution is doubled) and your pixels aren't square anymore.
Trihook wrote:How does interlace mode 2 affect other graphics like sprites and the window plane?
All tiles (including sprite tiles) have double the vertical resolution. The sprite coordinate system is doubled in the y direction to account for the extra resolution.
Trihook wrote:What other modes are available for the system?
There's Mode 4, but that's really only there for compatibility with the Master System. There's no reason to use it in a Genesis/Megadrive game as it is strictly inferior to Mode 5 (the normal mode). Modes 0-3 don't exist on the Genesis/MD.
Trihook wrote:How costly is to use scrolling effects, and how costly is to have large 8 way directional scrolling maps?
There's support for hardware scrolling for both Plane A and B. maximum size in any direction is 128 cells, but there's also a restriction on the maximum table size so you can't have a 128x128 plane or 128x64 plane. If you want to have a larger scrolling area, you need to update the appropriate name table. This is not a huge deal since you have about 7.5KB of DMA bandwidth per frame to work with.
Trihook wrote:How configurable is the VDP ram for gfx storage?
Very configurable. Tiles can live at any address in VRAM (well any 32-byte aligned address anyway) and the various tables can be moved around with a great deal of flexibility.
Trihook wrote:Are system tiles are always full color tiles, and if not, how else can they be used?
Tiles are always 4bpp indexed. What those indices correspond to depends on what is in CRAM.
Trihook wrote:How much space is there for tiles for the window layers and sprites?
If VRAM was used entirely for tiles you could store 2048 of them in VRAM.
Trihook wrote:How costly is to load new tiles for animation and such purposes?
Each tile is 32 bytes and you have roughly 7.5KB of DMA bandwidth per frame. Keep in mind that there is a setup cost to each transfer as well so if you're doing a bunch of small updates you have less effective capacity than one big one.
Trihook wrote:How costly is to load new plan map data to get larger non repeating maps?
Plane name table data effectively shares DMA budget with tile updates. Each entry in the name table is 2 bytes.
Trihook wrote:Shadow and highlight mode
How does this actually work?
How costly is to use shadow and highlight?
Does it work per tile or pixel basis?
Does it affect sprites, and in what way?
This mode is kind of a mess. Essentially, tiles are either "shadowed" or "normal" based on whether or not their priority bit is set. Note that a transparent high priority pixel can make the opaque low-priority pixel below it "normal" rather than shadowed. On top of this, sprite colors $3E and $3F will modify the shadow highlight state of the pixels below them rather than displaying as normal, allowing you to set shadow or highlight status on a per-pixel basis. There are 15 distinct voltage levels for each channel. Normal mode maps the 8 values evenly over this range. Shadow scrunches them down to the bottom half and highlight pushes them up to the top half. There is exactly one level that overlaps between shadow and highlight.
Trihook wrote: In case of TV signal moving the picture what is the color that is shown beyond the renderable resolution?
Is this "border" color editable?
The background color is displayed in the border area and is taken from a CRAM (or palette if you prefer) entry. Any CRAM entry can be used, including the ones that are normally used for transparency.
Trihook wrote:Do sprites render off screen or do they pop in when their mid point reaches the renderable area?
Sprites can be partially offscreen. Only the onscreen portion of the sprite is rendered though.
Trihook wrote:What is the color that is used if all pixels on a certain part of the screen use the 0 index (transparent color) and is it editable?
Same color as the border.
Trihook wrote:What are some common cartridge memory sizes and how does this translate to available memory for gfx?
Most games range from 512KB to 4MB. I believe the smallest game released in cartridge format is 128KB and the largest officially licensed game was 5MB (Super Street Fighter 2). The largest commercially released game is 8MB (Pier Solar) If you dedicated the entirety of a 4MB cartridge to tile data it would hold 131072 tiles (though obviously you need to save space for other things).
Trihook wrote:I an ordinary game, how much of the cartridge size is used for sound/gfx/code?
No idea on the exact proportions, but tile data is almost certainly going to be the biggest category for a normal game. Most sound data tends to be fairly small, but samples can get big if you have a lot of them.

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Questions on graphical capabilities

Post by Sik » Tue May 10, 2016 2:22 am

Trihook wrote:1 palette for BG layer A
1 palette for BG layer B
2 palettes for sprites
No, not at all. All four palettes can be used for everything at any time. (the BG layers can have it set per tile, the sprite layer has it set per sprite)
Sik is pronounced as "seek", not as "sick".

Trihook
Newbie
Posts: 5
Joined: Sun May 01, 2016 7:22 am

Re: Questions on graphical capabilities

Post by Trihook » Wed May 11, 2016 8:13 am

Thanks for the help!

To get this straight, the border color can be any color defined in the Color RAM, but does that mean it can be outside the 4 palettes? Basically, there is 4x15 colors + 4 transparent ones, AND then the border color which is defined outside these palettes, or does the border color have to be one of the colors in the palettes? Also, if, as yo say, the border color can be transparent, what is displayed in this case? Black?

I also forgot to ask about raster splits. I know the console can do one, which means, a palette (or more?) can be swapped on a certain raster line. This produces artifacts, so it is usually masked by a row of sprites. How costly and how hard to code is a raster split, how many raster splits are possible, and how many are normally doable? If the raster split is masked by sprites, meaning it has to be a full 320px/256px of sprites, does that mean a multiplexer is in order so other sprites have to cross the rastersplit so they don't dissapear? Is it possible to combine a normal mode and the interlace mode mid-screen doing a rastersplit?

Sik
Very interested
Posts: 939
Joined: Thu Apr 10, 2008 3:03 pm
Contact:

Re: Questions on graphical capabilities

Post by Sik » Wed May 11, 2016 8:22 am

The border color has to be one from the palettes, period. The only difference is that it can be one of the transparent colors (only way to display one of them), and usually that is the case. This is the color that gets displayed where there's a pixel that isn't covered by anything, as well (i.e. the background color).
Trihook wrote:If the raster split is masked by sprites, meaning it has to be a full 320px/256px of sprites, does that mean a multiplexer is in order so other sprites have to cross the rastersplit so they don't dissapear?
Look at Sonic 1. Pause the game and you'll see only half the line is covered in sprites (this is why it flickers: so it can get away with only showing half the sprites for water each frame).
Sik is pronounced as "seek", not as "sick".

Mask of Destiny
Very interested
Posts: 615
Joined: Thu Nov 30, 2006 6:30 am

Re: Questions on graphical capabilities

Post by Mask of Destiny » Wed May 11, 2016 5:20 pm

Trihook wrote:I know the console can do one, which means, a palette (or more?) can be swapped on a certain raster line. This produces artifacts, so it is usually masked by a row of sprites.
It produces artifacts if you let CRAM updates spill into the active display period. The VDP is busy for the vast majority of a line, including most of hblank. This means that if you transfer a full palette worth of colors they'll be spread throughout the line. CRAM updates conflict with CRAM reads which causes the color being written to be displayed rather than the color that would normally be shown. If you instead disable the display during hblank, you can get all of your transfer done outside of the active period (though 16 colors per line is problematic without polling the HV counter). The downside of this is that it reduces your sprite capacity for those lines.
Trihook wrote:How costly and how hard to code is a raster split,
Really depends on what you're trying to do. Simple ones are easy to write and not terribly expensive (though interrupts on the 68K are kind of expensive generally).
Trihook wrote:how many raster splits are possible,
You can have one every line if you like.
Trihook wrote:and how many are normally doable?
Depends on complexity and what else you have going on. Doing a background color gradient will involve one split per background color and show up in some games. More complicated splits generally only happen once or twice per frame. The moose chase level in Mickey Mania does some kind of raster effect on a bunch of lines (never really looked into what, probably scroll values, but that's just a guess).
Trihook wrote:Is it possible to combine a normal mode and the interlace mode mid-screen doing a rastersplit?
Nope. The interlace mode bits are latched outside of the active display period and even if they weren't you can't really construct a video signal that mixes progressive and interlace content. It is possible to switch between H32 and H40 mode, but it's messy to do without screwing up the video timing.

Trihook
Newbie
Posts: 5
Joined: Sun May 01, 2016 7:22 am

Re: Questions on graphical capabilities

Post by Trihook » Thu May 12, 2016 8:31 am

Thanks a bunch, both of you! =D

Post Reply