Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macross water animation problem #5559

Closed
LunaMoo opened this issue Feb 24, 2014 · 23 comments
Closed

Macross water animation problem #5559

LunaMoo opened this issue Feb 24, 2014 · 23 comments

Comments

@LunaMoo
Copy link
Collaborator

LunaMoo commented Feb 24, 2014

Another one about Macross ~
Water animation is just choppy in all 3 macross games it seems to change texture once every exactly 10 frames and it seems to show single texture which seems to be additionally incorrect.

My thought on how it tries to work:
The game is running at 30fps and there are 3 water textures, I don't understand all it tries to do, but the order of the 3 water textures does change every 10 frames by looking at GE debugger and it probably should blend/mix them to give a nice smooth water animation. In ppsspp the first texture is clearly visible, the other two which are processed after never affect the screen in any way until their turn comes after 10 frames.

Tried all hacks and optional settings for it from the graphics tab, nothing seems to affect it, including software renderer.

Not sure if this is related, but before v0.9.7.1-37-g9c4d946(Detect bad mipmap sizes, autogen mipmaps in this case.), we had to disable mipmaps to even see the water, it's animation was always choppy like that through.

Here are the pictures of the 3 water textures in GE debugger, the first one is the one ending up visible on the screen with the second one, if you look at the 3rd one it should be affected by the second texture already, but still shows only the first one.

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Feb 24, 2014

macross water anim1
macross water anim2
macross water anim3

@dbz400
Copy link
Contributor

dbz400 commented Apr 4, 2014

Any savestate can share here to reproduce ?

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Apr 4, 2014

Sure, here's one from Macross Triangle Frontier:
https://www.mediafire.com/?42269lvhmt17q30
The problem is same for two other macross games, enough to just load any stage with water in any mode.

Also here's a youtube movie which shows the animation on psp:
https://www.youtube.com/watch?v=KOSdZW_ZUx0
compression kinds of kills it, althrough it is visible at 4:25 after the mission ends and the player lands in water.

@dbz400
Copy link
Contributor

dbz400 commented Apr 4, 2014

Thanks .I think you means the smoothness of the water in-game here?
npjh50050_00000

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Apr 4, 2014

Yeah, it should kind of blend between 3 different water textures to create a smooth animation, instead it's refreshing every 10 frames swapping one of the 3 textures at the top, creating choppy animation.

@dbz400
Copy link
Contributor

dbz400 commented Apr 4, 2014

Not too sure if this is related as seldom see game use tex lod slope

46:39:196 user_main W[G3D]: GLES\GLES_GPU.cpp:1591 Unsupported texture level bias settings: 000002
46:39:196 user_main W[G3D]: GLES\GLES_GPU.cpp:1582 Unsupported texture lod slope: 3aaec3

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Apr 4, 2014

I think both tex level bias and lod slope are just used to blur/sharpen textures, maybe it could overally improve graphics, but not sure if it is related to animation. the same settings are used for other things, like interface or VF textures.

@unknownbrackets
Copy link
Collaborator

If you double click on "Texture L1 addr" copy the value, cancel, and then double click L0 and paste, OK, you should see the other texture level. Does it look different?

Is the bias / slope value changing as it renders (the 10 frames)? I think you're saying no, and they're static, right?

Is it using any alpha blending? Seeing the flags and settings tabs would help.

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 15, 2014

When I copy L1 address to L0 and then click step into to refresh texture preview it shows different texture.

Tex level/bias 000002
Tex lod slope 3aaec3
^ are always the same

Here are the settings:

Name Value
Clear mode 0
Framebuffer 00000000, w=512
Framebuffer format 5551
Depthbuffer 00088000, w=512
Vertex type u16 texcoords, ABGR 8888 colors, s8 normals, float positions
Offset addr 09000000
Vertex addr 0942f0a8
Index addr 040f3ba8
Region 0,0 - 479,271
Scissor 0,0 - 479,271
Min Z 000100
Max Z 00feff
Viewport 1 240.000000, -136.000000, -32511.500000
Viewport 2 2048.000000, 2048.000000, 32767.500000
Offset 1808.000000x1912.000000
Cull mode 0
Color test pass if (c & 000000) NEVER (000000 & 000000) (disabled)
Alpha test pass if (a & ff) > (00 & ff)
Stencil test pass if (ff & ff) ALWAYS (a & ff) (disabled)
Stencil test op fail=KEEP, pass/depthfail=KEEP, pass=KEEP (disabled)
Depth test pass if src >= dst
Alpha blend mode add: src.a, 1.0 - src.a
Blend color A ffffff
Blend color B ffffff
Logic Op clear (disabled)
Fog 1 7267.125000
Fog 2 0.000315
Fog color ccccb7
RGB mask 000000
Stencil/alpha mask 000000
Morph Weight 0 0.000000
Morph Weight 1 0.000000
Morph Weight 2 0.000000
Morph Weight 3 0.000000
Morph Weight 4 0.000000
Morph Weight 5 0.000000
Morph Weight 6 0.000000
Morph Weight 7 0.000000
Patch division 001010
Patch primitive 000000
Patch facing 000001
Dither 0 002f1e
Dither 1 0001f0
Dither 2 001e2f
Dither 3 00f001
Transfer src 04000000, w=512
Transfer src pos 0,0
Transfer dst 04044000, w=512
Transfer dst pos 0,0
Transfer size 479,271

