[N-World Contents] [Book Contents] [Prev] [Next] [Index]

The VRAM Editor


N-Paints VRAM editor allows you to quickly and easily transform image files into .TIM files for use on the Sony Play Station. The VRAM Editor also provides a way for you to manage VRAM memory in the PlayStation, making the most of this platforms resources.


In this Chapter

In this chapter, we'll cover


What is the VRAM Editor?

The VRAM Editor performs two essential tasks:

You load images into the VRAM Editor, then use its features to ensure that these images are placed as efficiently as possible in VRAM. When you have placed your images in VRAM, you can save them out to TIM format.


Sony PlayStation (PSX) VRAM

The VRAM Editor Canvas is a graphical representation of the PlayStation's Video Ram.

Figure 8.1 The VRAM Editor Canvas

Display Area

The Display Area represents the VRAM occupied by the PSX's display buffers. Its dimensions reflect the horizontal and vertical resolution (in pixels) of images displayed on a TV by the PSX. Because the PSX uses double buffering, the display area represents the memory consumed by both the front and back buffers. Therefore, although the width of the display area reflects the horizontal resolution of displayed images, the actual vertical resolution of displayed images is half the vertical dimension of the display area.

Figure 8.2 Double Buffers in the Display Area

Changing the Size of the Display Area

To change the size of the display area, (CLICK-L) on the display area. The Resize Display Area pop-up menu appears.

Figure 8.3 The Resize Display Area pop-up menu

To choose a new value for width, (CLICK-L) on one of the button in the pop-up menu.

Image Tiles

Image tiles are representations of the TIM images themselves. The size of the tile in the VRAM Editor canvas is proportional to the amount of VRAM required to store the image. VRAM requirements are determined by two factors:

Color Depth, Image Size, and VRAM Requirements

PSX VRAM addresses are 16 bits in size. Thus, each pixel in a 16-bit image occupies an entire VRAM address, while two 8-bit pixels (or 4 4-bit pixels) can be accommodated in a single address. Thus, you can reduce the amount of VRAM space required to store an image by 50% by reducing color depth from 16 to 8 bits.

In much the same way, reducing the absolute number of pixels in an image (its linear dimensions) also reduces the amount of VRAM required to store it.

Note: Although you can reduce image dimensions using the VRAM Editor, this may result in unpredictable distortion. We recommend that your final images be 256x256 pixels or smaller before you bring them into the VRAM Editor.

Texture Pages

Texture pages are the logical divisions on the PSX's VRAM. A texture page consists of 16,384 VRAM addresses arranged in a 64x256 array. Each address in turn accommodates 16 bits.

Image Tile Placement Rules

Two rules govern the behavior of images stored in PSX texture pages.

The VRAM Editor will not allow you to place a tile in an illegal position. When you are moving tiles around on the VRAM Editor canvas, the border of the tile will change color to reflect the legality of the current position.

Figure 8.4 256 x 256 texture map. Left, legal placement; Right, illegal placement over portions of five pages

Color Lookup Tables (CLUTs)

16-bit images have direct color, meaning that color information for each pixel is stored with that pixel in each VRAM address. Color information for 4- and 8-bit images, however, is stored in a separate Color Lookup Table (CLUT). A CLUT is the reduced color-palette generated during the color reduction process. CLUTs must be stored in VRAM, usually in the area "beneath" the display buffers. However, you can store as many CLUTs as you have space in VRAM.


Workflow with the VRAM Editor

The VRAM canvas represents 1MB of VRAM. When you place tiles and CLUTs on the VRAM Canvas, you are creating a VRAM layout. A layout is nothing more than an index which shows the source images for each tile, their location in VRAM, and a few other parameters. Figure 8.5 is a schematic representation of workflow wi th the VRAM Editor.

Figure 8.5 Workflow with the VRAM Editor

Source Images are loaded into the VRAM Editor. Source Images can be full-color (16-bit), in which case there is no palette associated with them. However, color mapped images can also be loaded into the VRAM Editor. Color mapped images have an associated palette (CLUT), which contains color definitions. Many images can reference a single CLUT. You can create color mapped images from full color images using N-Paint's Color Reduction tool.

Once images are loaded into the VRAM Editor, you must place them onto the VRAM Canvas. For color mapped images, you must also place their associated CLUTs in VRAM. Once you've arranged the image tiles on the canvas, you must save the images to disk in TIM format. You must also save the VRAM configuration to disk if you want to use or edit it in the future. The VRAM configuration is saved to disk as a layout file. TIM images and layout files are saved to the same directory. A given directory can only contain a single layout.

Note: Because a directory can only contain a single layout file, it's a good idea to name your directories in a way which reflects the nature of the layout they contain, e.g., GameLevel1, GameLevel2, etc.

TIM files store their own addresses in VRAM as part of the file. They also keep track of which CLUT they are associated with and where it is stored in VRAM.

Using the VRAM Editor

You control the VRAM editor through the VRAM Editor menu:

Figure 8.6 The VRAM Editor menu

Images which have been loaded into the VRAM Editor are listed in the VRAM Editor menus. The name of the source image is listed in the leftmost field; the fields to the right show VRAM parameters such as size, color depth, location in VRAM, associated CLUT, etc. These are described in detail below.

The buttons and other controls on the right side of the VRAM Editor menu let you manage and manipulate image tiles. You'll use these commands to open image files, load them on to the VRAM Editor canvas, and control the manner in which they are positioned in VRAM. These commands are discussed in the next section.

Image Tile Parameters

The largest section of the VRAM Editor menu is devoted to displaying image source file names and their VRAM parameters.

Image Name

The Image Name field contain specifies the original source image for a tile.

Figure 8.7 VRAM Editor Image Operations pop-up menu

Note: You can (CLICK-R) on any image tile in the VRAM Editor canvas and get the same pop-up menu.

Size

The first size field in the tile parameters menu shows the size of the source image in bytes.

Palette Name

The name of the current palette associated with the image. When you load a color-mapped image, the associated palette is automatically loaded. When you load a full-color image, no palette is loaded.

Selecting Another Palette

You can assign another palette to an image, selecting from among those loaded into memory. For example, if you created a composite palette using Color Reduction, you'll want to make sure that all your TIM files which will be generated reference the same palette. To reference another palette:

Figure 8.8 Palette operations pop-up menu

Size

The second size field refers to the color-depth of the image (the number of bits used by each pixel to record color information).

Changing Bit Depth

If you wish to change the Bit Depth of an image, you must send the image to Color Reduction. To do so:

1. (CLICK-R) on the Image Name field.

2. (CLICK-L) on Color Reduction.

W/H

These values are the width and height of the TIM image. TIM images are limited to 256x256 pixels. If you attempt to load an image which is larger than this limit, the VRAM Editor will offer you the opportunity to reduce the image to the maximum allowable size:

Figure 8.9 Confirm auto-resize of source image

You can change the Width or Height of your images. To do so, (CLICK-L) on the Width or Height field and enter a new value.

Note: Use caution when changing image dimensions in this manner, as changes to the dimensions of your images might have unpredictable effects on the appearance of the image. You may wish to consider sending the image to the Paint canvas and using the Scale or Crop commands to change the dimensions of your images.

Location

The first VRAM address occupied by the image. VRAM addresses are specified as cartesian (X,Y) coordinates, beginning with (0.0) in the upper left hand corner of the VRAM Editor Canvas and extending to 1024x512 in the lower right hand corner.

Pal. Loc.

These values are the coordinates of the VRAM address for the CLUT associated with the image file.

Trans

When toggled on, this option instructs the PSX to display black backgrounds as transparent.

Lock

When a tile is locked, it's VRAM address cannot be changed, even when you use the Fit Tiles command.

Placed

When Placed is toggled, the image is placed on the VRAM canvas. Images appear on the canvas as image tiles. The area of a tile is directly proportional to the amount of VRAM it occupies.


Vram Editor File Operations

The VRAM Editor Canvas represents a single layout. A layout usually corresponds to a logical division in your game, such as a game level. From the perspective of the VRAM Editor, a layoutlayout is nothing more than a list of source images, their corresponding TIM files, and a few parameters. Once you have created a layout by loading and placing image tiles on the VRAM Canvas, you'll want to save this configuration to that you can work with it again. You can save layouts to disk as layout files. There can only be one layout file per directory. Layout files are always named VRAM.layout.

Specifying the TIM Directory

A given directory can only contain a single layout. You must select a directory to be the current TIM directory. A layout file and all TIM files are then written to this directory.

To specify the current directory:

Managing Images, TIM Files, and layouts

Loading images into the VRAM Editor is very similar to loading images anywhere else in N-Paint. Any images which you have loaded in other modules of N-Paint (such as Color Reduction or from the Tools Menu) are available for you to use in the VRAM Editor. You can also open image files directly from disk.

You manage images with the Image Operations menu. To see the Image Operations menu, (CLICK-L) on the file field.

Figure 8.10 VRAM Editor Library controls

Figure 8.11 The Save Many dialog box

You can change the name, directory, or file format of any of the images listed in the dialog.

Sort Images By

When you (CLICK-L) on this field, the Sort Method pop-up menu appears. (CLICK-L) on a method to select it and sort the images on the VRAM Editor menu.

Figure 8.12 Sort Method pop-up menu

Layout

The layout is the arrangement of TIM files in VRAM. You can save this arrangement to memory.

TIles

The three Tiles commands allow you to place image tiles on the canvas, and arrange them in the most compact arrangement possible using a best-fit algorithm.

Placing Tiles in VRAM

You can also place and unplace tiles with a (CLICK-L) on the Placed? toggle at the right end of the VRAM Editor menu.

Note: Placing a tile in VRAM toggles that tiles Placed field.

Removing Tiles from VRAM

Init.

(CLICK-L) on Init. to remove all tiles from the VRAM Editor. You might use Init. when you finish one layout and want to reset the VRAM Editor to begin working on another.

Note: Init not only removes tiles from the VRAM canvas, but also removes them from the VRAM Editor menu!

VRAM Editor Setup Parmeters

The following parameters can be modified in the N-Paint Setup menu. To reach the Setup menu, (CLICK-L) on the Setup button in the N-Paint modes bar.

Stop at failure?

When this option is toggled, the VRAM Editor will return an error message when it is unable to place a tile using the Best Fit algorithm. Otherwise, the offending tile will not be placed, but no error message will appear.

Use Dos filename?

When this option is toggled, TIM file names are truncated to eight characters in accordance with DOS file name requirements. For example, CharacterSprite.lbm will end up as Characte.TIM.



[N-World Contents] [Book Contents] [Prev] [Next] [Index]

Another fine product from Nichimen documentation!

Copyright © 1996, Nichimen Graphics Corporation. All rights reserved.