Forum

Simple 3D Rendering World

Discuss programming topics for any language, any source base. If it is programming related but doesn't fit in one of the below categories, it goes here.

Moderator: InsideQC Admins

Simple 3D Rendering World

Postby Team Xlink » Wed Jan 05, 2011 12:53 am

I'm trying to come up with a basic 3D rendering world, in a simple system that could be implemented in most languages that supports drawing something on screen.

There would be a 3D grid, it would have X, Y, and Z cordinates.

Image

The program would read from a file that would include the cordinates, it could be setup as a matrix, but for now something like this:

Code: Select all
A1 = X, Y, Z
A2 = X, Y, Z
A3 = X, Y, Z
A4 = X, Y, Z


That would create an outline of a plane, or 2D object with four sides. The A represents the group or object they belong too while, the number represents the instance of the object. Each instance counts as a side. This is a simple system that could be reworked to provide larger range of possibilities.

Here are more examples

Triangle
Code: Select all
A1 = X, Y, Z
A2 = X, Y, Z
A3 = X, Y, Z


Pentigon
Code: Select all
A1 = X, Y, Z
A2 = X, Y, Z
A3 = X, Y, Z
A4 = X, Y, Z
A5 = X, Y, Z


Hexagon
Code: Select all
A1 = X, Y, Z
A2 = X, Y, Z
A3 = X, Y, Z
A4 = X, Y, Z
A5 = X, Y, Z
A6 = X, Y, Z


You could then render the area inside the outline a color, thereby differentiating itself from the other planes in the world.

This is the general idea of the system. It is simple, however because of the simple conecpt this is, it introduces a number of flaws.

What if they you made a set of points and attempted to render the area inside it, a color. Like this:

Code: Select all
A1 = X, Y, Z
A2 = X, Y, Z


This does not make a plane, and could produce a number of events, of which the most desirable, being an automatic shutdown of the process.

If the process was not ended, it could potentially attempt to render the whole grid in a color, if there isn't a limit on the size of the grid, then it would have a memory leak, causing undesirable events.

What do you think?

EDIT: I forgot to include the image, and unfortunately, when I resized it it got really bad, and MSPaint doesn't offer very many undue options/
Team Xlink
 
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Postby andrewj » Wed Jan 05, 2011 5:11 am

Why not just load OBJ format? It's simple text format and the article on Wikipedia explains it well.
andrewj
 
Posts: 133
Joined: Mon Aug 30, 2010 3:29 pm
Location: Australia

Postby Downsider » Wed Jan 05, 2011 5:32 am

well whatever you're trying to accomplish, that little psuedoformat would be incredibly ease to parse and render, and other than that there's hundreds of more compact and easily parsed formats available to choose from..
User avatar
Downsider
 
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Postby leileilol » Wed Jan 05, 2011 5:38 am

But OBJ is the best, the other little compact formats don't really matter. Ask around - everything that works can export into .OBJ.

The hard part is improvising some vis data, and not to mention making brush entities and pointcontents (water in laykid's terms)....
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am


Return to General Programming

Who is online

Users browsing this forum: No registered users and 1 guest