Closed dkollmann closed 1 month ago
@dkollmann perhaps it's wise to use a feature toggle for this?
Since the code is already inside the if (Config.Dd7to9)
statement it will only run if Dd7to9
is enabled. And we pretty much always want to run it when Dd7to9
is enabled since any game that uses D3DDECLUSAGE_POSITION
will need it converted in this case.
Thank you guys for your input. I will get to that once the code is actually working.
The current state is as follows:
I disable the SetTransform function. Everything renders and looks fine.
Then I change the FVF type from D3DFVF_XYZRHW to D3DFVF_XYZW, and make sure the vertex position W is set to 1.0. The overall range of Z positions is between -1.0 and 1.0.
However I do not see anything rendered. Do you know if there is more that I must change to switch from D3DFVF_XYZRHW to D3DFVF_XYZW, when there are no transforms applied?
Thank you
There are three things that need to be done when changing the FVF type from D3DFVF_XYZRHW to D3DFVF_XYZW.
pVertexStreamZeroData
sent to DrawIndexedPrimitiveUP().VertexStreamZeroStride
parameter.You can see all three of these items happening here.
@dkollmann I added a comment to https://github.com/dkollmann/dxwrapper/commit/34d98e3f21565aaff3f661196c7d2557f63826bb
Thank you guys, instead of manipulating the original vertex buffer, I created one using POSITION_XYZ and copied the data, but the result is the same.
Here is the updated code. Could guys take a quick look, if there are any obvious issues in there? Thank you
Both REVERSE_POSITIONT_SIZE = 3 and 4 give the same behavior.
https://github.com/dkollmann/dxwrapper/commit/d9f7146ff6148972576ac1a5530bf5cf28a5e254?diff=split
I added the missing "vertex += stride;" to the loop for REVERSE_POSITIONT_SIZE == 4.
The good news is, when I export/capture the scene, it looks correct. So this is probably indeed a camera / view issue right now.
The REVERSE_POSITIONT_SIZE == 3
case has a bug. That's probably why you went for SIZE 4? (Which still overwrites the client buffer.) So I commented a suggestion which should fix the SIZE 3 case.
Edit: Actually, the SIZE 4 case also has a bug, so whatever you've tested is not working as you'd want...
With the other drawing API's that receive a User Pointer buffer and a given stride, there's also a potential case where the stride could be much much larger than the number of components actually used in the active vertex declaration. I know that's not the use case here, but at least be aware if you're going to cover those API's as well.
I am finally making some progress :)
Nice!
Okay, I got the game running in XYZW and XYZ mode.
Now my idea was to simply let the game set its projection matrix, and when I inverse transform all vertices with it, they should be transformed back to where they are now. The difference would be that when the scene is exported, it should look like the actual world we want to render. However everything goes back to black.
https://github.com/dkollmann/dxwrapper/commit/33e1cec9ec7469d54634f0d8c188ded420ddf537
I'm not quite sure what is happening. Have you tried using PIX to see what is happening?
It seems that neither PIX nor NVIDIA Nsight support 32-bit :(
An older Nsight version is available https://developer.nvidia.com/gameworksdownload#?dn=nvidia-nsight-graphics-2021-5
But it does not support D3D9 :(
If you install the DirectX9 SDK it has PIX built-in that works with DirectX9. It is located in the C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86
folder. There is also a 64bit PIX located here: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Utilities\bin\x64
Okay, I am finally at a point where I start to see things again.
However, the matrix is still not correct.
Could you guys take a look this commit and let me know if this seems correct to you?
The idea is, that for RTX Remix to correctly reconstruct the camera for later raytracing, it has to be correctly set up. So the view matrix is the position and orientation of the camera in the world and the projection matrix are the properties of the camera itself, like fov and so on.
The world matrix is always identity here.
I am finally getting somewhere with the world reconstruction :)
I think this issue is resolved now. Reopen it if there is still an issue.
Hey Elisha, I created a new issue since this is a really specific problem and I need your insights.
The issue is that RTX Remix does not support D3DDECLUSAGE_POSITIONT, due to that is needs the actual 3D scene to do all the raytracing. I now try to transform the viewspace coordinates back into world coordinates.
Could you take a look at my commit and let me know what you think? It does currently not work yet and is probably incomplete, but I think this is kind of the direction to go.
https://github.com/dkollmann/dxwrapper/commit/34d98e3f21565aaff3f661196c7d2557f63826bb
Thank you, Daniel