and flags:

Name Value
Lighting enable 1
Light 0 enable 1
Light 1 enable 1
Light 2 enable 0
Light 3 enable 0
Clip enable 1
Cullface enable 1
Texture map enable 1
Fog enable 1
Dither enable 1
Alpha blend enable 1
Alpha test enable 1
Depth test enable 1
Stencil test enable 0
Antialias enable 0
Patch cull enable 0
Color test enable 0
Logic op enable 0
Depth write disable 0

So I guess it does use alpha blending.

@unknownbrackets
Copy link
Collaborator

Hmm, but it uses it in a pretty standard way. Does the L1 texture change each frame, or does it match the L0 texture?

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 15, 2014

From what I'm checking now the L0 actually never changes, L1 texture does change once every 10 frames and that's the one visible. Edit to be clear: and L1 never looks same as L0.

I think it should do something like:
starts as fully visible L0, 5 frames blends with L1 making L1 the fully visible and then going back 5 frames to make L0 fully visible again then repeats with different texture L1 and so on to create kind of water glitter, but for whatever reason it just shows L1 texture all the time and doesn't use L0 texture for anything.

My first post in this issue kind of describes it differently, because now I check it at the ocean where water texture is like 3 clicks away, seems to be much less confusing to check, the other stage with water(there are only 2 of them :]) had to click through xxx terrain textures and is actually a river that's why it has 3 different textures that swap places ~ moving animation. Wouldn't even know about L1 texture if you wouldn't told me to change L0 address to the one from L1. :o

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 15, 2014

@unknownbrackets not sure if this means anything, but tried the new feature to change level in the texture preview and while it works in v0.9.8-1218-g07b13f6 which allows me to change between L0 and L1 in this game, it's grayed out in v0.9.8-1219-gf664979.
Does it mean that the game does something weird, or the new feature got broken accidently?

Here's a texture tab:
Name Value
Tex U scale 12.273682
Tex V scale 8.500000
Tex U offset 0.000000
Tex V offset 0.000000
Tex mapping mode gen: tex coords, proj: uv
Tex shade srcs 000000
Tex mode swizzled, 1 levels
Tex format CLUT4
Tex filtering min: linear, mipmap linear, mag: linear
Tex wrapping wrap s, wrap t
Tex level/bias 000002
Tex lod slope 3aaec3
Tex func modulate, RGBA
Tex env color 000000
CLUT 04119e80, w=0
CLUT format ABGR 8888 ind & ff
Texture L0 addr 04111e80, w=64
Texture L1 addr 04113e80, w=64
Texture L2 addr 00000000, w=0
Texture L3 addr 00000000, w=0
Texture L4 addr 00000000, w=0
Texture L5 addr 00000000, w=0
Texture L6 addr 00000000, w=0
Texture L7 addr 00000000, w=0
Texture L0 size 64x128
Texture L1 size 64x128
Texture L2 size 1x1
Texture L3 size 1x1
Texture L4 size 1x1
Texture L5 size 1x1
Texture L6 size 1x1
Texture L7 size 1x1

Hmmm does: "Tex mode swizzled, 1 levels" does that mean it should mix those textures and show as 1 or something? Maybe that's why it doesn't work.

@unknownbrackets
Copy link
Collaborator

Ah, "Tex mode swizzled, 1 levels" means only one level is valid (according to the game), or else that we don't understand that setting properly. Maybe these settings override that:

Tex level/bias 000002
Tex lod slope 3aaec3

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 15, 2014

So basically "swizzled" part might be working incorrectly and that could be the whole issue here? As "1 levels" and tex level set to 2 makes it exactly what happens now = displaying only L1 texture.

Trying to understand what swizzling textures even is by google, but this seems some hardcore stuff;p.

Still is it a bug with your recent change "Respect max texture level in GE debugger preview." that this feature doesn't allow changing levels anymore?
bug or not
It allowed to see both L0 and L1 before that commit.
worked before

@unknownbrackets
Copy link
Collaborator

