Thursday, 15 October 2009

Atari Jaguar Homebrew - Gouraud Shading (TECHNICAL)

The Atari Jaguar Blitter has rather a lot of facilities for Gouraud shading.

One question that sometimes arises is how is the data setup up for the intensity. In the blitter one should consider a pixel as 32 bit for calculation of which only the top 16bits are written out to the screen data
  • 8bits - colour
  • 8bits - integer intensity
  • 16bits - fraction of intensity.
Thus the pixel is 8bit colour 8.16bit intensity.

The main registers of interest are
B_Iinc - $f02270 - this 32bit register contains the amount each pixel is incremented by on every inner loop (*4 if in phrase mode)

Source Data - $f02240 - this is two 32bit registers containing the four fractional parts of the intensity i.e. 16bits of pixel one.16bits of pixel two in $f02240 and similarly for pixels three and four in $f02244.

Pattern Data - $f02268 - this is also two 32bit registers, they contain the top 16bits of each pixel, i.e. 8 bits of colour and the 8 integer bits of intensity.

Now if one has calculated the colour and intensity it can be quite awkward and time consuming to separate the top 16bits off to one set of registers and the lower 16bits off to another.

The Jaguar therefore has another set of registers
B_I0,1,2,3 These are an alternative method to specify the intensity and simplify its use by each referring to a pixel on its own.

B_I0 - $f0227c - a 32bit register of the form 8bit unused then 8.16 intensity.

This therefore allows the coder to set up the colour at the start of the polygon, then define the intensity anew for each of the 4 pixels of the first phrase at the start of each line without having to split off the fractional and integer parts.

Next time I shall try to get back onto the Lay off the 68k and GPU in main questions as initially intended.

Cheers,
Joe (Atari Owl)

No comments:

Post a Comment