Dolphin, the GameCube and Wii emulator - Forums

Full Version: Oculus Rift support
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13
I don't know for sure what GX call is actually setting it, since Dolphin and IDA don't have signatures for most of the SDK functions (which is really annoying when trying to debug). I did write a .idc script for importing the map files that dolphin exports into IDA, but most of the functions are still missing.
Does anyone have a proper .dsy file that contains all the SDK functions?

I think it's GXSetProjection, or GXSetProjectionv though.

Anyway, you're looking in the wrong section for setting the projection matrix. It is set directly from these registers:
http://hitmen.c02.at/files/yagcd/yagcd/chap5.html#sec5.11.4
There are 7 registers, projectionA to projectionF. They are also documented here:
http://wiibrew.org/wiki/Hardware/GX/Transform_Unit

The last one, projectionF, is 0 for perspective or 1 for orthographic. The others depend on which it is.
(10-12-2012, 05:06 PM)CarlKenner Wrote: [ -> ]I don't know for sure what GX call is actually setting it, since Dolphin and IDA don't have signatures for most of the SDK functions (which is really annoying when trying to debug). I did write a .idc script for importing the map files that dolphin exports into IDA, but most of the functions are still missing.
Does anyone have a proper .dsy file that contains all the SDK functions?

I think it's GXSetProjection, or GXSetProjectionv though.

Anyway, you're looking in the wrong section for setting the projection matrix. It is set directly from these registers:
http://hitmen.c02.at/files/yagcd/yagcd/chap5.html#sec5.11.4
There are 7 registers, projectionA to projectionF. They are also documented here:
http://wiibrew.org/wiki/Hardware/GX/Transform_Unit

The last one, projectionF, is 0 for perspective or 1 for orthographic. The others depend on which it is.

Hmm, I was under the impression that the projection matrix (handling FOV, aspect, draw distance) was separate from the camera position matrix (handling the XYZ coordinates and the yaw/pitch/roll of the camera). I'm looking for the camera position matrix. Am I on the wrong track here? (As you can see, I'm not spectacularly familiar with GX, or with graphics programming in general... but I learn quickly. Smile )

EDIT: In DirectX the matrix I'm looking for is called a View Transform: http://msdn.microsoft.com/en-us/library/windows/desktop/bb206342%28v=vs.85%29.aspx . I can't find any mention of something similar in YAGCD (I don't believe the Viewport Matrix is what I'm looking for.)
(10-12-2012, 05:25 PM)biolizard89 Wrote: [ -> ]
(10-12-2012, 05:06 PM)CarlKenner Wrote: [ -> ]I don't know for sure what GX call is actually setting it, since Dolphin and IDA don't have signatures for most of the SDK functions (which is really annoying when trying to debug). I did write a .idc script for importing the map files that dolphin exports into IDA, but most of the functions are still missing.
Does anyone have a proper .dsy file that contains all the SDK functions?

I think it's GXSetProjection, or GXSetProjectionv though.

Anyway, you're looking in the wrong section for setting the projection matrix. It is set directly from these registers:
http://hitmen.c02.at/files/yagcd/yagcd/chap5.html#sec5.11.4
There are 7 registers, projectionA to projectionF. They are also documented here:
http://wiibrew.org/wiki/Hardware/GX/Transform_Unit

The last one, projectionF, is 0 for perspective or 1 for orthographic. The others depend on which it is.

Hmm, I was under the impression that the projection matrix (handling FOV, aspect, draw distance) was separate from the camera position matrix (handling the XYZ coordinates and the yaw/pitch/roll of the camera). I'm looking for the camera position matrix. Am I on the wrong track here? (As you can see, I'm not spectacularly familiar with GX, or with graphics programming in general... but I learn quickly. Smile )

EDIT: In DirectX the matrix I'm looking for is called a View Transform: http://msdn.microsoft.com/en-us/library/windows/desktop/bb206342%28v=vs.85%29.aspx . I can't find any mention of something similar in YAGCD (I don't believe the Viewport Matrix is what I'm looking for.)

Oh, oops. Yes, you're right. You can't change the camera position that way, only the lens. I misread the question.

I would guess there probably is no such function, and everything is drawn relative to the camera. But I don't know.

How are you hooking functions anyway?
(10-12-2012, 06:56 PM)CarlKenner Wrote: [ -> ]Oh, oops. Yes, you're right. You can't change the camera position that way, only the lens. I misread the question.

I would guess there probably is no such function, and everything is drawn relative to the camera. But I don't know.

How are you hooking functions anyway?
Hmm... looking through some Wii homebrew examples (GRRLib), it seems that those examples are indeed using the matrices like I originally thought (passing a camera position/aim as a position matrix to GX)... so maybe some commercial games (for some reason) do things differently from homebrew (F-Zero definitely appears to be using identity matrices as its position matrices). Even if that's the case, it doesn't explain why the different on-screen objects moved differently when I added a translation. I'll play around with it later, it's 4AM here and I have class at 12PM.

