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

Spline/Bezier #660

Closed
hrydgard opened this issue Feb 11, 2013 · 77 comments

Comments

Projects
None yet
@hrydgard
Copy link
Owner

commented Feb 11, 2013

PSP has some hardware to tesselate (turn into triangles) bezier and spline "patches" (2d curves).

While ambitious by the hw designers, turns out this is not actually very useful for games, so very few games use it. Puzzle Bobble uses it for rotating sprites for some reason, and I have a very simple hack for those.

We need a real implementation of these for some games though.

BEZIER:

  • Puzzle Bobble
  • SSX On Tour
  • Jeanne d'Arc

SPLINE:

  • Loco Roco
  • Idolmaster
  • Hexyz Force

BOTH

  • Final Fantasy IV
@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Feb 11, 2013

What's the easiest way to identify games that use these?

-[Unknown]

@Xele02

This comment has been minimized.

Copy link
Collaborator

commented Feb 11, 2013

You can break in the DisplayListInterpreter or put a print.
Or with the next Qt update :
ppsspp4

/me stop the teasing and go back to finish

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Feb 12, 2013

@Xele02 , the second column you can cut down to two hex digits :) and the third is only six.

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Feb 12, 2013

Very neat.

* [Unknown] crosses his fingers that Qt will run okay from Visual Studio.

-[Unknown]

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Feb 24, 2013

Hexyz Force appears to use splines (not sure to what capacity) during battle.

-[Unknown]

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Mar 10, 2013

Jeanne d'Arc seems to be a great example of Bezier curves, the graphics are very broken without them implemented.

-[Unknown]

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Apr 1, 2013

FWIW, LittleBigPlanet seems to crash when it hits bezier curves somewhere in the vertex reader or something.

-[Unknown]

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Jun 28, 2013

I found these examples:

https://github.com/pspdev/pspsdk/blob/master/src/samples/gu/splinesurface/splinesurface.c
https://github.com/pspdev/pspsdk/blob/master/src/samples/gu/timing/timing.c
http://lukasz.dk/mirror/forums.ps2dev.org/viewtopicd6d2.html?t=12257

This seems to especially be an issue for some games, like FF4, but it turns out there are a bunch of games that use this for little effects here and there:

http://report.ppsspp.org/logs/kind/4
http://report.ppsspp.org/logs/kind/5

But more examples might be helpful.

-[Unknown]

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Jul 11, 2013

i dont know if this helps, i found this on google: http://www.goop.org/psp/gl/#bezier-patch

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Jul 11, 2013

JPCSP also has an implementation that we could look at.

@arg274

This comment has been minimized.

Copy link

commented Jul 21, 2013

okay,jpcsp has a prob with locoroco also.in ppsspp,the middle part is missing bt the circular shape of the blobs r ok,in jpcsp the middle part is fine bt the blobs r squarish...

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Jul 31, 2013

it looks like neobrain started to implement spline to softgpu, can someone port it over? neobrain@d26c7c3

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Jul 31, 2013

I might port it when he is done :-)

@raven02

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2013

Humm just wonder cannot see beizer code in softgpu ....

@unknownbrackets

This comment has been minimized.

@Line524

This comment has been minimized.

Copy link

commented Aug 19, 2013

Holy Cow ! SoftGPU produces correct graphic in LocoRoco !!! It is damn slow, but CORRECT !!! (^_^)
Is it possible to implement spline code into Hardware mode ?
Or is it possible to multithread SoftGPU like GSDX works on PCSX2 ?

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Aug 19, 2013

It's actually not 100% correct but definitely good enough for loco roco :)

Yeah, it's possible. I won't have time until after 0.9 though.

@Line524

This comment has been minimized.

Copy link

commented Aug 19, 2013

Thank you Henrik !!!)
I'm going to donate when LocoRoco and DenshaDeGo will produce correct image :)

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2013

it helps a lot in final fantasy 4 too. (its still not perfect,but at least spell effects dont take up the whole screen.)
before:
screen00003
after:
screen00002

@raven02

This comment has been minimized.

Copy link
Contributor

commented Aug 19, 2013

@unknownbrackets , Ahh , forget spline = beizer

@Line524

This comment has been minimized.

Copy link

commented Aug 23, 2013

OH MY GOD !!!!
Thank you Henrik ! (And Neobrain, and everyone from DEV team !)
LocoRoco now works ! (^_^)
I'm going to buy Gold version at the end of this month :) (I'm finally happy, even if Mobile train sim don't work correctly on PPSSPP (Issue #3244))
Besides - is there a way to increase tesselation iterations in spline's ? On PPSSPP those Locos sometimes shows some jaggies or aliasing (like low poly circles) and about velocity = on real PSP Locos reacts like condoms filled with rubber gel, and on PPSSPP they reacts to collisions like condoms filled with water...
(P.S. - sorry for my explanation, i tried my best...)

