Games Support Forums BioWare Info My Account Login Community Sign Up Store
Neverwinter Nights 2 Forums

NWN2: Custom Content

New Topic    Post Reply

Go to Page ( 1 , 2 , 3 , 4 Next )

    Add this To My Topics

   Go To Bottom

Author Custom Speed Tree (images included)
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Friday, 08 August 2008 05:44PM
Click for image...

Dose anyone know if making custom speed tree files for NWN2 is acceptable? I seem to recall that the company that created them has a very strict policy towards those. I've visited their page and the only restrictions they make seem to be directed more to the code used by the game than the file type itself... However I would prefer if someone could clear this up for me. Possibly some passing by Dev? Please?

Well... after a month of fighting this little bugger in Notepad and HexEdit I think I have managed to create a unique and fully working speed tree (well... see below for issues). If everything is ok with this I should be able to deduce quite some things about the files structure and post it for community use, eventually.

For now I've figured out most of the trunk area...
And the Shrooms are just a trunk with nothing else added... or rahter everything is there (identical to the content of LiveOakW.spt which was used as a base for this) just does not display...

Current issues:
- Smoothing issues around topmost part of Shroom... could be ST inherent problem...
- Capping issue around topmost part of Shroom... same as above...
- Texturing issues... it seems that for those little twig things and leaves some sort of atlas reference is used... This might make certain things a... bit more complicated.
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
Flailer
Game Owner
Profile: FlailerNWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 08 Aug 2003
Posted: Friday, 08 August 2008 08:47PM
That is *fantastic*! That holds all sorts of possibilities.

How would the custom files be included? In a HAK or would they need to be plunked down in the NWN2 content directory itself?
  Profile: Flailer   Send Message To: Flailer
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Friday, 08 August 2008 08:53PM
I have it working from override for development's sake...
Seems it should be possible to .hak it...
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
Lokey_
Game Owner
Profile: Lokey_NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Mar 2006
Posted: Friday, 08 August 2008 09:04PM
hak is just repackaging the override files: probably model, speedtree.2da and textures. There might be engine issues about it, never tried.

Very good job. Did you learn enough that you could look into other models without it being a "month long" process?
  Profile: Lokey_   Send Message To: Lokey_
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Friday, 08 August 2008 09:10PM
I have a life you know. :shades: But yes. The only last issue is how exactly the texture atlas is stored. Even without that I'll get to making some new trees and a tutorial.

You won't believe how poorly written those files are.

As for the files:
trees.2da
a number of .spt files.
a number of .dds atlases with the twigs and leafs
a number of .tga textures, two for each tree, diffuse and normal.
Engine has no issues with new trees, as well as no issues with padding the .2da up to line 512.
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Saturday, 09 August 2008 10:30AM
Demo Shroomies in the Toolset...

Well... Everything seems to be going fine...
Slowly working out how all those branches work.
I think however that this is a good time to brag about the core of editing these files.

Did anyone here maybe opened one of these files in a NotePad to take a look at the structure?

You should notice quite a lot of the data seems to be represented by formatted strings, while the rest is binary.
Curiously the strings are perhaps the most important part of these files and it's VERY easy to edit them...

Here is the beginning of the file describing the winter live oak tree:

In EditPad...
In HexEdit...

Note the binary file... the number of bytes in the black area is equal to the number in the frame - 94, where those numbers different the toolset would crash.
However if you take care to change that value after editing the textual section you'll be able to edit the Bezier curves describing the various properties...

The Bezier curve is defined as followed:

BezierSpline [Min Range] [Max Range] [Chaos]
{
[Number of Points]
[X Point] [Y Point] [X Weight Dir] [Y Weight Dir] [Weight Dist]
...
}[New Line]

The one featured here controls the... I don't know how to call it... but the greater those values are the more non-straight the tree trunk is.

I'll be back later with more information... about how to read the Spline data...
Everything clear so far?
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Saturday, 09 August 2008 11:29AM
Reference image for Spline point values...

[Min Range] - Minimal value for property
[Max Range] - Maximal value for property

Note: the spline will link both values.

[Chaos] - Percentile chaos value for the Spline points might mean different things depending on what the Spline controls, for example if it's trunk thickness this will result in random thickening in various points of the trunk.
[Number of Points] - Number of points in Spline no less than 2, I never got beyond 5 because there isn't really any reason for that...
[X Point] - X coordinate of point, never less than 0, never more than 1.
[Y Point] - Y coordinate of point, while it also tends to stay between 0 and 1 this should not be considered a rule.

Note: It should be noted that ALWAYS the first point has X=0 and often Y=1 while the last point will always have X=1 and often Y=0, the X coordinate usually refers to the trees hight, while Y usually adjusts the value of a given parameter for a given hight on the tree (or branch)...

[X Weight Dir] - Weight direction X offset.
[Y Weight Dir] - Weight direction Y offset.
[Weight Dist] - Offset amount, distance from weight point to point of origin (see image!).

