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

Exception when checking Triangles normals checkbox #1

Open
AurelienDX opened this issue May 24, 2020 · 1 comment
Open

Exception when checking Triangles normals checkbox #1

AurelienDX opened this issue May 24, 2020 · 1 comment

Comments

@AurelienDX
Copy link

AurelienDX commented May 24, 2020

Hi,

Great 3d pipeline (from your reddit post, if i remember correctly, on r/chsarp)

i get an exception when checking Triangles normals.

As i'm trying to build my own 3d pipeline too, i must say i have ended with the same graphics implementation as you did : filling a bmp from a int array, with the same pixel format for maximum speed.

i have implemented a triangle rasterization based on tiles, commonly used with SIMD instructions : https://www.uni-obuda.hu/journal/Mileff_Nehez_Dudra_63.pdf

i recently discovered the Span and Memory classes, allowing us to make pixels access by lines (like Scanline in Delphi).
Slicing arrays saves some milliseconds, strangely...

i use a precalculation of startlines, avoiding one multiply by PutPixel call.
ie : if i have a 800x600 pixel array, i have a int[600] array containing the values 0, 800, 1600, etc...
that saves me some milliseconds.

i made an animator library, based on Tasks (triple buffering : clear, draw, copy), but i wonder if it really use multithreading (when compiling in 32 bits).

i successfully migrated my project from .Net Framework to .Net Core3.1, as WinForm designer is back in VS 2019 16.6.

i have not yet pushed my work on github, but seriously think about it.

@Larry57
Copy link
Owner

Larry57 commented May 25, 2020

Thank you for your feedback, and your link regarding the SIMD rasterization ! I also peppered my code with links to resources that I shamefully copied.

Have you noticed this exception in the master or develop branch? I haven't checked yet.

Doing 3D in pure C# is a lot of micro-optimizations (aggressive inlining, immutable structs..., old school boards, vanilla loops, Span, Memory...), and thanks to this, I realized why it requires so many resources, and why many frameworks rely on the hardware possibilities of graphics cards.

I also managed to port this project to .NET Core thanks to a shared project. It works like a charm.

However, I kept it in .NET Framework because the Visual Studio designers were not ready at that time. I'm glad to see that this is no longer the case.

Trying to do it in pure C# helped me understand more easily what's going on :)

Your work looks fantastic, I definitely recommend pushing it on GitHub. I am especially interrested to see the task based pipeline, this is something I would like to achieve too using the DataFlow library.

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

No branches or pull requests

2 participants