www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: ToddMcF2002 on May 15, 2007, 05:30:40 am

Title: Leaves, Trees and Culling / Transparency in a Merged 3DS Level
Post by: ToddMcF2002 on May 15, 2007, 05:30:40 am
I started a tree and before positioning a 100 or so leaf clusters I decided (smartly!) to give it a whirl in JPCT and of course I've got a new issue now  ;D

Leaf transparency and culling.  I don't want to set the whole merged terrain to CULLING_DISABLED and setTransparency(X).

So how do I solve this issue with compound objects like this?  Do I need to load all trees seperately from the level or use a custom XML loader to generate the leaves for the tree on the fly using Object3D primatives?  Here is pic of my problem - the first leaf cluster lacks the appropriate transparency and culling properties.

(http://i187.photobucket.com/albums/x132/ToddMcF2002/leaf_issue.png)
Title: Re: Leaves, Trees and Culling / Transparency in a Merged 3DS Level
Post by: EgonOlsen on May 15, 2007, 09:01:30 am
Transparency and culling work per object. You can't merge a transparent object to a non-transparent and maintain the transparency. Such meshes need to be seperate objects. I suggest simply not to merge the trees into the level or (even better) merge the tree but keep the leaves separate if possible.
Title: Re: Leaves, Trees and Culling / Transparency in a Merged 3DS Level
Post by: ToddMcF2002 on May 15, 2007, 12:30:03 pm
I'm trying to figure out how to reasonably manage the leaves separately.  Algorithmic?

Title: Re: Leaves, Trees and Culling / Transparency in a Merged 3DS Level
Post by: Remo on May 15, 2007, 12:51:17 pm
If your leafs are prepositioned you can just separate the models by deleting the tree from the leafs and the leafs from the tree. If not you will need an algorithm :).
Title: Re: Leaves, Trees and Culling / Transparency in a Merged 3DS Level
Post by: ToddMcF2002 on May 15, 2007, 01:10:15 pm
Yeah I think I want to end up with two meshes - the tree (1) and the leaves as a collective canopy (2).  Technically the canopy parts don't have to even touch to be in the same mesh.  That will make the JPCT rotation easier and I can manage the culling and transparency seperate from the trunk.
Title: Re: Leaves, Trees and Culling / Transparency in a Merged 3DS Level
Post by: ToddMcF2002 on May 16, 2007, 04:22:07 am
Tree fixed.  For right now its using transparency and culling on the entire object which is pretty bad.  I think I need to write a developers kit soon so I can place objects on the terrain and record all the vector offsets and load from XML.  The convenient "mergeObjects" is just going to continue to cause problems especially for mover objects (thinking in old Unreal 1 terms)....

I'll update the project page with this shot - its all going to move pretty fast now.

(http://i187.photobucket.com/albums/x132/ToddMcF2002/treeshot.png)