What's new

The Mystery of the SM64 Portrait

Orkin

d1R3c764 & g1|\|64 m4|<3R
I've re-read the documentation, and I think I've finally figured it out!

Now, it may at first seem that you need to use area to calculate the LOD, but in fact you don't, I'll use the following as an example:

Say you have mip maps set up like this:
Tile 0: 32x32
Tile 1: 16x16
Tile 2: 8x8
Tile 3: 4x4
Tile 4: 2x2
Tile 5: 1x1

And you want to render a primitive (say a rectangle for now since the math is easier), with the following sizes:
Texture size = 32x32
On-screen size = 8x8

Let's first try calculating the LOD using area:

Texture area = 32 * 32 = 1024
Screen area = 8 * 8 = 64

LOD = Texture area / Screen area = 1024 / 64 = 16

And we select the tile to use based on the LOD:
LOD_tile = log2( (int)LOD ) = log2( 16 ) = 4

If the LOD_tile is 4, then tile 4 is used (assuming prim_tile is 0), but that is only 2x2, not the 8x8 we need.


Now let's try again by calculating the ratio between size, instead of area:
LOD = Texture size / Screen size = 32 / 8 = 4

LOD_tile = log2( (int)LOD ) = log2( 4 ) = 2

Now, with an LOD_tile of 2, we use tile 2 which is 8x8, the size we needed.

The LOD_fraction is computed like this:
LOD_frac = fraction( LOD / 2^LOD_tile ) // With fraction() returning the fractional part of the result

You may at first look at this and think "wait a second, since LOD_tile is log2( LOD ), the LOD_fraction will always end up being 0". Well, it is 0 if the screen size is exactly the same size as the mip map level, but, since the LOD_tile is truncated to an int, if the LOD is fractional, you will end up with a value that gives the amount to blend between the texture described by the tile at prim_tile + lod_tile, and the one described by the tile at prim_tile + lod_tile + 1.

I hope I explained it clearly enough, this is all based on what is stated in the N64 programming manual. There are other things to take into account such as which tiles to use when detail or sharpen modes are enabled. Plus, when sharpen mode is enabled, the LOD_fraction is negated so you end up doing extrapolation instead of interpolation (now that'll be fun to do in a combiner).

Orkin
 
Last edited:

Gonetz

Plugin Developer (GlideN64)
It seems that you have understood this chapter better then I :)
Your explanation looks very logical. It's time to try it :)
 

Zilla

&#22818;&#12434;&#35211;&#12425;&#12428;&#12383;
So in the SM64 ROM, is the picture/frame made of one or many polygons/vertexes, each with it's own texture-map?

[/out-my-depth...] :p
 
Last edited:

The Khan Artist

Warrior for God
Zilla said:
So in the SM64 ROM, is the picture/frame made of one or many polygons/vertexes, each with it's own texture-map?

[/out-my-depth...] :p

*Simplified mode engaged

Normally, each texture has several different sized versions, called mipmaps. Depending on the size of the area the texture will be displayed on, different mipmap levels are used. This was, if you are close to an object, a high-res image will be used, but when you are far from an object, a lower-res version will be used. This saves processing time. If trilinear filtering is enabled, in-between version will be created.

With the Bowser/Peach portrait, instead of two mipmap levels being simply different sizes, they are in fact different pictures. Peach is the higher (lower-res) mipmap level, and Bowser is the lower mipmap level. As you move closer to the portrait, Bowser slowly fades in.
 

Shin_Gouki

New member
Gonetz..Orkin may i ask :D
how is it going, implementaion?
(errh i mean can we expect the effect working on your next plugin-releases?)
did i mentioned that it was awesome to see here quite "live" the growth of an idea :)
i love the net for such possibilities ..its just great ^^
wbr Shin Gouki
 

gandalf

Member ready to help
Shin_Gouki said:
Gonetz..Orkin may i ask :D
how is it going, implementaion?
(errh i mean can we expect the effect working on your next plugin-releases?)
did i mentioned that it was awesome to see here quite "live" the growth of an idea :)
i love the net for such possibilities ..its just great ^^
wbr Shin Gouki

hehehe,i like to see full frame buffers support in both plug-ins!!!

Specially for Ridge Racer 64 (yeah,GLN64 makes perfect emulation of motion blur in this game!!!!!!!,only is missing the board like Mario Kart)
 

ggab

Emutalk Member
and now with your great Direct64 (where this effect works :) ),
is posible to implement it, in another plugin, like Rice & Gonetz ones?

PS: if you want, please send the source implementation to them (at least only the SM64 Portrait effect).
Thanks!!!
 

Top