Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Speedtree texture and collision tips
06-22-2010, 11:16 PM,
#1
Speedtree texture and collision tips
I've made a few discoveries about Speedtree use in Oblivion: the limitations and a few workarounds. First, the only readily available Speedtree editor is SpeedTreeCAD (Lite) 3.4. There are a few differences between the trees this can produce and what Oblivion supports

Oblivion doesn't support fronds. It also doesn't support any of the fancy stuff in later versions of SpeedTreeCAD - so you don't need any version later than 3.4. Locating that is left as an exercise for the reader - but it's out there.

SpeedTreeCAD (Lite) doesn't enable collision editing or composite textures.

Fronds we can live without, but composite textures are what makes in-game speedtrees look so good, and you do look a bit daft if your character suddenly disappears inside a tree-trunk. So this note is mainly about the workarounds.

The biggest single thing is to start from a game tree. This will allow you to re-use the collision and also to kludge the composite leaf texture. So pick a tree with the right general characteristics for the one you want. The vanilla tree collisions are all just bubbled around the base of the trunk, but the shapes and sizes vary. Switch collision geometry on in the CS (f4) and find a tree you like. I've yet to understand the seasonal trees - those that finish SU, FA, and WI - I think the game may automagically switch between these through the year but I haven't looked into that.

I want a pretty big tree, with a nice fat base, and the common three-texture composite map, so I'm going to start from TreeBlackLocust. I'm making a Jungle tree for Black Marsh, so I'll create a folder called BmMdTreeJungle01 into which I'll put a copy of treeblacklocust.spt, and rename it to BmMdTreeTropical01.spt.

When starting from scratch, also put in a copy of treeblacklocustleaves.dds, edit it in gimp and extract each of the three texture sections to .tga files. These three files are the key to getting a composite texture map to work. SpeedTreeCAD never looks at the real composite texture - it looks at these three files, so you need to know what they're called - and it won't tell you: it'll just display the missing textures warnings and prompt for the filename. And if you change the filename, it breaks the embedded composite map.

But the real names of the files are written in the .spt file in clear text: so you can work it out! Using whatever editor you like, search the .spt file for .tga files. Don't change anything, just note down the texture files. SpeedTreeCAD also ignores any file paths, so you just need the names. For the Black locust there are four textures:
TreeBlackLocustLeaves01.tga
TreeBlackLocustLeaves01.tga
TreeBlackLocustLeaves01a.tga
TreeBlackLocustLeaves01b.tga

And yes - two of them are the same. Rename your three texture files to match. You'll probably need to play around, but I think TreeBlackLocustLeaves01.tga is the big one at the bottom, and the other two can be either way round.

You should now be able to open the .spt file. You then just need to morph the model to suit the tree you're actually making.
Morcroft Darkes
Reply
06-24-2010, 12:04 PM,
#2
RE: Speedtree texture and collision tips
Thanks for sharing these useful tips. :yes:
Dum loquor, hora fugit  - While I speak the time flies



Ovid 43 BC - 17 AD
Reply
07-07-2010, 09:55 PM,
#3
Further investigations
Collision geometry is even tetchier in SpeedTree CAD Lite than I first suspected. Not only can you not edit the collision geometry of a tree, it also won’t always save the geometry you start with.

There seem to be two general types of speedtree collision geometry available. There’s a default geometry that most game trees use. This consists of a “capsule” (cylinder with hemispherical ends) which is the same diameter as the trunk and some proportion of its height. The proportion seems variable, but might be around 1/3, and is set in original game models. This type of collision is retained when you save a tree based on a game original.
The other sort of collision geometry seems to be a “custom” type and is used in the various Cameron Paradise and Mania trees. This seems to be stripped out if you re-save a game tree.

Since we can’t work with custom collisions, we have to make the best use we can of the capsule collisions. This is fine for most regular trees, unless you need a really short trunk. In this case, the capsule seems to work OK until you make the trunk so short that it becomes a sphere. Any further than that and the collision will fail to be created.

One more thing while I think of it: I've heard it said that Oblivion doesn't use normal maps for SpeedTrees. This isn't quite true. It doesn't need a normalmap for branch textures - but it will use one if it finds it, and the result is much better.

Oh, and you're welcome, Sandor!
Morcroft Darkes
Reply
07-08-2010, 01:29 AM,
#4
RE: Further investigations
Quote:Originally posted by morcroft
Collision geometry is even tetchier in SpeedTree CAD Lite than I first suspected. Not only can you not edit the collision geometry of a tree, it also won’t always save the geometry you start with.

There seem to be two general types of speedtree collision geometry available. There’s a default geometry that most game trees use. This consists of a “capsule” (cylinder with hemispherical ends) which is the same diameter as the trunk and some proportion of its height. The proportion seems variable, but might be around 1/3, and is set in original game models. This type of collision is retained when you save a tree based on a game original.
The other sort of collision geometry seems to be a “custom” type and is used in the various Cameron Paradise and Mania trees. This seems to be stripped out if you re-save a game tree.

Since we can’t work with custom collisions, we have to make the best use we can of the capsule collisions. This is fine for most regular trees, unless you need a really short trunk. In this case, the capsule seems to work OK until you make the trunk so short that it becomes a sphere. Any further than that and the collision will fail to be created.