@Line524

This comment has been minimized.

Copy link

commented Aug 23, 2013

Oops, sorry - velocity is OK, it looks like jagginess cause that kind of reaction :)

@Line524

This comment has been minimized.

Copy link

commented Aug 26, 2013

Oh, LocoRoco crashing randomly (but mostly at the end of 4th level or on counting screen)...
I will try to find what exactly crashes the emu, bul looks like it is large amount of loco splines or maybe sound related bug (reverb giving a noise in this game)

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Aug 26, 2013

The random loco roco crashes are sound related, we have some bug in the mixer. Will look at it soon.

@Ritori

This comment has been minimized.

Copy link

commented Sep 23, 2013

Same as GE2 (BRoff) it perfect now :)
god2

@raven02

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

FF4 HQ and LQ is bit interesting .HQ seems to be too smooth .

-HQ
screen00025

-LQ
screen00026

@Line524

This comment has been minimized.

Copy link

commented Sep 24, 2013

Wow, HQ much better and smoother :) It is not too smooth - it is better than on real PSP, because her hardware not so powerful...
Looks like HQ should be default on PC )))

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Sep 24, 2013

Nah, the texture looks stretched along the lighting lines, making it look too smooth :)
My guess is that we generate the wrong UV coordinates for the splines somehow.

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

yep, something is still wrong just look at firaga spell
screen00002
And look at this video: http://www.youtube.com/watch?v=qaQ0fY91fvU 1:07

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Sep 24, 2013

I know what's wrong, hang on.

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Sep 24, 2013

ok, try now.

@raven02

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

Looks fine now .

HQ
screen00028

LQ
screen00029

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Sep 24, 2013

Great, firaga too?

@raven02

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

Firaga spell may rely on @Nezarn as i don't have that save :(

@raven02

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

Regarding bbox/bjump implementation , what we can expect it fixes in terms of graphical ?

List of games using bjump/bounding box
http://report.ppsspp.org/logs/kind/365

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

screen00003
It looks a bit better.
Edit: here's my save file if someone needs it: https://www.dropbox.com/s/uqhpn97b6guz3qr/SAVEDATA.ZIP

@thedax

This comment has been minimized.

Copy link
Collaborator

commented Sep 24, 2013

FF4 seems to crash sometimes when entering battle now with high quality beziers/splines on:

>   PPSSPPWindows.exe!TesselateBezierPatch(unsigned char * & dest, int & count, const BezierPatch & patch, unsigned int origVertType) Line 673  C++
    PPSSPPWindows.exe!TransformDrawEngine::SubmitBezier(void * control_points, void * indices, int count_u, int count_v, GEPatchPrimType prim_type, unsigned int vertType) Line 803 C++
    PPSSPPWindows.exe!GLES_GPU::ExecuteOp(unsigned int op, unsigned int diff) Line 771  C++
    PPSSPPWindows.exe!GLES_GPU::FastRunLoop(DisplayList & list) Line 603    C++
    PPSSPPWindows.exe!GPUCommon::InterpretList(DisplayList & list) Line 508 C++
    PPSSPPWindows.exe!GPUCommon::ProcessDLQueueInternal() Line 670  C++
    PPSSPPWindows.exe!GPUCommon::ProcessEvent(GPUEvent ev) Line 636 C++
    PPSSPPWindows.exe!GLES_GPU::ProcessEvent(GPUEvent ev) Line 628  C++
    PPSSPPWindows.exe!ThreadEventQueue<GPUInterface,GPUEvent,enum GPUEventType,0,8,7>::RunEventsUntil(unsigned __int64 globalticks) Line 74 C++
    PPSSPPWindows.exe!GPUCommon::ProcessDLQueue() Line 651  C++
    PPSSPPWindows.exe!GPUCommon::EnqueueList(unsigned int listpc, unsigned int stall, int subIntrBase, PSPPointer<PspGeListArgs> args, bool head) Line 300  C++
    PPSSPPWindows.exe!WrapU_UUIU<&sceGeListEnQueue>() Line 666  C++
    PPSSPPWindows.exe!CallSyscall(Memory::Opcode op) Line 450   C++

Locals: http://i.minus.com/igoymiVXlY1XG.png

Also, in regards to Firaga, what it should look like can be seen in the video I linked above, at around 7-14 seconds in or so: https://www.youtube.com/watch?v=83vCkplpsMw

@solarmystic

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

Confirmed @thedax's findings in FFIV using 64bit PPSSPP, HQ Beziers and Splines, and an AMD/ATI graphics card. Strangely enough, it won't crash in the Debug builds no matter what, so I couldn't get a stack trace from them.

Very, very easy to repro, just walk around on the world map and trigger a battle, game will instantly crash.

Stack Trace:-

