XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun Jun 25, 2017 11:44 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 261 posts ]  Go to page Previous  1 ... 13, 14, 15, 16, 17, 18  Next
Author Message
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 5:45 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times

Ok.. I found the solution.

I added this to the start of the program:
Code:
        Dim nonInvariantCulture As CultureInfo = New CultureInfo("en-US")
        nonInvariantCulture.NumberFormat.NumberDecimalSeparator = "."
        Thread.CurrentThread.CurrentCulture = nonInvariantCulture


What this does its tell it to treat the period as the decimal character regardless of culture.
This should fix it

I uploaded version 27 for testing.
http://209.159.152.184:8080/terra/

I still have not found a way to fix the shader for the models. It works well here so its hard to debug.
I do not own a AMD video card of any kind so I can't test anything.
The shader stages are bump_vertex.glsl and bump_fragment.glsl

Mr. Mouse's images look like the terrain is rendering fine and that shader is VERY complex.
Also the trees and decals look ok. (Decals need more work)
This makes me think that it may not be 100% related to the bump shader.

You can make the ads go away by registering


_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 5:58 pm 
Offline
advanced

Joined: Thu Jan 14, 2016 11:32 am
Posts: 66
Has thanked: 9 times
Have thanks: 19 times
Nice! It now works!

https://i.imgur.com/kOVfTSq.jpg

Thanks for fixing it :)

(also nice looking trees, I don't think it will ever be nicer)


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 6:41 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
Mr. Mouse...

I have something else you can try.

The bump shader was missing the version definition line. AMD don't that.

Find this folder....
C:\Program Files (x86)\Coffee_\Terra!\shaders
in there is a file called "bump_vertex.glsl"
It is just a text file with a different suffix. .glsl in stead of .txt
Open it and replace the entire file with the code below.
1st... some short cut keys in case you don't know them.. I'm sure you do. I watched your videos :)
CRT+A (select all)
CTR+C (copy)
CTR+V (Paste)
CRT+X (delete and move to clipboard)
Quote:
//bump_vertex.glsl
// used to render all building and other models

#version 120
varying vec3 rgb;
varying vec3 vVertex;
varying vec3 g_vertexnormal;
varying vec3 g_viewvector;
varying vec3 lightDirection;
varying vec2 TC1;
varying vec2 TC2;
varying vec3 T;
varying vec3 BN;
uniform mat4 ModelMatrix1;

uniform vec3 camPos;

void main(void)
{

TC1 = gl_MultiTexCoord0.xy;
TC2 = gl_MultiTexCoord1.xy;

mat3 ModelMatrix = mat3(ModelMatrix1);
vec3 T = normalize(ModelMatrix * gl_MultiTexCoord2.xyz);
vec3 BN = normalize(ModelMatrix * gl_MultiTexCoord3.xyz);

g_vertexnormal = normalize(ModelMatrix * gl_Normal);

vVertex = vec3(ModelMatrix1 * gl_Vertex);

gl_Position = ftransform();
lightDirection = gl_LightSource[0].position.xyz - vVertex;

g_viewvector = camPos - -vVertex;
g_viewvector.z *= -1.0;

rgb = lightDirection;

}



save the file.
start Terra and see if it renders the buildings.

Let me know OK?

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 6:47 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
SkaceKachna wrote:
Nice! It now works!

https://i.imgur.com/kOVfTSq.jpg

Thanks for fixing it :)

(also nice looking trees, I don't think it will ever be nicer)


WOOOOOOHOOOOOOOO!!!!!
There is a God!!!!!

I'm so glad this fixes the culture problem.
I can use this in the the model editor i'm working on !

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 7:32 pm 
Offline
veteran

Joined: Fri Oct 02, 2015 3:35 pm
Posts: 104
Has thanked: 2 times
Have thanks: 2 times
Coffee wrote:
SkaceKachna wrote:
Nice! It now works!

https://i.imgur.com/kOVfTSq.jpg

Thanks for fixing it :)