One more thing while I think of it: I've heard it said that Oblivion doesn't use normal maps for SpeedTrees. This isn't quite true. It doesn't need a normalmap for branch textures - but it will use one if it finds it, and the result is much better.

Oh, and you're welcome, Sandor!

Actually morcroft, about a week ago, I figured out how to add custom collision to speedtree objects that don't even usually have them - like the shrubs. I figured this out for Craftybits team at The Wormhole, so they can eventually make harvestable shrubs and get custom ingredients from them, to further their crafting mod.

I'm pretty sure my method will work for custom trees, too, and any custom collision shapes they may need.

The thing that will probably have one slamming their head on their desk in disbelief, is that the method to give these trees and shrubs is SOOOO simple and easy - and that you don't even need speedtree to implement it at all.

Basically, go to "meshes\trees\..." folder in Oblivion , and you'll see the collision nifs that certain trees use. The thing is, a lot of trees are somehow hardcoded, to use the existing collision nif of a tree already in that "meshes\trees..." folder. HOWEVER, I found that if you take, say, the existing "treecottonwoodsu.nif", and save a new copy in same folder that has been renamed to "shrubinkberrysu.nif" - all of a sudden, the shrubinkberrysu.spt has collision in the game, where previously it did not. You basically need to make a copy of an existing collision nif, then rename it to exactly what the .spt file name is for the same shrub/tree you're trying to add collision to, and keep that newly named nif in same folder as the vanilla tree collision nifs.

YOu can even change the shape of the collision and collision layer: I've deleted everything below the bhkRigidBody of the treecottonwoodsu.nif, and added a bhkSphereShape for some shrubs. BUt I then thought that I couldn't walk through the shrubs this way when in the game. So I kept the bhkSPhereShape, and changed the bhkRigidBody's "Layer" and "Layer Copy" fields to OL_NonCollidable like the harvestable flora in the game uses, and I then could walk through the shrubs like normal.

Morcroft, I'll PM you some files and a document I made, that I also sent to Craftybits team.

I have not yet tested the collisioned shrubs in the game, nor tried to interact with them. But in the CS render window, when I pressed F4 to turn collision geometry on, the shrubs had the sphere shaped collision on them all of a sudden - so I'm thinking it also works in the game.

Koniption

EDIT:

I just now found this in the wiki:
http://cs.elderscrolls.com/constwiki/index.php/Tree

EDIT#2: Found the date on the above link. Nevermind, seems I was a little late to the party! lol
Yeah, don't let those little turds get you down. Dingleberries stick for a while, but eventually they fall off. Cool
Reply
07-08-2010, 08:39 AM,
#5
 
Thanks, Koniption - hugely useful :goodjob:

I handn't even thought to look for this stuff on cs-wiki Confusedlap: - it's a handy reference page; although I'd take issue with the Speedtree Seeds info there: I think the functionality for selection of seeds from the list is broken.

That page reminds me: billboards. The CS appears to set the size of the billboard to match the tree when the object is created, so I've now taken to scaling the speedtree export image up to 512x512, rather than resizing the image and filling in round the edges as Razorwing recommended in How to create billboards for Oblivion SpeedTree tree
Morcroft Darkes
Reply
07-09-2010, 07:50 AM,
#6
 
Again many thanks for sharing the info! :yes:
Dum loquor, hora fugit  - While I speak the time flies



Ovid 43 BC - 17 AD
Reply
07-09-2010, 08:06 AM,
#7
 
As always, you're welcome!

I prefer to get these odd snippets of information noted down somewhere - if only so I can find them again when I need them, and since this isn't mod-specific the "Development" boards seem the most generally relevent place.
Morcroft Darkes
Reply
08-09-2010, 05:21 PM,
#8
 
@Koniption: So of course the next thing I try is loading a visible nif as the meshes\trees "collision" mesh - didn't seem to work as a quick attempt, though. Have you tried that with any success?
Morcroft Darkes
Reply
08-10-2010, 03:13 PM,
#9
 
Quote:Originally posted by morcroft
@Koniption: So of course the next thing I try is loading a visible nif as the meshes\trees "collision" mesh - didn't seem to work as a quick attempt, though. Have you tried that with any success?

No, I've never tried that, if I understand what you are saying.

I can already think of what you're probably trying to do, and how it'd make life easier...... Cool ....

....if I'm guessing to myself correctly.

Can you PM me the visible nif you are working with, that you are having trouble getting to work? I'll try to troubleshoot it on my end, and see what I can find out.

Koniption
Yeah, don't let those little turds get you down. Dingleberries stick for a while, but eventually they fall off. Cool
Reply
08-10-2010, 05:20 PM,
#10
 
I think your guess is exactly right... Confusedhh:

Just tried it again, this time I actually placed the nif in-game as well as popping a copy in meshes\trees and renaming it to treesnowgumfree.nif

Checking in-game, the "real" nif is visible and, with tcg on, has the expected collision. The "snowgum" version only has the collision - no visible mesh. Looks like the engine simply doesn't bother with the visible mesh for speedtree collision meshes. Shame: would have been handy.

Mesh attached - there's nothing confidential about it - it's just a five-minute hack-together from ngplant. More work needed to make it useful. Maybe you can come up with something clever!
Morcroft Darkes
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)