-
Mar 15th, 2021, 09:31 AM
#1
Thread Starter
Lively Member
Triangle Rasterization - 3D Graphics - VB.NET
Hello again people, been a while.
I have been working on a 3D graphics engine for around a year or so but very on and off(so maybe 2 months of work). It worked nice and clean when using the Graphics library included in VB.NET to draw my triangles.
Occlusion complicated things, do to a proper Z-Buffer I need to know of every pixel drawn and shoving a triangle on my canvas with the .NET Graphics library sure gives a pretty clean cube (or other convex shape, I use cubes for testing) but doesn't give you that kind of information. Only thing to do, raster my own triangles and use the data for my depth buffer.
I followed Top-Left rasterization rules and use point in triangle testing as described here. That's where I either f'd up really bad or magic does exist(first option most likely). The edges of my triangles(not all just some which is all the more weird) become transparent entirely or one pixel somewhere on the edge does when put in specific POV/angles.
Due to the sheer size of the software I won't paste code directly. If anyone has a clue as to what goes wrong or already worked on similar projects it would be a great deal of help.
-
Mar 15th, 2021, 10:04 AM
#2
Re: Triangle Rasterization - 3D Graphics - VB.NET
Without the source I can only offer conjecture. Usually this has to do with rounding errors and using a Decimal data type will help with that. The issue with using Decimals is performance, especially when you are doing a ton of mathematical operations on them sequentially, which in all likelihood you're doing.
-
Mar 15th, 2021, 10:15 AM
#3
Re: Triangle Rasterization - 3D Graphics - VB.NET
I'm curious as to why you are doing this? Is it for learning?
The graphics capability in .NET have some limitations, as they may well be making use of the CPU rather than the GPU, which will ultimately hurt performance. Meanwhile, there are robust, open source, projects such as MonoGame that handle graphics in the GPU.
My usual boring signature: Nothing
-
Mar 15th, 2021, 11:24 AM
#4
Thread Starter
Lively Member
Re: Triangle Rasterization - 3D Graphics - VB.NET
Originally Posted by dday9
Usually this has to do with rounding errors and using a Decimal data type will help with that. The issue with using Decimals is performance, especially when you are doing a ton of mathematical operations on them sequentially, which in all likelihood you're doing.
Thanks for the info, I'll make some sort of debug function to output values of two adjacent faces to the console in real time and spend a while reading those xD
Originally Posted by Shaggy Hiker
I'm curious as to why you are doing this? Is it for learning?
Yes sir it is, hence why I try to use even the .NET framework as little as possible. I always end up in crazy projects trying to learn things that many modern devs rather avoid but it's alot of fun imo. My previous one was a minimalist OS in assembler with a text editor and a paint tool for x86(Intel cpu's).
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|