No, I'm sure that swizzling is fine, unless it toggles the swizzling. We might not check that.

I meant the "1 levels" means that the second level is theoretically not valid. For example, some games set multiple levels for draw A, and then don't bother to unset the other levels for draw B (just setting max levels = 1.)

My recent change made the "Level +" button support this feature. Before, in Tactics Ogre for example, you'd see a completely unrelated texture as the second level for almost everything. It did what I described above.

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jun 15, 2014

Ah ok, I now see some other textures in macross also show completely unrelated L1 like mech texture showing black water as second level, it just accidently makes this one water texture easier to check.

It's really hard to recognize the water texture in game vs the texture preview - kind of impossible for me. I was assuming the game shows only L1 textures, since it changes every 10 frames just as in-game, however it could as well be L0+L1 swizzled together(?) which would also be a visible change every 10 frames.

Well how the game changes that 3fps animation into nicely animated water remains a mystery. Don't really know how to check if the game toggles the swizzling. I found 2 unknown commands in the display list between light commands:
833ba3d7: Light 2 Z att: 0.005000
893f0000: Unknown: 893f0000
8d000000: Unknown: 8d000000
75bea40d: Light 2 X dir: -0.320412
which step into goes through while processing the water texture, but I don't really see it changing between different frames, so not sure if this is related.

@hrydgard
Copy link
Owner

I find it unlikely that texlevel/bias would override the main "number of levels" setting, that one should be a hard limit of the amount of texture data present..

@unknownbrackets
Copy link
Collaborator

Has this changed at all with the depth changes? Does it draw the water in multiple passes at all, or does it ever draw any part of the water with multiple mip levels?

The unknown commands may likely not be commands; often, data is "interleaved" into the display list, and JUMP commands are used to skip it. The debugger will try to convert the data into commands.

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jan 24, 2016

This game suffers from 2 opened issues so I check it pretty often, but nothing really affected either of those issues yet.

Not sure if it's the exact same place I checked last time, but when drawing water GE now shows Tex mode as swizzled, 2 levels, CLUT per level when earlier it was having 2 levels, but mode was saying swizzled, 1 levels - so maybe that changed, however it does look exactly same as before in-game and just changes all water textures every 10 frames resulting in 3fps animation.
I can also see now both levels change every 10 frames not just one, through one of them is always similar as it has to be for animation smoothness so maybe I just couldn't tell the difference previously from staring at it for too long.

Copy of ge debugger tabs - https://gist.github.com/LunaMoo/f85e88ee8ff515332d55

When going step by step all the way, it does seem to do another pass on most of the water without doing any changes to the settings, but then something weird seems to happen as when you expect the closer things to get it's second pass it changes tex mode to swizzled, 1 levels and tex level/bias to slope + bias: 0.000000, and does say it draws things and shows selection on the texture itself but no selection is visible anywhere on the scene. Then it can return back to previous settings to draw some very distant water and while it was very microscopic I could see selection there at least as a few pixel dark line which makes me think the weird thing that's drawn earlier is completely out of the scene and potentially is what's missing here.

I'm thinking maybe the effect actually works, but the distance is messing it up, I mean this game also suffers from #5549 which is messing vertices of some animations where they are drawn much closer to the camera than they should be resulting in stuff like big arms or transformation/some attacks covering up whole screen, possibly even going behind it. Maybe the water animation get's "behind" the camera or the opposite soo distant that doesn't even show selection on the scene.

@unknownbrackets
Copy link
Collaborator

It uses slope bias? What is the Tex lod slope 0.001333 value in that case?

Would be nice to see if the bias (from pass 1) or the slope (from pass 2) change each frame. If so, both effects could create an animation. Since both texture levels have the same size, we don't implement either one here.

Tactics Ogre, this game, and #6357 AFAIK all suffer from the issue of using miplevels as separate texture units.

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jan 24, 2016

Tex lod slope is same always(well in this scene) 0.001333. When Tex level/bias shows bias the value seems to increase every frame ie bias: 0.687500 then next frame bias: 0.750000, edit: then after 0.875 returns to start from 0 again.

@unknownbrackets
Copy link
Collaborator

Yeah, then that's exactly the same thing as #6357. That would make the water appear to animate, because min: linear, mipmap linear, mag: linear would cause us to interpolate between the two by the bias (if it were implemented.) So the first frame it would have 68.75% of level 2, and the next 75%.

The reason it changes abruptly every 10 frames is because that's when it switches to the next two mip levels, and starts the bias back at 0.

-[Unknown]

@LunaMoo
Copy link
Collaborator Author

LunaMoo commented Jan 24, 2016

Oh, cool at least it's not a mystery anymore, I think I will just close this in favor of the other one which has a demo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants