Image Map Image Map
View RSS Feed

All Blog Entries

  1. 2D Outline of 3D Shape

    The goal here is to draw lines around the outside of a 3D rendered shape. For my purposes, all 3D to 2D rendering is done via triangles. The reason triangles are so awesome for 3D is that every triangle is always co-planar (flat) and the three points can be rearranged in any order. The method I've created works on projected triangles only, those that have already been converted from 3D to 2D and thus have only two axes: X and Y.

    First I need to explain how the shapes are represented ...
    Categories
    3D
  2. Drawing Pixel Perfect Triangles (Part 3: X86 Assembler)

    In this final, third part blog post I present to you finished 16-bit X86 assembler code for CGA mode 4 (320x200x4) written as a DEBUG script [1]. This will give you a 556 byte routine starting at address 1300h.

    Code:
    a 1300
    ; ----------------------------------------------------------------------------
    ; TRIFILL (AH,AL) - (BH,BL) - (DH,DL), CH			:TRIFILL
    ;
    ;	[params]	[stepping]	[drawing]
    ;
    ;     / AH = X1		/ StepA		/ XBeg
    ; AX /_ AL = Y1
    ...

    Updated March 31st, 2017 at 08:55 AM by neilobremski

    Categories
    Asm
  3. Drawing Pixel Perfect Triangles (Part 2: Pseudo Code)

    In my previous post I explained the purpose and high level algorithm. This time I'm going to show you some almost-actual code written in a pseudo-C language. Let's get straight to it ...

    Code:
    trifill(x1, y1, x2, y2, x3, y3, color) /* y coords must be sorted ascending */
    {
    	YDistA = y2 - y1 + 1; /* slope of side A (1 to 2) */
    	if (x1 > x2) {
    		XDirA = -1;
    		XDistA = x1 - x2 + 1;
    	} else {
    		XDirA = 1;
    		XDistA = x2 - x1 + 1;
    ...

    Updated March 31st, 2017 at 08:55 AM by neilobremski

    Tags: bresenham Add / Edit Tags
    Categories
    Uncategorized
  4. Drawing Pixel Perfect Triangles (Part 1: Algorithm)

    I want to explain the results of my month of learning assembler and Bresenham lines by presenting a method of drawing pixel perfect triangles. This will be broken up into three blog posts, this first of which is about the purpose and the algorithm at a high level.

    Triangles are the graphics primitive cornerstone of fast, interactive 3D (read: games!). This is the purpose to which I'll be using my triangles and my goal for drawing them is such that they are pixel perfect matches to ...

    Updated March 31st, 2017 at 08:56 AM by neilobremski

    Tags: bresenham Add / Edit Tags
    Categories
    Uncategorized
  5. PickUps 12: Video Games + Stuff | It's a Pixel THING - Ep. 115

    Let's take a look at 18 video games + related stuff that I managed to grab during the first 3 months of 2017!
    There's stuff for the PlayStation 4, PlayStation 3, Xbox 360, Sega Mega Drive and PC CD-ROM along with other related items!
    Enjoy!

    PickUps 12: Video Games + Stuff | It's a Pixel THING - Ep. 115