Note: Usually the sum of squares of both offsets will be equal to about 1 meaning that they are points on a circle with a radious of. This is however not mandatory. It just needs to point towards some kind of direction. The last value will actually determin the weights strength. The higher that value the more the curve will try to run in that direction.

To fully understand how this works you should read more about Bezier Splines... It's not a very complex subject...

Again, I'll be back later with a list of which spline does what... at least for the trunk for now.
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Saturday, 09 August 2008 03:12PM
Back with more information...

As far as the trunk goes there are two classes of data. The first, easier to identify is that stored in the Bezier curves... The rest is more tricky and I have yet to identify all of them...

However in this post: meaning of splines.
The entries that relate to the trunk are the first nine (later it hummm... partially iterates)

Spline 1: How much the trunk bends. First two values are always 0 and 1... then we have the strength of this property and the curve that defines how much it influences what part of the tree... this works the same way for each parameter, if it's not obvious I will explain later...

Spline 2: This controls the weight of the trunk. The higher theses values are the more the trunk bends down under it's "weight". Interestingly negative values are acceptable and work as if the tree had negative weight... It should be noted that both first values are usually equal.

Spline 3: This spline controls how much vertexes are affected by wind. However interestingly there is a second spline that has a more subtle effect... This is because both the first values are equal thus rendering the spline as useless... I'm not sure how redundant this is. Observations show that it's persistent between various files.

Spline 4: This tweaks the previous value... first two parameters are always 0 then 1. It is best to set the general wind response using the above one, and then adjust it based on hight with this... I think...

Spline 5: This is the size of the tree, first two values are equal and represent the trees medium size, the third value defines how much this might change... All other data seems redundant or unused... (On a side note: there are just things that seem to be unread or break things... I don't know... a Dev would need to answer this.)

Spline 6: This controls the thickens of the tree it also affects branches but... not sure how this works exactly. Best to first get a good looking trunk, then work on other things. First two values equal, medium thickness, second is variation among trees... rest seems unused...

Spline 7: This is the thickness of the tree based on hight. The exact thickness on any hight is based on this multiplied by the previous... or something like this. First two values are 0 and 1, third is percentile variation, spline point data is most important!

Spline 8: This seems to control very little... I'll try to explain though... it's the angle at which the tree grows out of the ground. Curiously to make it grow up the value must be -90... changing it to 90 makes the tree grow down effectively creating a hanging tree... might be potentially useful... first two values are equal, second is variation. Most of the time it's -90 -90 0...

Spline 9: I'm not sure about this one... in the original files it's usually disabled... having the first values as 0 1 0... Either way messing around with this adds some sort of disturbance into the trees profile. Possibly should be left alone.
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Saturday, 09 August 2008 06:48PM
The remaining parameters that I am SURE of are stored between the 8 and 9 Spline...
Open the file in binary mode... This string of values will follow:

78 17 00 00 [Cross section as int]
79 17 00 00 [Length section as int]
7A 17 00 00 [Start Branch gen as float]
7B 17 00 00 [End Branch gen as float]
7C 17 00 00 [Branch density as float]
7D 17 00 00 [Horizontal tiling]
7E 17 00 00 [Vertical tiling]
7F 17 00 00 [Texture alignment]

Each of this values will be written as ?? ?? ?? ??.

The first two define how many polygons the element will have. This are obvious I think...

the next three are more crucial. First two define where the branches will grow on the trunk. The whole trunk is a range of numbers from 0 to 1, these values will need to be from this range and the first must be smaller than the second. for example having them as 0.5 and 0.75 means that branches will start growing above half of the tree and up to three quarters. The last one is the density of branches. Not literary the number of branches that will grow but rather some sort of "spawn chance".

The next two refer to texturing. It's how many times the texture will tile on the mesh, horizontally and vertically.

Texture alignment is different, it will look something like this: [Horizontal align] ?? ?? ?? ?? [Vertical align] ?? ??. Both can be either 00 or 01. What they do is align the texture so it does not get a random offset.
I'm sure that the other values must have some meaning but I either couldn't find one or they caused the toolset to crash.

I'm afraid you'll need to find a tool for converting float on your own...
I suggest getting some good Hex Editor or some training.

Reflection on life: OH MERCIFUL GODS WHAT AM I DOING?
PS: someone please make me some tea...

There... this is the basic... with this and some common sense anyone should figure out the rest, because as I mentioned nearly to the very bottom of the file it itterates threw the various levels of the tree - usually trunk -> branch -> twig.

If all is clear here I'll get to writing a proper HOW TO.
And making some trees...
M'yes...
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
Banshe
Game Owner
Profile: BansheNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ


Joined: 17 Dec 2002
Posted: Saturday, 09 August 2008 07:22PM
Nice work. I don't understand most of it but... A how to for those who wish to work with Speedtree would be great. The more knowledge collected about NWN2 CC, the better.
_________________
Looking to join a PW? Come to this one stop shop for connection info, server rules and server description:

Click Here
  Profile: Banshe   Send Message To: Banshe
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Sunday, 10 August 2008 09:27AM
New tree...

Now complete with new twig and leaf texture...
Ok... not new, they're only recoloured but that means two things:
a) It's possible to use custom ones as long as the atlas layout is identical to the original one.
b) The atlas is stored on the .spt file...

Currently working out leafs and twigs and such...
It seems that the twigs are linked to the last used iteration of the Spline data. However because they are not cylinders but two sided planes the various properties will most likely work completely differently... or maybe not that differently.
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Sunday, 10 August 2008 06:16PM
Things not going so well with the last part of the file...

At least I've got something that is most crucial to constructing new tree models: the size of the leaf planes:

At the bottom of the file you'll get two references to textures that do not actually exist... this is somehow linked threw the atlas to a .dds file with the same name as the .spt file... That's however not very important. Some of these textures (usually two) will refer to leaves/blossoms... something along those lines. The file names will end with .tga of course. To change the scale of a leaf do as followed:

Find those texture references. Open up a binary editor.
You'll have the scales in such a pattern:

There will be the ".tga" that ends the texture name. After this there are FIVE words (4B each, 20B total) and then two identical float valus that will define the leaf scale.

Simple, no?
This is about all I found important to make new trees.
Of course everything can be still vastly improved. maybe even someone could make a editor.



More Shrooms...

- Done
* In progress

Shrooms:
- Giant Bolete
- Titan Bolete
- Candelabrum Fungi
- Common Mushrooms (3 colour variants, come in clusters)
* Several other giant fungi, different colour/shape.
Trees:
- Weird Tree
* Ground roots for some of the more popular trees
* Higher poly versions of some of the trees
Other:
* Roots hanging from ceiling.

Suggest something, m'kay?
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
MokahTGS
Game Owner
Profile: MokahTGSNWN
NWN: SoU
NWN: HotU
NWN 2
NWN 2: MotB
NWN 2: SoZ
Mass Effect PC


Joined: 17 Nov 2001
From: Right behind you...
Posted: Sunday, 10 August 2008 06:41PM
I have a question: Could the same thing be done for crystals?

They grow as well and come in all sorts of varieties. They would make a neat addition to a cave system.
_________________
Mokah - The Grumpy Strumpet
| Dear Strumpet | | Jabberwocky Blog |
  Profile: MokahTGS   Send Message To: MokahTGS
973_Mops_379
Game Owner
Profile: 973_Mops_379NWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 03 Nov 2004
From: Poland
Posted: Sunday, 10 August 2008 06:51PM
Issues I see:

1) ST auto smooths all surfaces.
2) ST models do not support glow maps and transparency.

I can do a crystal cluster MESH as a .spt. I just don't see a way to make it look really good and crystal like. Possibly it's something that is better left as a traditional model.

However if you like... It should only take a hour or two.
  Profile: 973_Mops_379   Send Message To: 973_Mops_379
Flailer
Game Owner
Profile: FlailerNWN
NWN: SoU
NWN: HotU
NWN 2


Joined: 08 Aug 2003
Posted: Sunday, 10 August 2008 09:48PM
Great stuff!

Some suggestions:

- Vines? Either groups of hanging vines or single large winding sorts of vines you'd find in a jungle going up to the canopy.

- Crops

- Trees with a bit more movement to them. Imagining a forest where you feel like the trees would reach down and grab you.

- Trees with exposed roots that could be wrapped around buildings, like that of the silk cotton trees at Angkor, Cambodia.
Click Here

- Not sure if it's possible with the settings, but broken trees/tree trunks.

- Large thick clumps of tall grasses

- Trees with vines hanging from them

- carnivorous plants like giant pitcher plants, venus flytraps, or your own creation.

Just some ideas - maybe more depending on how much the system can be pushed.

Edited By Flailer on 08/10/08 21:51

  Profile: Flailer   Send Message To: Flailer

Go to Page ( 1 , 2 , 3 , 4 Next )

New Topic    Post Reply

What do these icons mean?
Where can I learn how to use the forums?

Jump To:

Search Forums | Forums FAQ | Forum Archives

 

 

  Visit the Official Site | Technical Support
Neverwinter Nights 2 Official Support
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

5,994,347 Users
549 Online
58 Logged In

9,000,903 posts in forums

Newest Forum Topics:
1. M.O.W. Internet needed? (NWN2: General discussion forums for NWN2 (No Spoilers Allowed))

2. Script control of encounters? (O... (NWN2: Builders - NWN2 Scripting)

3. Do i need to play BG 1? (Baldur's Gate II: SoA and ToB General Discussion)

4. Memorized Spells ui modification (NWN2: Custom Content)

5. My Dm's Can't log in, DM Client ... (NWN 1: Server Admin)


Current time is: (set time)
Tue, 09 February 2010 08:48PM