(also nice looking trees, I don't think it will ever be nicer)


WOOOOOOHOOOOOOOO!!!!!
There is a God!!!!!

I'm so glad this fixes the culture problem.
I can use this in the the model editor i'm working on !


Model editor? You mean as in a sequel to the wot model editor? Sounds pretty good.
Awesome Terra app you made btw, this is not exactly the same as exploring the maps on your own, but its the next best thing.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 7:38 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
To move around on the map...

Use the left mouse to change view direction;
To move around the map..
Press and hold SHIFT + Left Mouse Button and drag the mouse.
You can jump to areas on the map by clicking on the MiniMap.

To change the Y camera's position, Press and hold CTR + Left Mouse Button.
Moving the mouse up and down will change the altitude.

Terra! has a number of short cut keys.
1,2,3 and 4 turn on mesh view for Decals, Models, Trees and Terrain in that order.
C turns on chunk outlines.
G turns on Player Grid Lines.
V opens the Texture Viewer. This will let you look all the terrain and model textures.

F2 Orbits the light.
F3 puts the camera in fly mode.

E opens the shader editor.. BE CAREFUL with that.. Changing shaders is not a good idea if you do not know how to program them.
===================================================
On the bottom of the screen there is some information.
FPS .. This only updates when you move the mouse or put the app in fly or light orbit mode.
Terra does NOT update non-stop. Its a waste of power to do so for static imaging.
Location. This is what player grid you are in on the MiniMap.
X,Y and Z is world space in meters
GX and GY are the mesh blocks in each chunk. I used this for debugging more than anything.
If the Terrain is being drawn as a mesh, you will see a RED square around this GX and GY location. Also.. used for debugging.

You can hide EVERYTHING that is in the window.
Got to Settings on the menu bar and UN-Check everything.

Also.. there are buttons one the left of the menu to zoom up and down and hide the MiniMap.

To set up a team layout. Read the Help file.
There are a number of tank models to chose from to build your teams.
Once you have your team setup.. Don't forget to SAVE it!

When you load a Team Setup, Terra will load the map as well.

NOTE:
I am still trying to find out why the main texture is being corrupt.
Some where in those thousands of lines of code, there is something being initialized incorrectly.

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 7:52 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
Portugalotaku wrote:

Model editor? You mean as in a sequel to the wot model editor? Sounds pretty good.
Awesome Terra app you made btw, this is not exactly the same as exploring the maps on your own, but its the next best thing.

Thank you..
Yes.. It's not a prefect looking but.. you can use Terra to design strategic team setups for Clan Wars.

Yes.. I'm re-writing the WoT Model Editor.
The new formats and games need support.
As it stands now, you can load an entire ship from World of WarShips and export the entire thing as an FBX.
The new version 30.0.9 only works with World of WarShips and you can NOT export in .primitive yet.
This has turned out to be a tremendous amount of work. I actually had to write a 2nd app to digest the gamesparams.data file in order to get all the sub models details for the ships.
If you want to follow the thread from the start to end, here's the link to the forum thread:
http://forum.xentax.com/viewtopic.php?f=16&t=12567

You can download the latest version here: http://209.159.152.184:8080/WoW/

And here is a pic from the app..
Image

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 8:07 pm 
Offline
veteran

Joined: Fri Oct 02, 2015 3:35 pm
Posts: 104
Has thanked: 2 times
Have thanks: 2 times
Coffee wrote:
Portugalotaku wrote:

Model editor? You mean as in a sequel to the wot model editor? Sounds pretty good.
Awesome Terra app you made btw, this is not exactly the same as exploring the maps on your own, but its the next best thing.

Thank you..
Yes.. It's not a prefect looking but.. you can use Terra to design strategic team setups for Clan Wars.

Yes.. I'm re-writing the WoT Model Editor.
The new formats and games need support.
As it stands now, you can load an entire ship from World of WarShips and export the entire thing as an FBX.
The new version 30.0.9 only works with World of WarShips and you can NOT export in .primitive yet.
This has turned out to be a tremendous amount of work. I actually had to write a 2nd app to digest the gamesparams.data file in order to get all the sub models details for the ships.
If you want to follow the thread from the start to end, here's the link to the forum thread:
http://forum.xentax.com/viewtopic.php?f=16&t=12567

You can download the latest version here: http://209.159.152.184:8080/WoW/

And here is a pic from the app..
Image


It's looking great, can't wait for the updates!


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Thu Feb 11, 2016 10:21 pm 
Offline
Site Admin
User avatar

Joined: Wed Jan 15, 2003 6:45 pm
Posts: 4005
Location: Dungeons of Doom
Has thanked: 408 times
Have thanks: 544 times
Coffee wrote:
Mr. Mouse...

I have something else you can try.

The bump shader was missing the version definition line. AMD don't that.

Find this folder....
C:\Program Files (x86)\Coffee_\Terra!\shaders
in there is a file called "bump_vertex.glsl"
It is just a text file with a different suffix. .glsl in stead of .txt
Open it and replace the entire file with the code below.
1st... some short cut keys in case you don't know them.. I'm sure you do. I watched your videos :)
CRT+A (select all)
CTR+C (copy)
CTR+V (Paste)
CRT+X (delete and move to clipboard)
Quote:
//bump_vertex.glsl
// used to render all building and other models

