Gonetz
Plugin Developer (GlideN64)
I have a question for developers.
I want to implement so called "implement clear" framebuffer feature.
In PJ64 User Manual it is explained as
"This is a framebuffer control. Some games use low level framebuffer clears for special effects.
A classic example is the lens flare from the sun in Zelda."
This explanation gives me no idea how it works. What does it means, "low level framebuffer clears"?
Is it not an ucode command? And how clearing frame buffer can make objects appear?
I've made my own investigation. There is one place in the first dungeon of Zelda OOT, with 2 torches, and when you stand in some place, flame corona appears, but only for one torch (see the picture).
Jobo's plugin works the same with "emulate clear" set off. When I set it on, coronas appeared for both torches.
I have logged this frame, and I found that for second torch, which is without corona, model matrix is zero:
00187698 (c0:da380003, c1:801864b8): uc2:matrix
modelview load
{0.000000,0.000000,0.000000,0.000000}
{0.000000,0.000000,0.000000,0.000000}
{0.000000,0.000000,0.000000,0.000000}
{-208.000000,-841.000000,995.000000,1.000000}
.......
00290e78 (c0:01004008, c1:040156e0): uc2:vertex n: 4, v0: 0, from: 00290df0
v0 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 64.000000, v: 0.000000
v1 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 0.000000, v: 0.000000
v2 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 0.000000, v: 64.000000
v3 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 64.000000, v: 64.000000
While for the first torch model matrix was
00187680 (c0:da380003, c1:801864f8): uc2:matrix
modelview load
{0.103989,0.000000,0.000000,0.000000}
{0.000000,0.103989,0.000000,0.000000}
{0.000000,0.000000,0.103989,0.000000}
{-281.000000,-810.000000,881.000000,1.000000}
And vertices have correct coordinates.
So, Jabo probably supplies correct model matrix for second torch when "emulate clear" is on, but how he did it?
Second effect, "lens flare from the sun".
The situation is different. All polygons for lens flare are present and on its places, all textures loaded correctly, but it has color combiner PRIM and alpha combiner TEXTURE*PRIM_ALPHA, and PRIM_ALPHA is always 0, so all polygons are invisible. With "emulate clear" on, Jabo's plugin has 1 additional screen-size rectangle, which looks like a fillrect. I don't know what it doing, but lens flare polygons become visible.
Has anybody an idea, how it really works?
I want to implement so called "implement clear" framebuffer feature.
In PJ64 User Manual it is explained as
"This is a framebuffer control. Some games use low level framebuffer clears for special effects.
A classic example is the lens flare from the sun in Zelda."
This explanation gives me no idea how it works. What does it means, "low level framebuffer clears"?
Is it not an ucode command? And how clearing frame buffer can make objects appear?
I've made my own investigation. There is one place in the first dungeon of Zelda OOT, with 2 torches, and when you stand in some place, flame corona appears, but only for one torch (see the picture).
Jobo's plugin works the same with "emulate clear" set off. When I set it on, coronas appeared for both torches.
I have logged this frame, and I found that for second torch, which is without corona, model matrix is zero:
00187698 (c0:da380003, c1:801864b8): uc2:matrix
modelview load
{0.000000,0.000000,0.000000,0.000000}
{0.000000,0.000000,0.000000,0.000000}
{0.000000,0.000000,0.000000,0.000000}
{-208.000000,-841.000000,995.000000,1.000000}
.......
00290e78 (c0:01004008, c1:040156e0): uc2:vertex n: 4, v0: 0, from: 00290df0
v0 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 64.000000, v: 0.000000
v1 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 0.000000, v: 0.000000
v2 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 0.000000, v: 64.000000
v3 - x: -0.982850, y: 4.363775, z: 137.234406, w: 156.501282, u: 64.000000, v: 64.000000
While for the first torch model matrix was
00187680 (c0:da380003, c1:801864f8): uc2:matrix
modelview load
{0.103989,0.000000,0.000000,0.000000}
{0.000000,0.103989,0.000000,0.000000}
{0.000000,0.000000,0.103989,0.000000}
{-281.000000,-810.000000,881.000000,1.000000}
And vertices have correct coordinates.
So, Jabo probably supplies correct model matrix for second torch when "emulate clear" is on, but how he did it?
Second effect, "lens flare from the sun".
The situation is different. All polygons for lens flare are present and on its places, all textures loaded correctly, but it has color combiner PRIM and alpha combiner TEXTURE*PRIM_ALPHA, and PRIM_ALPHA is always 0, so all polygons are invisible. With "emulate clear" on, Jabo's plugin has 1 additional screen-size rectangle, which looks like a fillrect. I don't know what it doing, but lens flare polygons become visible.
Has anybody an idea, how it really works?