Poll & Discussion: We wish the site to continue (Y/N)
World of Tanks Map format.
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
Ok...
I fixed the z-buffer fighting..
I draw the decals after the sky dome and before anything else.
1. shut off rendering to color buffer.. leave z-buffer writing on.
2. draw all the decals.
3. turn off depth testing.
4. turn writing to color buffer back on.
5. draw decals again.
It sucks because I have to draw them twice WITH textures or the entire decals mesh blocks the rendering of the terrain.
.
I fixed the z-buffer fighting..
I draw the decals after the sky dome and before anything else.
1. shut off rendering to color buffer.. leave z-buffer writing on.
2. draw all the decals.
3. turn off depth testing.
4. turn writing to color buffer back on.
5. draw decals again.
It sucks because I have to draw them twice WITH textures or the entire decals mesh blocks the rendering of the terrain.
.
I'd love to change the world but I can't get my hands on the code.
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
I have a couple of new problems...
1. When the underlying terrain is very contorted, the decal doesn't wrap the decal mesh unless its very tessellated.
2. I am not sure how to fix the order the decals are rendered. I think there was a value in the original chunk files that was called 'priority'. This is probably still in the space.bin.
3. Blending the terrain with the decals is proving to be on hell of a bitch. The color mismatch is amazing.
I can solve problem 1. but will slow the load of the decals to a crawl.
Basically it would goes like this:
Adjust the tessellation of the decal's mesh based on the contortion of the underlying terrain.
This could be done by creating a medium poly mesh and deform it to the terrain and after, check how extreme the X, Y and Z points move across the mesh. This would work but is very slow. The time killed is coming from finding the point's Y location on the terrain mesh. I am pondering the idea of creating some kind of lookup table to get get rid of the brute force method I'm using to find what grid the point is in.
I was adjusting the tessellation based on the scaling of the decal but this has proven to fail horribly.
Anything under 32x32 and it wont deform accurate enough and... even at this scale, on rough terrain, some of it breaks through the decal's mesh.
1. When the underlying terrain is very contorted, the decal doesn't wrap the decal mesh unless its very tessellated.
2. I am not sure how to fix the order the decals are rendered. I think there was a value in the original chunk files that was called 'priority'. This is probably still in the space.bin.
3. Blending the terrain with the decals is proving to be on hell of a bitch. The color mismatch is amazing.
I can solve problem 1. but will slow the load of the decals to a crawl.
Basically it would goes like this:
Adjust the tessellation of the decal's mesh based on the contortion of the underlying terrain.
This could be done by creating a medium poly mesh and deform it to the terrain and after, check how extreme the X, Y and Z points move across the mesh. This would work but is very slow. The time killed is coming from finding the point's Y location on the terrain mesh. I am pondering the idea of creating some kind of lookup table to get get rid of the brute force method I'm using to find what grid the point is in.
I was adjusting the tessellation based on the scaling of the decal but this has proven to fail horribly.
Anything under 32x32 and it wont deform accurate enough and... even at this scale, on rough terrain, some of it breaks through the decal's mesh.
I'd love to change the world but I can't get my hands on the code.
-
SkaceKachna
- advanced
- Posts: 66
- Joined: Thu Jan 14, 2016 11:32 am
- Has thanked: 9 times
- Been thanked: 19 times
Re: World of Tanks Map format.
I never actually delt with decals, but wouldn't it be possible to add new texture to map and use uv2 coordinates instead of separate mesh?
-
SkaceKachna
- advanced
- Posts: 66
- Joined: Thu Jan 14, 2016 11:32 am
- Has thanked: 9 times
- Been thanked: 19 times
Re: World of Tanks Map format.
By the way, how did you extract the trees? I noticed some inidices in .ctree file, did some random tries and discovered that there is
2x:
number of vertices
vertices, each 54 (x,y,z,nx,ny,nz,u,v ... ?)
number of lods .. for each lod
number of indices
.... indices ...
this works perfect, first model is root, second model are branches, but then there is different format:
1x:
number of vertices
vertices, each 88 (x,y,z,nx,ny,nz,u,v ... ?)
number of lods .. for each lod
number of indices
.... indices ...
it appears that there are 3 vertices on same position ... is there something hidden inside those 88 bytes?
2x:
number of vertices
vertices, each 54 (x,y,z,nx,ny,nz,u,v ... ?)
number of lods .. for each lod
number of indices
.... indices ...
this works perfect, first model is root, second model are branches, but then there is different format:
1x:
number of vertices
vertices, each 88 (x,y,z,nx,ny,nz,u,v ... ?)
number of lods .. for each lod
number of indices
.... indices ...
it appears that there are 3 vertices on same position ... is there something hidden inside those 88 bytes?
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
There are 3 different types in the ctree data
Let me find my notes...
I normally NEVER do this but be cause you have been a fantastic asset at figuring out the space.bin..
Here ya go... The attached is my code to build the trees.
Look at the last sub.
The thing about these files.. I could never find any thing the explain what the next chunk is..
Is it a Trunk? Branch? Leaf? Frond? Bill-board?
I do it by looking at that data that's there.. If a file name is before the data.. blah blah blah.. Its a mess.
There are 4 types and 2 different types of node formats.
Let me find my notes...
Code: Select all
'This took days of looking at hex to figure out..
'As im typing this, it has been 2 weeks of constant
'work. In the end.. I guessed at what the data was
'and got it working.
'There are differet vertex data types in each file
'and they change depending on the plants geo.
'I have no idea how to pre-detect the types so..
'the code branches depending on what it finds.
'Not the best way but it works ok.
'There are still a few trees that are not created 100%
'
'ctree files are pre-calculated tree structures.
'
'Alot of the code is hacked together to get things to work
'due to the fact that there are so many different variations
'of the same thing. Why it's like this, I have no idea.
'
'It creates (if its there)
' 1. trunk/branch models
' 2. Fronds. Some look like small branches.
' 3. Leafs. Some trees have no leafs such as Palms
' 4. 360 degree view billboards.
'Here ya go... The attached is my code to build the trees.
Look at the last sub.
The thing about these files.. I could never find any thing the explain what the next chunk is..
Is it a Trunk? Branch? Leaf? Frond? Bill-board?
I do it by looking at that data that's there.. If a file name is before the data.. blah blah blah.. Its a mess.
There are 4 types and 2 different types of node formats.
You do not have the required permissions to view the files attached to this post.
I'd love to change the world but I can't get my hands on the code.
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
You will need to create an array to store the crap in.. A structure.. or data type..
Also.. There is a tree_cache.
I never RELOAD a model that's already been loaded.. I look in the cache.. if its there I get its Id's..
If I have to load it.. I add it to the cache after its loaded
Also.. There is a tree_cache.
I never RELOAD a model that's already been loaded.. I look in the cache.. if its there I get its Id's..
If I have to load it.. I add it to the cache after its loaded
I'd love to change the world but I can't get my hands on the code.
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
This sounds ok until you get close to the decal than it will become very blurred.SkaceKachna wrote:I never actually delt with decals, but wouldn't it be possible to add new texture to map and use uv2 coordinates instead of separate mesh?
I fixed some of the order issue.. I was right about the priority.
If its 1, it gets drawn first. So.. I sort them after getting them from the WGSD section.
I'd love to change the world but I can't get my hands on the code.
-
SkaceKachna
- advanced
- Posts: 66
- Joined: Thu Jan 14, 2016 11:32 am
- Has thanked: 9 times
- Been thanked: 19 times
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
No problem..SkaceKachna wrote:Thanks for all the info! I have a feeling this will be long night...
Don't forget to thank me
I'd love to change the world but I can't get my hands on the code.
-
Mr.Mouse
- Site Admin
- Posts: 4059
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 439 times
- Been thanked: 642 times
- Contact:
Re: World of Tanks Map format.
In Terra, the colours and map looks like this (not right). Should it be better?
You do not have the required permissions to view the files attached to this post.
-
SkaceKachna
- advanced
- Posts: 66
- Joined: Thu Jan 14, 2016 11:32 am
- Has thanked: 9 times
- Been thanked: 19 times
Re: World of Tanks Map format.
Trees loaded!
https://i.imgur.com/UeQn82z.jpg
I found out, that the leaves aren't supposed to be treated as mesh, but billboards that always face camera (you can see that in the offline map viewer - thanks for that tip!). (You basically take the 4 vertices, use their UV values to get correct image in texture, position is always same so only add position once)
This type of billboards is often used for particles and GL have built-in support for this. Bascially you create geometry, where every vertice is separate position where the billboard will be drawn and material that has map, which will be the billboard. I don't know any specifics about implementation as I use gl wrapper to make things easier...
https://i.imgur.com/UeQn82z.jpg
I found out, that the leaves aren't supposed to be treated as mesh, but billboards that always face camera (you can see that in the offline map viewer - thanks for that tip!). (You basically take the 4 vertices, use their UV values to get correct image in texture, position is always same so only add position once)
This type of billboards is often used for particles and GL have built-in support for this. Bascially you create geometry, where every vertice is separate position where the billboard will be drawn and material that has map, which will be the billboard. I don't know any specifics about implementation as I use gl wrapper to make things easier...
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
So you are drawing a leaf at every one of the 4 vertices?
EDIT.. I get it.. it's a view aligned quad.
I'm a little lost but your trees look better than mine
And NO Terra is NOT like that.. some thing is for sure wrong with loading the models..
I'm still struggling with the decals.. I am almost done though.
EDIT.. I get it.. it's a view aligned quad.
I'm a little lost but your trees look better than mine
And NO Terra is NOT like that.. some thing is for sure wrong with loading the models..
I'm still struggling with the decals.. I am almost done though.
I'd love to change the world but I can't get my hands on the code.
-
Mr.Mouse
- Site Admin
- Posts: 4059
- Joined: Wed Jan 15, 2003 6:45 pm
- Location: Dungeons of Doom
- Has thanked: 439 times
- Been thanked: 642 times
- Contact:
Re: World of Tanks Map format.
Okay, is that some setting I must fix, or is Terra in need of a fix?Coffee wrote: And NO Terra is NOT like that.. some thing is for sure wrong with loading the models...
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
Its broke..
Sorry..
You could try playing with the light levels..
It looks like everything is whited out.
Sorry..
You could try playing with the light levels..
It looks like everything is whited out.
I'd love to change the world but I can't get my hands on the code.
- Coffee
- ultra-veteran

- Posts: 518
- Joined: Thu Aug 06, 2015 5:57 pm
- Has thanked: 74 times
- Been thanked: 205 times
Re: World of Tanks Map format.
Can you post how you handle this?SkaceKachna wrote:Trees loaded!
https://i.imgur.com/UeQn82z.jpg
I found out, that the leaves aren't supposed to be treated as mesh, but billboards that always face camera (you can see that in the offline map viewer - thanks for that tip!). (You basically take the 4 vertices, use their UV values to get correct image in texture, position is always same so only add position once)
This type of billboards is often used for particles and GL have built-in support for this. Bascially you create geometry, where every vertice is separate position where the billboard will be drawn and material that has map, which will be the billboard. I don't know any specifics about implementation as I use gl wrapper to make things easier...
Are you passing an Index to the shader?
I'd love to change the world but I can't get my hands on the code.
