Page 1 of 1

Treemesh Textures..how?

Posted: Tue Sep 21, 2010 12:55 am
by fo0k
Not really played with treemesh before.. so when I export my 'tree' it looses the textures... there is no rs file as such for trees so how does that shizzle work? :)

edit: and any thoughts on how to make the sway of the object (its not a tree) have network info so all players see the same position of the object?

Its something that people drive on... but i know that driving on rotation bundles was always messy when i have tried.. suddenly this treemesh option looked perfect!

but the online syncing is a problem..

little vid of it in action here: http://www.battlefieldmodding.com/wobblestunt.mp4

Re: Treemesh Textures..how?

Posted: Tue Sep 21, 2010 5:17 pm
by Apache Thunder
Loss of textures usually mean you either didn't have the materials set up right or tried to use textures nested in a sub folder. TreeMesh files can't use textures that are inside subfolder and must be in the main folder (except in the case of alternate texture paths like the Africa/Pacific folders).

But more likely you didn't set the materials up right. The texture materials that is. Each object in the treemesh must have it's own texture material and can't be a multi-object material shader that Max sometimes defaults on. RS materials don't get converted properly either, so you must convert them to "standard". Trunk meshes can't have alpha in them. Sprites and branches do however. I think setting up the opacity texture in max is optional as it's only needed if you want to see proper alpha in the max scene. I've looked through a treeMesh with a hex editor and only the main texture for the trunk, branch, sprite is stored and not any separate opacity texture. If the script didn't export the materials correctly you will notice that the path for the texture will simply read "texture/none" when viewed in a hex-editor, so this is the best indicator that your materials weren't set up correctly.

Just make sure your treemesh objects don't share material texture assignments and that they are set to the "standard" material in max and not the multi-object material. This is mainly the way the export scripts work that is the reason behind this and not really a limitation of the treeMesh system itself.

Sub-folder texture assignments *might* be possible if you use a long enough file name in the texture assignment. For example, you wish to use a treemesh subfolder for your treemesh textures. So you would need to name the textures something like this: treemesh_texturename.

Then open the tm after you export it with a hexeditor and replace the _ character with a backslash. You just can't add or remove charactors with the hexeditor as this will most likely brake the TM file. You will notice that the texture folder and an existing backslash is already there just as it is in a RS file, so this is why I believe that method should achieve sub-folder nested textures on a treeMesh. (of coarse after you finish hexediting the TM file, you would rename your texture so it doesn't have the treeMesh_ part in the file name anymore and is instead in the subfolder you had set up for it)

It may also be possible to assign a BIK to a treeMesh (just not on a sprite as I have already tried it and it didn't work). Just name the file name carefully so that you can replace the existing characters to path to it. You can create a video folder in the archives folder and put the BIK there as it will be easier to path to it. (just replace texture in the path with video. Just make sure you made the filename the right size so you don't end up having to remove/add anything to the path)

Also if you ever have to make a billboard texture, the filename is typically the same as the geometry template name of the treeMesh and should always be placed in the billboards folder found in the treeMesh rfa.


On the swaying behavior, I'm afraid it won't work the way you want it to. I have tested a palmtree that sways by throwing a sticky C4 on to it. The C4 doesn't follow the sway, so this means the collision mesh doesn't sway with the lod.

Unless your video uses rotational bundles. I believe adding a certain type of network info to rotational bundles should fix it. I need to look into existing code to see exactly how it should be coded though.

EDIT:

Try this as your network info for the rotational bundles:

Code: Select all

NetworkableInfo.createNewInfo ExampleInfo
NetworkableInfo.setPredictionMode PMNone
NetworkableInfo.setBasePriority c_NIGhostAlways
I think I've seen this used on a rotational bundle somewhere but can't remember. I do know that control points have this as well. It may also be that the game may have network issues in relation to the continuous rotation code that somehow doesn't work right in network play. Without network info, a rotational bundle will typically rotate 2 or more times faster then normal over network play then in singleplayer/for the host.

Re: Treemesh Textures..how?

Posted: Tue Sep 21, 2010 10:31 pm
by fo0k
Great info thanks. For the record, the flat rectangle in the video is treemesh and the car is clearly moving with the collmesh.. Unless you were meaning just when networked?

Re: Treemesh Textures..how?

Posted: Wed Sep 22, 2010 2:15 am
by Apache Thunder
Hmm...perhaps just sticky projectiles don't move with it. Odd since I do recall throwing sticky C4 onto a palm tree and the C4 didn't move. :P I guess it doesn't effect projectiles when they stick to it. :P

I don't think network info could help as the sway behavior wasn't something they would likely bother to add network coding for. :(