#version 120
varying vec3 rgb;
varying vec3 vVertex;
varying vec3 g_vertexnormal;
varying vec3 g_viewvector;
varying vec3 lightDirection;
varying vec2 TC1;
varying vec2 TC2;
varying vec3 T;
varying vec3 BN;
uniform mat4 ModelMatrix1;

uniform vec3 camPos;

void main(void)
{

TC1 = gl_MultiTexCoord0.xy;
TC2 = gl_MultiTexCoord1.xy;

mat3 ModelMatrix = mat3(ModelMatrix1);
vec3 T = normalize(ModelMatrix * gl_MultiTexCoord2.xyz);
vec3 BN = normalize(ModelMatrix * gl_MultiTexCoord3.xyz);

g_vertexnormal = normalize(ModelMatrix * gl_Normal);

vVertex = vec3(ModelMatrix1 * gl_Vertex);

gl_Position = ftransform();
lightDirection = gl_LightSource[0].position.xyz - vVertex;

g_viewvector = camPos - -vVertex;
g_viewvector.z *= -1.0;

rgb = lightDirection;

}



save the file.
start Terra and see if it renders the buildings.

Let me know OK?



Sadly, no. Doesn't help.

_________________
Please like our Facebook page!


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Fri Feb 12, 2016 3:35 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
I am sorry Mr, Mouse.

I will keep looking for the cause as I work on other things.
You could try setting this to low rez and reloading a map.

I don't think memory is a real problem as no map should even get close to 1 gig of Vmem.
The 7800 series has 2 gig of VDDR5... Its some of the fastest memory on the planet.
It's the same memory my nVidia card uses.

If there is anyone reading this thread that knows the in's and out's of AMD's GLSL and any workarounds, feel free to post info!
I know there is one major issue and... that's not being able to pass Matrices from the vertex stage to the fragment stage.
I fixed that in the shader.. but it still doesn't work. No errors either which is strange.
This may not even have anything to do with the shaders but I don't see how it could load the textures on almost all other systems.
It has nothing to do with the fact I use display list and not VBOs. Every thing I have read has said display lists are a better and usually faster method than VBOs for rendering static meshes. They are for sure less complicated to setup and use.

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Fri Feb 12, 2016 4:45 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
Ok Mr. Mouse...

I did some more reading at a few sites.

I found that my fragment program has a few things AMD cards are known to not like.

1. No direct cast from Int. This means it interrupts 1 the same as 1.0... This could be breaking the If- Then statements. I int(n) around any value that IS an integer.

2. TexCoords. AMD sometimes fails when you dont include the swizzles st...
Example:
Code:
bumpMap.xy = (2.0 * texture2D(normalMap, TC1.st).ag - 1.0);

Note the .st after TC1. AMD cards like this to be there.. Nvidia assumes what you want is the UV addresses s and t. Why its s and t and not U and V.. who knows??!!!

Start Terra.. press E and select bump from the drop down at the bottom.
Select the Fragment Program Tab at the top.
Replace all of the existing code with the code below...
Press the Compile button.


It will save the new shader code so this only has to be done once.

Let me know if this works

Code:
// bump_fragment.glsl
// used to render all building and other models
#version 130
uniform sampler2D normalMap;
uniform sampler2D colorMap;
uniform sampler2D colorMap_2;
uniform int enable_fog;
uniform int is_GAmap;
uniform float l_texture;
uniform float gray_level;
uniform int is_bumped;
uniform int is_multi_textured;
uniform float gamma;
uniform int alphaRef;
uniform int alphaTestEnable;
uniform float ambient;
in vec3 T;
in vec3 BN;
in vec3 g_vertexnormal;
in vec3 g_viewvector;
// camera pos - vertex pos
in vec2 TC1;
in vec2 TC2;
in vec3 vVertex;
in vec3 lightDirection;
in vec4 rgb;
////////////////////////////////////////////////////////////////////////////////////
void main (void)
{
    float invmax = inversesqrt( max( dot(T,T), dot(BN,BN) ));
    mat3 TBN = mat3( T * invmax, BN * invmax, -g_vertexnormal );
    vec3 bump;
    float alpha;
    float harshness = 1.4;
    float boost = 1.5;
    float a;
    vec3 bumpMap;
    // get normal map based on type

    if (is_GAmap == int(1) )
   {
       bumpMap.xy = (2.0 * texture2D(normalMap, TC1.st).ag - 1.0);
        ;
        bumpMap.z = sqrt(1.0 - dot(bumpMap.xy, bumpMap.xy));
        bumpMap.x *= -1.0;
        bumpMap   = normalize(bumpMap);
        harshness = 1.4;
        a         = textureLod(normalMap, TC1.st, int(0)).r;
        if (alphaTestEnable != 0) {
            alpha = 1.0-float(alphaRef/255);
            if (a < alpha) {
                discard;
            }

         }
   }
else
{
    bumpMap = (2.0 * texture2D (normalMap, TC1.st).rgb - 1.0);
        bumpMap.xz *= -1.0;
        bumpMap = normalize(bumpMap);
        a       = textureLod(colorMap, TC1.st, int(0)).a;
        if (a < 0.3) {
            discard;
        }

    }


    vec4 color = texture2D(colorMap, TC1.st);
    if (is_multi_textured == int(1) ) {
        vec4 d2 =  texture2D(colorMap_2, TC2.st);
        color *=d2;
        color *= 1.5;
    }

    // debug stuff
    //float ml = 1.0;
    //color = mix(vec4(ambient,ambient,ambient,color.a), color, ml);
    color.xyz *= l_texture;
    vec4 final_color = color * vec4(ambient,ambient,ambient,1.0);
    vec3 N = normalize(g_vertexnormal);
    // Get the perturbed normal
vec3 PN = normalize( TBN * bumpMap );
    // light position
vec3 L = normalize(lightDirection);
    //caclulate lighting


float lambertTerm= max(dot(PN,L) , 0.0);
    float light_diffuse = 0.2;
    if (is_bumped == int(0)) {
        lambertTerm = 0.3;
    }

   final_color += (light_diffuse * max(lambertTerm,0.0)) * color;
    vec3 E = normalize(g_viewvector.xyz);
    vec3 R = normalize(reflect(L, PN));
    float specular = pow( max(dot(R, E), 0.0), 300.0)*0.01;
    final_color +=  specular;
    gl_FragColor.xyz = rgb.xyz;
    gl_FragColor     = final_color *3.0*boost;
    vec3 vG = vec3(harshness , harshness , harshness);
    gl_FragColor.rgb = pow(gl_FragColor.rgb, vG/gamma);
    vec3 co = gl_FragColor.rgb;
    float cl = length(co);
    if (cl == 0.0)
{
        cl = 1.0;
    }

gl_FragColor.rgb = gl_FragColor.rgb / ( (co.rgb/cl) / (1.0-gray_level) )
+ ( gl_FragColor.rgb * gray_level);

//======================================================
//debug junk
//gl_FragColor.rgb =  RGB.rgb;
//======================================================

// FOG calculation
const float LOG2 = 1.442695;
    float z = gl_FragCoord.z / gl_FragCoord.w;
    float fogFactor = exp2( -gl_Fog.density * gl_Fog.density * z * z * LOG2 );
    fogFactor = clamp(fogFactor, 0.0, 1.0);
    if (enable_fog == int(1) )
{
        gl_FragColor = mix(gl_Fog.color, gl_FragColor, fogFactor );
    }

else
{
        gl_FragColor = gl_FragColor;
    }
}

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Fri Feb 12, 2016 10:15 am 
Offline
Site Admin
User avatar

Joined: Wed Jan 15, 2003 6:45 pm
Posts: 4005
Location: Dungeons of Doom
Has thanked: 408 times
Have thanks: 544 times
Doesn't help. Just one single colour. No mapping of any texture.
Is there a way to just map the texture without any fancy other stuff, just to see if it works?
Perhaps there should also be some kind of extra debugging implemented at crucial points, just to see what is going wrong at a certain point.
Is it normal that each time I start I first get some MSI install dialog briefly?

_________________
Please like our Facebook page!


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Fri Feb 12, 2016 4:52 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
Yes... the configuring message is normal.

Ok.. let me write come test code.
1st.. Ill take the shader out and just use the old stuff.

This may sound dumb but press the V key and look at the model textures and see if they have loaded, OK?

_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Fri Feb 12, 2016 6:37 pm 
Offline
Site Admin
User avatar

Joined: Wed Jan 15, 2003 6:45 pm
Posts: 4005
Location: Dungeons of Doom
Has thanked: 408 times
Have thanks: 544 times
Coffee wrote:
Yes... the configuring message is normal.

Ok.. let me write come test code.
1st.. Ill take the shader out and just use the old stuff.

This may sound dumb but press the V key and look at the model textures and see if they have loaded, OK?


Yes, I can see the images of the model textures, so I guess they loaded.

_________________
Please like our Facebook page!


Top
 Profile  
 
 Post subject: Re: World of Tanks Map format.
PostPosted: Fri Feb 12, 2016 6:58 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Thu Aug 06, 2015 5:57 pm
Posts: 518
Has thanked: 74 times
Have thanks: 205 times
Thanks...
I'm looking....


_________________
I'd love to change the world but I can't get my hands on the code.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 261 posts ]  Go to page Previous  1 ... 13, 14, 15, 16, 17, 18  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: comoka, delium and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group