>   PPSSPPWindows64.exe!TesselateBezierPatch(unsigned char * & dest, int & count, const BezierPatch & patch, unsigned int origVertType)  Line 673 + 0x44 bytes  C++
    PPSSPPWindows64.exe!TransformDrawEngine::SubmitBezier(void * control_points, void * indices, int count_u, int count_v, GEPatchPrimType prim_type, unsigned int vertType)  Line 803 + 0x1b bytes C++
    PPSSPPWindows64.exe!GLES_GPU::ExecuteOp(unsigned int op, unsigned int diff)  Line 1395  C++
    PPSSPPWindows64.exe!GLES_GPU::FastRunLoop(DisplayList & list)  Line 603 C++
    PPSSPPWindows64.exe!GPUCommon::InterpretList(DisplayList & list)  Line 508  C++
    PPSSPPWindows64.exe!GPUCommon::ProcessDLQueueInternal()  Line 670 + 0xc bytes   C++
    PPSSPPWindows64.exe!GLES_GPU::ProcessEvent(GPUEvent ev)  Line 628   C++
    PPSSPPWindows64.exe!ThreadEventQueue<GPUInterface,GPUEvent,enum GPUEventType,0,8,7>::RunEventsUntil(unsigned __int64 globalticks)  Line 74 + 0x17 bytes C++
    PPSSPPWindows64.exe!GPUCommon::ProcessDLQueue()  Line 650   C++
    PPSSPPWindows64.exe!GPUCommon::EnqueueList(unsigned int listpc, unsigned int stall, int subIntrBase, PSPPointer<PspGeListArgs> args, bool head)  Line 297 + 0xc bytes   C++
    PPSSPPWindows64.exe!WrapU_UUIU<&sceGeListEnQueue>()  Line 666 + 0x2f bytes  C++
    PPSSPPWindows64.exe!CallSyscall(Memory::Opcode op)  Line 450    C++
    000000000e5df2d7()  
    PPSSPPWindows64.exe!string "sceKernelPollEventFlag(%i) inval"...()  + 0x3c bytes    C++
    0000000003fce5d0()  
    0000000008a0ef04()  

Locals:
capture

@unknownbrackets

This comment has been minimized.

Copy link
Collaborator

commented Sep 24, 2013

Hmm, count seems super high. Does this happen with "Read Framebuffers To Memory" off?

It can be done more efficiently, but what if you add after:

                count += 6;
            }

This (both times) in Spline.cpp:

                count += 6;
            }
            if (count > 16000) {
                break;
            }

Although, those vars can easily just be incorrect in release mode unfortunately.

-[Unknown]

@solarmystic

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

@unknownbrackets

The game (FFIV) has glitchy graphics with "Read Framebuffers to Memory" on so the option was never used during problem reproduction for the aforementioned issue.

Read Framebuffers to Memory on

screen00084

screen00085

@thedax

This comment has been minimized.

Copy link
Collaborator

commented Sep 24, 2013

FF4 doesn't need Read FB -> CPU/GPU, so yes it does happen with it off.

The break statements do indeed prevent the crash.

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

I've just done 5 battles, it doesnt crash for me. (i have nvidia, and using x64 build of ppsspp)

@thedax

This comment has been minimized.

Copy link
Collaborator

commented Sep 24, 2013

What version of the game? EU? US?

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Sep 24, 2013

EU

@thedax

This comment has been minimized.

Copy link
Collaborator

commented Sep 24, 2013

That'd probably explain it then. I use the US version, and I believe @solarmystic does, too.

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Sep 24, 2013

I'll take a look at this tomorrow, it's likely that a bug or two lurk in all the new spline code I added.

@Boxing450

This comment has been minimized.

Copy link

commented Sep 30, 2013

I want to appeal to unknownbrackets. You can see games like Fight night and UFC Undisputed? Something these games ispravlyayutsya. Apologies for oftop. Write the answer in a relevant subject.

@Nezarn

This comment has been minimized.

Copy link
Contributor

commented Oct 4, 2013

In FF4, when i use some spells or summons there is a line that shouldn't be there, for example:
screen00006
And something is still missing, or wrong, just look at these two screenshot 1 from ppsspp 1 from jpcsp
screen00003
ules01521-shot-1

@thedax

This comment has been minimized.

Copy link
Collaborator

commented Oct 10, 2013

FF4's HQ bezier/spline crash seems to be fixed now. I think it was from the changes Henrik made a few hours ago.

@Rydia

This comment has been minimized.

Copy link

commented Oct 11, 2013

HE FIXED IT OMG :DD

@hrydgard

This comment has been minimized.

Copy link
Owner Author

commented Oct 12, 2013

I think the only issue remaining here might be texture coordinate scaling and stuff like that. I'm gonna consider it done as a feature, anything remaining is just minor bugs that can get their own issues :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.