IGNORED

# 3d perspective effect

## Recommended Posts

This isn't maybe directly a programming question so if it needs to be asked elsewhere just let me know. But how is the floor shifting perspective effect found in, for example, Kasumi Ninja accomplished? Is it an actual texture mapped 3d surface or is there some other trickery going on there?

If it isn't clear to what I'm referring, I mean how when you move the characters left or right, the perspective of the floor adjusts slightly with the movement.

##### Share on other sites

From what i remember :

For each line of the ground, a scaled object is modified by a GPU Object interrupt.

The GPU compute the Object X position, the start address of the texture and the scale to apply to draw the current (or next?) line.

##### Share on other sites

The Kasumi Ninja version of the fighter floor scroll technique is really ugly vs something like SFII. It looks ugly and mungy enough to be using the Jaguar's scaling. Oldskool way of just offsetting each line of a graphic that already has the perspective pre-baked so much cleaner.

• 4
• 1
##### Share on other sites

I did see/read something that said it's mostly a big trick. I originally assumed it was a scaled object per line or some such but saw recently that apparently the whole floor is drawn to the desired perspective, and wider than the whole screen. Then you simply scroll each line left or right by varying amounts.

So the line closest to the camera might move 10 pixels, the line furthest away might move 10/64 pixels. and each line in between a varying amount depending on size of distorted floor and desired depth. There is probably actual real maths involved and not fudge maths , but hopefully you get my meaning

##### Share on other sites

• 3 years later...

Why can I set the remainder only for y scale, but not for x ? Now for a clean street I need to do Greatest common divisor and have scaled object up to that point ( where the remainder is close to zero ). There start a new object. And I cannot even pull with px precision .. only phrase address. OP can only be used for vertical scaling -- in my book. Why does it then still run in pixel mode?

##### Share on other sites

You don't need a remainder value for X because it's "restored" on each scan line.

##### Share on other sites

The problem is that the remainder is restored to 0 . If you do any scaling, subpixel precision is a thing. I would want to have nice road borders .. all the texture should be nice. It should be possible to draw aligned edges in the textures and have them all look good. For SuperBurnOut. With the blitter you can do it. There is even space left in the phrases: 24-63 Unused write zeroes.

> 49-54 FIRSTPIX
So I could can display a partial first phrase of image data ( 16 colors 4 bit for example ). I guess I have to have everything also as a flipped version in memory to have pixel precision on both sides? How do you do transparency with CRY sprites?

Now here comes my spread sheet: Unreal had a scaling factor of 1.5 or so between mipmaps. MipMaps don't even use twice the memory. But what if we allow them to? We could store the LOD on top of each other: 16 + 8 + 4 + 2 < 32 . And the we use the full 16px width of our buffer to store intermediate horizontal scales. 16  8,7  6,4  3,2,1  . Since we work low precision in x direction because we cannot set the remainder, we can just as well check if we are close enough to some of the mip map scalings that we have less then one px size error. Vertically we can do small scalings by splitting the object. Horizontally we can split the object and draw one phrase overlap. For the second object we use FirstPIX to eat / duplicate the exact pixel we want.

Of course the highest detail map in  SuperBurnOut is drawn in pixel mode where a single px value is repeated many times.

Ah now I get it. You are supposed to use the blitter to flip obects in your texture atlas to end with a phrase aligned edge. If this does not help, move them and hope that they don't collide with other entries. This gets intersting when you use spans to carve out a CRY sprite ( and render the overhangs with 4 bit or so ).

In a racing game objects are mostly upright. Similar to the almost 1:1 scale with a slightly rotated sprite we will be in one row and then at some x with will switch into the next row. When we generate the playlist, we look how many objects are on a line, and then split them to get a predefined ( and tested ) amount of objects. Make GPU and blitter higher pririty so that they can nip at the memory inbetween all the objects which probably keep the OP occupied for the whole scanline.

Both object phrases are indeed read in one go. Then the OP like the Blitter seems to have two phrase registers to align them on one Destination. So we probably should stop subdivision at 2 phrases. Almost as one would have guessed it does not matter how complicated the px-shader is. Also MipMaps here are a clear winner because they don't get scaled down drastically. I would even say that for OP based graphics we need very high horizontal resolution to never lose info.

With CRY we might get prettier results if we mix two mip maps to get the correct average scaling. This may allow us to align to a phrase on the aft end better utilize the data from DRAM. Scaling artefacts are less visible.

If we subdivide in a lot of opaque spans anyway, we can render each side of the road front to back with a conservative coverage buffer. Bitmaps don't suit this well. So it x_positions and then a JOIN with the x positions from the scaler.

Edited by ArneCRosenfeldt
front to back to front

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.