Results 1 to 4 of 4

Thread: Triangle Rasterization - 3D Graphics - VB.NET

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2018
    Posts
    80

    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.

    Name:  img01.jpg
Views: 263
Size:  5.3 KBName:  img02.jpg
Views: 291
Size:  5.8 KB

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    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.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    38,989

    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

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2018
    Posts
    80

    Re: Triangle Rasterization - 3D Graphics - VB.NET

    Quote Originally Posted by dday9 View Post
    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

    Quote Originally Posted by Shaggy Hiker View Post
    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
  •  



Click Here to Expand Forum to Full Width