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.
Post Reply
Team Xlink
Posts: 368
Joined: Thu Jun 25, 2009 4:45 am
Location: Michigan

Simple 3D Rendering World

Post by Team Xlink »

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/
andrewj
Posts: 133
Joined: Mon Aug 30, 2010 3:29 pm
Location: Australia

Post by andrewj »

Why not just load OBJ format? It's simple text format and the article on Wikipedia explains it well.
Downsider
Posts: 621
Joined: Tue Sep 16, 2008 1:35 am

Post by Downsider »

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..
leileilol
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Post by leileilol »

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
Post Reply