Game Development Community

How to program Torque 3D models

by Bendik Stang · in Torque Game Engine · 08/31/2002 (4:16 am) · 35 replies

I'm making a openGL/C++ program that creates L-system based trees, and then drastically optimizes them with various Levels of Detail.

The idea is to make a plugin of some sort that will not take up much space, but once run, create as many trees as you like inside the game world.

I'm about to have the first part under control, but now I need to make it Torque compatible.
I have started to look at the 3DMax2DTS exporter code, but I have no clue about the 3DMax format either. So I figured that I might ask you guys if some one had a better alternative for me.
How do I learn how to create a map or dts like object inside the Troque code. Or should I totally circumvent those formats, and just make the models in openGL and stick them right into the game? If so, have anyone some code samples on this, that I could study?

(Eg, create an openGL CUBE in Troque, that is possible to manipulate using the ingame world editor....)

Any help here is appreciated! (You can read more about the project under my project page...)

:)
-Bendik
Page «Previous 1 2
#1
09/02/2002 (1:39 am)
..hmm is this a hard question?

While I'm at it, is there a way to change a dts-object's vertex colors...ingame.

This would be extremly useful. Allowing one model, eg coin, with one texture, to be used as various coins, like gold, copper, silver, etc. Or one horse model, with various shades....

*waiting patiently..or atleast trying to wait patiently*

:)
Bendik
#2
09/04/2002 (7:13 am)
*bump*
#3
09/04/2002 (2:09 pm)
Bendik,

I've done a few Lindenmayer-system implementations over the years so I know what fun they can be and how powerful they are. You idea has potential as long as you include flexible enough tokens in your axioms.

I would suggest that you ignore the DTS formats for now and focus on creating basic shapes/meshes using vertex buffers within torque using a custom SceneObject. Then you can move onto a more complex object that would handle the L-System. If you want to create a respositry of L-System objects at start-up and then have objects to render those then I would suggest you have a L-System manager with seperate L-System objects to render stuff from it's database.

I will endeavour to put a basic object that has a render function you can just start doing work in it over the next few days. If I forget then you have my permission to bug me until I actually do it for you.

As I say, this is an interesting idea and you deserve some help.

- Melv.
#4
09/05/2002 (4:49 am)
Thanks a lot Melv!!!!

I will study the SceneObject code while I wait for your input.

I'm truly greatfull for this help!

:)
Bendik
#5
09/06/2002 (3:01 am)
In the meantime you should download and play with this...

Procedural Tree

- Melv.
#6
09/06/2002 (6:39 am)
Hehe, thx Melv.

If you look closely at my poster (at my project page)
You'll see that I have already modified the nVidia "Procedural Tree" code to prove my concept. (I made the poster in May for a presentation day at my Uni.) The tree on my poster is from this code. One was from the original, and the other is slightly modified to include a little manual texturification*.

The tree from nVidia contained 512134 polygon and had almost the same visual quality as my (manually) texturified* tree with only 7030 Polygons.



*I defined the word 'texturification', as the process of taking a complex polygon model, create textures from it, and then use these textures to create a simplified model of the original.
#7
09/09/2002 (7:41 am)
Quote:I will endeavour to put a basic object that has a render function you can just start doing work in it over the next few days. If I forget then you have my permission to bug me until I actually do it for you.


*bugging*

:)
#8
09/09/2002 (7:56 am)
I'd love it if there was an object where you could tell it to draw poly's/etc

Maybe if you made the object have functions that do such things as draw poly's/rotate poly's/draw shapes (all from the object's origin), it'd have quite a few uses...
#9
09/09/2002 (9:29 am)
@Bendik: I will do it tonight and email you later. ;)

@Stuart: Actually, the reason I'm so interested in what Bendik is doing is because I had an idea about something similar. The idea is that you could used something like a LinderMayer system to control a set of animated shapes/particles. I thought this would be useful for creating general effects using L-System scripts with this generic object.

It would be most excellent for RealmWars spells etc.

- Melv.
#10
09/09/2002 (2:18 pm)
Bendik,

Here's what I've done for you (and others).

Hope you find it useful.

- Melv.
#11
10/01/2002 (8:12 am)
Hi melv!

I'm slowly getting somewhere:
www.student.dtu.dk/~c958608/pines.jpg
...But I have a few questions.

1) How do you enable collision with the bounding box.
2) How do you enable two or three textures? (I'll probably figure this out myself...one day.)

3) How do you enable shadows.
....3a) Static Shadows, and how do you set the rez.
....3b) Dynamic Shadows (not that I need them)

and last but not least!

4 How do I enable LOD (preferably with blending)
#12
10/01/2002 (8:24 am)
Bendik, so these trees are generated mathematically, on the fly?? That would be AWESOME!
Could you post some more details to that screen?
Thx!! :)
#13
10/01/2002 (8:40 am)
That is correct Stefan!

It's is a Lindenmayer system that generates the trees. The problem is that they tend to become very heavy on the computer. My project is about optimizing this for realtime use.

I have made a poster on the concept that you can look at:bendik.stang.com
(somewhere on the middle of my webpage)
#14
10/01/2002 (8:49 am)
Bendik,

It would be possible to internally generate them as DTS shapes. This way you could include everything that the modeller programs support including collisions, animation etc.

You would probably want to project the leaf polys onto a much simpler poly structure that attached to the branches, perhaps tri-strips etc. Perhaps this kind of consolidation could be part of your L-System scripts. At some recursion point onwards all geometry would end up being projected onto a plane which itself gets added to the system rather than the original geometry itself.

Another way and perhaps simpler would be the ability to add a textured billboard axiom that would add the leaf-clusters to save geometry. This way you could add anything from leaves to apples!

Nice work so far. Keep going. 8)

- Melv.
#15
10/01/2002 (8:54 am)
I just looked through your web-page again and I noticed that you mention projecting your system on planes anyway.

Is this what we are seeing here or is it the full geometry itself?

- Melv.
#16
10/01/2002 (9:35 am)
This is the first level of projecting polygons onto a texture (Texturification). The trees on the image have a very high level of detail, but not the highest (fully polygonal)

:)
#17
10/01/2002 (10:05 am)
Excellent. 8)

- Melv.
#18
10/01/2002 (10:32 am)
Here is an example of the trunks

www.student.dtu.dk/~c958608/deadForestT.jpgLarge Version

www.student.dtu.dk/~c958608/deadForest2T.jpgLarge Version



I copy-paste them, and the random iterator makes each trunk unique.

[edit]
I updated the image with the new vertex shading that allows the lower part of the trunks to be darker and slightly green.

The amount of trees here causes a drop around 5-6 fps [/edit]
#19
10/01/2002 (1:06 pm)
This looks really cool; what sort of performance are you getting from these trees?

I can't help but think that combining this with something like the foliage object that Melv wrote would be really cool... A lot nicer looking than the same grass strip repeated over and over.
#20
10/01/2002 (3:10 pm)
Guys, this is awesome stuff !!!!
Page «Previous 1 2