I'm just hooking functions with Gecko.NET at the moment. It's difficult because F-Zero GX was programmed by people who were sufficiently sadistic that they made most of the functions change memory locations every time you reboot the game (even if you choose identical settings). Maybe I'll try an easier game and then attempt to port back to F-Zero GX.
(10-12-2012, 07:08 PM)biolizard89 Wrote: [ -> ]
(10-12-2012, 06:56 PM)CarlKenner Wrote: [ -> ]Oh, oops. Yes, you're right. You can't change the camera position that way, only the lens. I misread the question.

I would guess there probably is no such function, and everything is drawn relative to the camera. But I don't know.

How are you hooking functions anyway?
Hmm... looking through some Wii homebrew examples (GRRLib), it seems that those examples are indeed using the matrices like I originally thought (passing a camera position/aim as a position matrix to GX)... so maybe some commercial games (for some reason) do things differently from homebrew (F-Zero definitely appears to be using identity matrices as its position matrices). Even if that's the case, it doesn't explain why the different on-screen objects moved differently when I added a translation. I'll play around with it later, it's 4AM here and I have class at 12PM.

I'm just hooking functions with Gecko.NET at the moment. It's difficult because F-Zero GX was programmed by people who were sufficiently sadistic that they made most of the functions change memory locations every time you reboot the game (even if you choose identical settings). Maybe I'll try an easier game and then attempt to port back to F-Zero GX.

Things are rendered with different projection matrices and viewports. For example, in Metroid Prime Trilogy 1 it uses at least 15 different projection matrices to render a frame in a normal scene, with different parts having different scales. So if I translate everything, the helmet and the visor seem to move a different amount from other objects.
(10-12-2012, 09:04 PM)CarlKenner Wrote: [ -> ]Things are rendered with different projection matrices and viewports. For example, in Metroid Prime Trilogy 1 it uses at least 15 different projection matrices to render a frame in a normal scene, with different parts having different scales. So if I translate everything, the helmet and the visor seem to move a different amount from other objects.

Hmm, that still doesn't explain why some objects moved parallel to the viewport's X axis while some other objects moved parallel to the world's X axis. Anyway, if that's the case, it may be easier to simply find where the game stores the camera coordinates and hook those functions, rather than trying to hook GX calls. The disadvantages are that someone will have to individually find that code for every game, and the camera in the menus won't be hookable (only the main game camera), but the advantage is that the game's engine will automatically handle all of these details for us.

I've already found the addresses of the camera coordinates in 3 games (F-Zero GX, Starfox Assault, and Super Monkey Ball 2), and doing so for arbitrary games usually isn't that hard (on average I'd say less than 30 minutes of work per game), so I'll probably try to work on this problem from that angle. I may try again at hooking GX calls if I have new ideas (or if I just get bored).
(10-13-2012, 07:41 AM)biolizard89 Wrote: [ -> ]I've already found the addresses of the camera coordinates in 3 games (F-Zero GX, Starfox Assault, and Super Monkey Ball 2), and doing so for arbitrary games usually isn't that hard (on average I'd say less than 30 minutes of work per game), so I'll probably try to work on this problem from that angle. I may try again at hooking GX calls if I have new ideas (or if I just get bored).

Wow. I wish I could do that (preferably without a USB gecko). I want to be able to change the camera coordinates and orientation (although at the moment I'm using the projection matrix for that, which only works in Dolphin not a real Wii). My current way has a problem with things not being rendered because the game thinks you can't see them. What I'd really like to be able to do though is control what FOV the game is culling, so it wouldn't cull things that are still within the extended FOV of the Rift, even when you don't turn your head.


Direct3D/OpenGL question:
==================
Does anyone know if it's possible to render the exact same scene twice (or more) but from a different point of view, changing only the projection matrix and either the render target, viewport, or pixel shader?

I've heard it's not possible in D3D9, but it might be possible in OpenGL and D3D11.

Basically, I want the game to render one frame, but display it twice from different points of view, once for each eye. So I want it to save up all the rendering calls, then set the projection matrix, execute those saved calls, then set the projection matrix again, and execute those saved calls again.

I'm thinking OpenGL DisplayLists could do that? And I heard there was a D3D11 equivalent.

I also want to extend that further for not just 3D, but head tracking too! I want the game to render at it's normal slow 10FPS, but execute each set of draw calls 2 or 3 times with updated head tracking, for 20 or 30FPS. So it feels like you are quickly looking around a world that updates slowly. It may not be possible, but that would be the ideal.
Although I haven't yet had a chance to do head tracking, here's my Stereo 3D code for F-Zero GX:

http://geckocodes.org/?c=GFZA01

It's an early beta, so there are problems, but hopefully you'll find it interesting.
I'd be very interested to hear if work is ongoing with this Carl.

Also your site is in need of much attention: http://glovepie.org/

Currently displaying a message about being hacked.
(01-14-2013, 12:10 PM)Parlane Wrote: [ -> ]Also your site is in need of much attention: http://glovepie.org/

Currently displaying a message about being hacked.
lol, it's been like that for months XD
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13