Skip to content

Added support for transforming homogenous W geometry into world geomtry #199

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

Open
wants to merge 38 commits into
base: master
Choose a base branch
from

Conversation

dkollmann
Copy link
Contributor

This is an update on the previous pull request #188.

Added support for transforming homogenous W geometry into world geometry.
@elishacloud
Copy link
Owner

Thanks @dkollmann! I will take a look at this soon.

@dkollmann
Copy link
Contributor Author

Also FYI if you try this code with Black & White, things will have a blue tint. This is because the water plane which should be rendered before all the other geometry, is rendered on top of it instead of behind the other geometry.

Fixed incorrect game camera position and orientation. Added option to disable lighting. Commented out unneeded XYZW code.
@dkollmann dkollmann force-pushed the reverse_xyzrhw_new branch from 7c87321 to e8ff88d Compare May 16, 2023 22:17
@dkollmann
Copy link
Contributor Author

I made some fixes. Of course lpD3DMatrix has to be replaced, after getting the game camera properties from it.
I added an option to disable the lighting which is needed when DdrawConvertHomogeneousW is true but DdrawConvertHomogeneousToWorld is false. At least for Black & White.

The force push was just an update on the commit comment.

@elishacloud
Copy link
Owner

For some reason when I add this DdrawConvertHomogeneousW = 1 line to the ini file I just get the following:

image

@elishacloud
Copy link
Owner

For some reason when I add this DdrawConvertHomogeneousW = 1 line to the ini file I just get the following:

Ok, I figured this out. You have to set DdrawDisableLighting = 1 for Black & White.

@elishacloud
Copy link
Owner

elishacloud commented May 17, 2023

My only last comment is that I prefer to create a struct and add it to the IDirect3DDeviceX.h file rather than a whole new RednerData class for the DdrawConvertHomogeneous settings/matrices. Since the code is in IDirect3DDeviceX.cpp the settings should be in IDirect3DDeviceX.h.

Other than that, I think this is about ready to merge.

@dkollmann
Copy link
Contributor Author

Ah okay, I created the RenderData.h, because it was not possbile to include the device header in the DebugOverlay.cpp file.

@elishacloud
Copy link
Owner

I created the RenderData.h, because it was not possbile to include the device header in the DebugOverlay.cpp file.

DebugOverlay.h already has #include "ddraw.h", which includes IDirect3DDeviceX.h. So it is already covered.

@elishacloud
Copy link
Owner

@dkollmann, sorry for the delay in responding. I updated the code to match your branch. But I am wondering if there is an issue with DdrawConvertHomogeneousW which is getting exacerbated in DdrawConvertHomogeneousToWorld.

Could there be an issue because we are losing data in the DrawIndexedPrimitive() when we overwrite data in lpVertices?

The reason I ask is because I am still seeing distortion in the sky in Dark Reign 2 whenever DdrawConvertHomogeneousToWorld is enabled, even if DdrawConvertHomogeneousToWorldUseGameCamera is disabled. I also see distortion even if just DdrawConvertHomogeneousW is enabled, though the distortion is much smaller in this last case.

@dkollmann
Copy link
Contributor Author

Hey, I just wanted to say that I am still on this, but I changed my job and am moving to another country, so lately I am super busy.

@elishacloud
Copy link
Owner

@dkollmann, no problem. Take your time. I understand. Real life has to come first. Thanks for letting me know.

@elishacloud
Copy link
Owner

Because there are a lot of things added since this PR was created, I updated it to keep it in-sync with the master branch.

@elishacloud
Copy link
Owner

Keeping PR in-sync with master branch.

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

Successfully merging this pull request may close these issues.

4 participants