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

Implement the exact Direct3D line rasterization algorithm #74

Open
nmlgc opened this issue Oct 19, 2024 · 0 comments
Open

Implement the exact Direct3D line rasterization algorithm #74

nmlgc opened this issue Oct 19, 2024 · 0 comments
Labels
Enhancement New feature or request Graphics Portability Porting the game away from 32-bit Windows ~≤1 push Projected number of pushes needed. Might turn out to get more expensive!

Comments

@nmlgc
Copy link
Owner

nmlgc commented Oct 19, 2024

Direct3D, OpenGL, and SDL all have their own and distinct line rasterization algorithms:

Direct3D OpenGL SDL
Circles Direct3D circles OpenGL circles SDL circles
Warning wireframe Direct3D warning wireframe OpenGL warning wireframe SDL warning wireframe

pbg's original 16-bit rendering code obviously uses the Direct3D algorithm, and we do opt into that algorithm via SDL's hint system. However, this still makes pixel-perfect rendering exclusive to the combination of the Direct3D 9/11/12 API and framebuffer scaling. But this hint causes the OpenGL backends (and, by extension, the Linux port) to use OpenGL's different line algorithm, whereas geometry scaling on any API has to use the SDL algorithm.

This is a really minor concern because both OpenGL's and SDL's algorithms are at least 97% accurate to the original game and only differ between each other in less than 1% of pixels. But if we ever want the 100% pixel-perfect port of line rendering, there's no way around reverse-engineering and reimplementing the original Direct3D line drawing algorithm as part of our game code.

Bonus points for also adding an option that implements pbg's significantly different 8-bit line drawing algorithm as a point list, but we'd probably only do this together with #67 to maintain parity with circles.

@nmlgc nmlgc added Enhancement New feature or request Graphics Portability Porting the game away from 32-bit Windows ~≤1 push Projected number of pushes needed. Might turn out to get more expensive! labels Oct 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request Graphics Portability Porting the game away from 32-bit Windows ~≤1 push Projected number of pushes needed. Might turn out to get more expensive!
Projects
None yet
Development

No branches or pull requests

1 participant