PDA

View Full Version : Need Help Creating a Scene



RDMustang
04-09-2001, 04:35 PM
I need help creating a scene. As an assignment I had to write a program that reads in a list of triangs and renders the scene. My problem is that the scene is supposed to be decently complex and I really don't want to go figure out all the verticies of all different kinds of shapes. Does anyone know where I can get a file with lists of triangle verticies which create a scene? I've searched the web and all I can find are lightwave and 3ds stuff. Any help is greatly appreciated!

zed
04-09-2001, 07:16 PM
try a level from a game eg quake1/2/3 unreal etc. i believe theres also tools that conerts one of these file formats into an 3ds file. i have no idea where though!

RDMustang
04-10-2001, 03:52 AM
Where can I get the levels from 3d games and how complex will they be to read into a displaylist?

coredump
04-10-2001, 04:55 AM
RAW files may be your friend. they contain ASCII double/float values that represent triangles listed as follows:

x1 y1 z1 x2 y2 z2 x3 y3 z3

each triple is a point in 3d space. three points on a each line in the file make up the triangle. many programs export files in raw format. Rhino3D can do it and i think you can download a free trial version that allows full functionality for 15 uses or something like that. after that you can't save or export. if i remember correctly the triangles in the file are all ordered correctly (clockwise or ccw). then, if you want to get fancy, there are algorithms to convert triangles into triangle strips and fans, greatly reducing the number of vertices you need to keep track of. NOTE: you will have to supply any extra info (texture, etc.) yourself. good luck.

b

MWinckler
04-10-2001, 06:06 AM
A simple ASCII structure to code complex unstructured meshes is the VTK data fromat by kitware (http://www.kitware.com/). This in itself will not save you a lot of time, but wait: there is more!

One of the examples that you may find on Kitwares pages points to a simulation of the depolarization of the human heart at http://www.ifi.uio.no/~xingca/vtk_diffpack/ .For an example of this topic you will find three VRML data files each containing (in ASCII) a list of vertices and a list of triangles to describe the
human heart during such a simulation.

It should be easy to read the relevant portion of this file into your project and visualize the resulting set of triangles.

Hope that helps,
Michael
--

MWinckler
04-10-2001, 06:16 AM
On second thoughts you may also take an analytic function resulting in a sufficiently complex shape over two coordinates.
For a first guess I would use the superposition of two sin waves scaled by a radial symmetric exp-Funktion such as:

f(x,t) = sin(x) * sin(2*y) * exp(-(x^2+y^2))

Now take a grid in the x-y-plane and sample this function
sufficiently dense e,g.

x = -1.0, -0.9, ... ,0, ... , 0.9, 1.0
y = -1.0, -0.9, ... ,0, ... , 0.9, 1.0

This gives you a grid sampling of a surface in 3D [using points given by (x,y,f(x,y)for all 21x21 combinations of x,y from the above list], which will be easily converted to a triangularization using appropriate points (resulting in 20x20 4-gons or 800 triangles).

Tim Stirling
04-10-2001, 08:29 AM
An alternitive would be to get 3d exploration, http://www.xdsoft.com/explorer/
It will convert most 3d files including .3ds to other types such as wavefront .obj files which are simple- just list of vertices and a list of faces showing what vertices are used.

RDMustang
04-10-2001, 01:53 PM
Thanks for all the ideas!