Jump to content
XCOMUFO & Xenocide

Regions/countries/cities On Geoscape


Darkside

Recommended Posts

What I mean is that you have a 47MB of data into the Video Memory card, if you then add Bump Mapping and other things, well it can be a little too much except for relatively low end Shader 2.0 capable hardware. Current low end XNA capable hardware can vary from 64Mb to 256Mb of video memory. I dont think the 48 Mb footprint of the application is too much... Battlefield 2142 consumes 800 just in idle :)

 

Remember that bump mapping is a texel based effect and that can kill your Shader units if you are doing more than the standard Phong calculations.

 

Greetings

Red Knight

Link to comment
Share on other sites

Terrain.png (1350x675) (675x338)

 

Terrain.png has some wrong pixels. The green is not consitently the color defined in the XML. Xenoicide detects this on load.

 

 

 

I also think regions still has some invalid pixels as well. Xenocide should probably set the flag to error on invalid colors when loading this file as well.

 

 

 

Thats because I was using color of 31 instead of 32, I never knew the exact values they needed to be I just used the color of the old maps... let me know the vaules of the others and I will change them.

 

This one should work fine

Edited by Darkhomb
Link to comment
Share on other sites

Thats because I was using color of 31 instead of 32, I never knew the exact values they needed to be I just used the color of the old maps... let me know the vaules of the others and I will change them.

 

Edit - ok we will keep the 2700.

 

 

look in planets.xml for all the RGB values.

Link to comment
Share on other sites

Regions did have some random pixels in a few hidden places kinda hard to spot when there are 3645000 pixels :) let me know if it detects anymroe but i did a extensive search.

 

Can someone tell me if the 1st attached regions is more on the line of you guys want?

 

Also I have the 2700x1350 png of the geoscape but it is too big to attach, don't know where you want me to put it.

 

Took SaintD's spec map and resized it to 2700x1350 and made it a png as attached.

 

Then I took the spec and overlayed it to the geoscape to show you what it could look like at night with just the spec, attached

 

also there is a night map, so if using a second map is easier then using a spec map only in certain areas then maybe we can use that attached as well.

region2.png

regions.png

countries.png

terrain.png

Specs.png

Neo_Geo_night.jpg

earth_lights_4800.jpg

Edited by Darkhomb
Link to comment
Share on other sites

I changed the pngs in my xenocide built and replaced the geo xnb that was posted by mad, it looks much better, I think 5400x2700 would be much nicer to be able to zoom in with... is there away to use the smaller 2700x1350 on the globe but when you zoom in it uses a portion or the higher detail kinda like how google earth works?

 

Memory with the bigger pngs 3x (1350x675) and the geoscape 2700x1350

 

 

 

edit @ Mad can you export these images to xnb like you did the previously one? To test

 

http://veimages.gsfc.nasa.gov//7105/world....3x5400x2700.png (What SaintD posted earlier, Might be nicer would like to see on globe)

http://veimages.gsfc.nasa.gov//7129/world....3x5400x2700.png

geo1.jpg

geo2.jpg

xeno.jpg

Edited by Darkhomb
Link to comment
Share on other sites

Where can I find the lines where the assests are defined? It wants to load the hpc-earth map as joeg, and I'd like to use the png now. I obviously tried searching, but this wouldn't bring up anything.
Link to comment
Share on other sites

Mad, I suggest you pick up the latest code I've checked in. I've removed the geoscape texture file from the XNA pipeline, so you should be able to just drop in the texture. See http://www.xcomufo.com/forums/index.php?sh...mp;#entry169721 for details.

I would have built a new package and uploaded, but upload isn't working for me at moment.

Link to comment
Share on other sites

Now by going off what you said about regions, I am hoping I understood correctly. basicly coastlines and water are still part of that region, islands do not count, and I can basiclly round everything off?

Kind of like this?

Correct.

For assets use PGN instead of JPG because in the end you will get the same memory usage but PNG is a loseless compression method, while JPG isnt. So you are only trading hard disk space in that way (HD is "free" today).

Just to clarify, for the bitmaps that are used as textures (HPC-earth-map & Nightlights) these should be .jpgs.

The data files: Terrain, Region and Countries need to be .png. This is because the underlying engine uses the data in them, and jpg will alter (corrupt) the data.

I'm not sure what type the height (bump) needs to be. I suspect .jpg.

 

As for the resolution of the data files, they don't need to be high resolution.

Terrain is used to determine if a location is water or land. So if resolution is coarse, may have trouble around the edges of land. (May not be able to build on a coast line, or may be able to build slightly offshore.)

Countries is used to see if activity occured over a funding nation or not. So again, if resolution is low, there may be some miss allocations if activity occurs on a border, but no one would notice.

Region is used like countries, to assign activity to a region (So player can see where UFO activity is, until the tachyon detector becomes available.) So, again, precision is not vital.

The Region is also used to select the area targeted by UFOs on a mission. So again, precision isn't vital.

 

I suspect that any scale between 1024 x 512 and 512 x 256 will probably be perfectly adaquate.

More than that is probably counterproductive because the engine is constantly scanning the map. Bigger map == more CPU use, and I've got other uses for it.

Incidentally, because we're RLE compressing the data files in the engine, increasing the horizontal resolution of the bit map costs us virtually nothing.

But, increasing the vertical resolution costs. That is, if you make the bitmap twice as wide, it will cost us maybe 1% or 2% more CPU and memory, but if you double the height, it costs us twice as much memory and CPU.

 

 

New package

As I said before, I can't upload a new progress release package, so if someone would like to build and upload one for those who don't have XNA installed steps are:

1. Get latest source from SVN.

2. Build XNA Xenocide as normal.

3. Then in Visual studio go to Build -> Configuration Manager.

4. In Active solution configuration, change drop down list box from Debug to Release.

5. Then go Build -> Rebuild Solution.

6. Now go to Xenocide\bin\x86\Release. Delete all files with a .pdb extension. (They're not needed)

7. Copy contents of Xenocide\bin\x86\Debug\Content\Schema to Xenocide\bin\x86\Release\Content\Schema

8. Try running xenocide.exe in Xenocide\bin\x86\Release, to check everything works.

9. If it all works, rename Xenocide\bin\x86\Release to Release, zip it and its contents up, and upload.

 

Once this is done, set Visual studio back to Debug builds

Visual studio go to Build -> Configuration Manager -> Active solution configuration -> Debug

 

Reason for uploading new build is it will allow people who don't have VS Express installed to play with new geoscape texture bitmaps.

Link to comment
Share on other sites

Fixed Regions that was hard... anyways I tested it and now works no errors on any pngs. attached is a zip file for those you have downloaded the latest release mad has included, extract this into the content/textures folder to replace all textures.

 

There are 2 geoscapes in here, switch names to view the other, both are 5400x2700

 

I used a 21600x10800 of the same image, it looked very nice, but too way to long to load, so did the 10800x5400, I think the 5400 will be fine

 

 

File was too big for me to upload here (3.3meg) so I put it on rapidshare

 

http://rapidshare.com/files/49773359/textures.zip.html

geoblue.jpg

geong.jpg

Edited by Darkhomb
Link to comment
Share on other sites

I used 3d studio max for this but I just wanted to show the test, These are with and with out the bump map. So hopefully down the road we can include this.

I agree that the bump map looks nicer, and ultimately I'd like to get it in. It comes down to priorities. Which makes the game better at this point in time?

  • UFOs doing outpost construction and supply missions (and X-Corp targeting outposts and terror sites),
  • fixing the GUI (giving dialogs solid backgrounds),
  • Adding bumpmap to the globe?

Well, to be honest, I think getting the "city night light" into the geoscape would be a really cool effect, and not take too much time to do, and I'd love to get credit for it, so I'm probably going to have a go at that this weekend. Unless someone gets it done ahead of me.

Link to comment
Share on other sites

I used 3d studio max for this but I just wanted to show the test, These are with and with out the bump map. So hopefully down the road we can include this.
Can you map the bump texture into Xenocide and if it is aligned send it to me for adding a Bump Mapping shader to it this weekend? This is a one time offer :P as I expect to have a little time on saturday.

 

Greetings

Red Knight

Link to comment
Share on other sites

If you want smaller resolutions for testing or anything else or even larger resolution let me know.

In fact I would need the link to the original .tga files as the .jpg format creates artifact because of the blocky nature of the compression algorithm it uses. So you are losing information that in the end will be seen. .tga files are way too big, but you can always use .png files that are loseless... in fact that is the filetype all should use to make sure that you are not losing information.

 

Greetings

Red Knight

Link to comment
Share on other sites

unfortunately this file is only jpeg, it comes in 5400x2700 and 21600 x 10800 which i can then convert to png before resizing to keep as much information as possible

 

I have no problem editing the 21600 x 10800 so if thats fine tell me the res you would like out of it

 

edit actually there is a 1.1 gig 86400 x 43200 file as well but i think the 21600 should be fine :)

Edited by Darkhomb
Link to comment
Share on other sites

I used 3d studio max for this but I just wanted to show the test, These are with and with out the bump map. So hopefully down the road we can include this.
Can you map the bump texture into Xenocide and if it is aligned send it to me for adding a Bump Mapping shader to it this weekend? This is a one time offer :P as I expect to have a little time on saturday.

 

Greetings

Red Knight

 

I have looked into this some. We can apply the elevation map to the earth. Calling it a bump map isn't terribly useful in the contect of the actual programming BTW. Here are the ways I think we can use, in order of how quick and easy they will be.

  • Create a custom mesh from the elevation map. Use that instead of a sphere for the planet model. We only have to do it once and then load the mesh instead of creating a generic sphere on the fly. I don't have Maya or 3d Studio max, so this would have to come from the art dept. Looks like Drakhomb has already done 90% of the work for this. I am not 100% sure it will be easy to load the resulting model and scale it properly.
  • Convert the elevation map to a "normal map". XNA seems to have support for this, and it may be pretty easy to plug in. There is a photoshop (another program I don't own) plugin for this. I also know you can do it from Maya, but I only saw a reference to that, not how exactly.
  • Create a new model programatically. Read the elevation map in a custom program-let and apply the changes to the generic sphere, then dump that to disk as a mesh. This is technically possible, and given a few days of solid work, I think I could do this. However, I get about a day a week to work on this.
  • Re-write the pixel shader to read the elevation information from the elevation map. Possible, but dtevoit may be the only one who understands the pixel shaders well enough to get that done anytime soon. Part of the problem is that the texture (elevation map) is stretched to a rectangle, then applied to the globe. XNA handles applying these textures automatically, but in order to program the shader, you have to do it by hand. The math isn't any harder than anything dteviot has already done, but it's certianly not my strong suite.

Link to comment
Share on other sites

[*]Create a custom mesh from the elevation map. Use that instead of a sphere for the planet model. We only have to do it once and then load the mesh instead of creating a generic sphere on the fly. I don't have Maya or 3d Studio max, so this would have to come from the art dept. Looks like Drakhomb has already done 90% of the work for this. I am not 100% sure it will be easy to load the resulting model and scale it properly.
There is no need to create a mesh from the elevation map, that already exists in the SphereMesh (looking into it already).

 

[*]Convert the elevation map to a "normal map". XNA seems to have support for this, and it may be pretty easy to plug in. There is a photoshop (another program I don't own) plugin for this. I also know you can do it from Maya, but I only saw a reference to that, not how exactly.
This one consumed most of my time yesterday, how to create the normal map from the elevation map seams to be covered everywhere but not free usable applications until I remembered that in the end it would have been easy to write an effect filter for Paint.Net (www.getpaint.net) in C#. When I was dead tired of looking in the entire internet and firing up Visual Studio I found a plugin for Paint.Net (even with the source available) so I just copy the .dll and was able to create it in 1 minute. Link: http://paintdotnet.12.forumer.com/viewtopic.php?t=2973

 

[*]Create a new model programatically. Read the elevation map in a custom program-let and apply the changes to the generic sphere, then dump that to disk as a mesh. This is technically possible, and given a few days of solid work, I think I could do this. However, I get about a day a week to work on this.
No need to do this, after you have your .png texture you just have to set the 2 textures to the effect (diffuse map and the normal map).

 

[*]Re-write the pixel shader to read the elevation information from the elevation map. Possible, but dtevoit may be the only one who understands the pixel shaders well enough to get that done anytime soon. Part of the problem is that the texture (elevation map) is stretched to a rectangle, then applied to the globe. XNA handles applying these textures automatically, but in order to program the shader, you have to do it by hand. The math isn't any harder than anything dteviot has already done, but it's certianly not my strong suite.
There is no need to that, the Normal Mapping shader is a pretty known effect type. You can get one from the Lizard example in the XNA Samples. The problem is to be able to understand what it does.

 

Luckily I can explain it ;)

 

VS_OUTPUT VertexShader( VS_INPUT input )
{
   VS_OUTPUT output;
   
   // transform the position into projection space. 
   // RK: This is the standard behavior of any shader, so after this 3 multiplications all your vertex are in Screen space. 
   float4 worldSpacePos = mul(input.position, World);
   output.position = mul(worldSpacePos, View);
   output.position = mul(output.position, Projection);
   
   // calculate the light direction ( from the surface to the light ), which is not
   // normalized and is in world space... 
   // RK: As this is a generic one light shader we have to make sure to put the light
   // very away because when the light hit the earth it does it in parallel rays, and this shader assumes an spotlight so putting
   // the light position an order of magnitude away (if your sphere has a radius of 10) then putting the light 100 or more away 
   // will create the illusion in the math of parallel light rays.
   output.lightDirection = LightPosition - worldSpacePos;
       
   // similarly, calculate the view direction, from the eye to the surface.  not
   // normalized, in world space.
   float3 eyePosition = mul(-View._m30_m31_m32, transpose(View));    
   output.viewDirection = worldSpacePos - eyePosition;    
   
   // calculate tangent space to world space matrix using the world space tangent,
   // binormal, and normal as basis vectors.  the pixel shader will normalize these
   // in case the world matrix has scaling.
   output.tangentToWorld[0] = mul(input.tangent,    World);
   output.tangentToWorld[1] = mul(input.binormal,    World);
   output.tangentToWorld[2] = mul(input.normal,    World);
   
   // pass the texture coordinate through without additional processing
   output.texCoord = input.texCoord;
   
   return output;
}

 

float4 PixelShader( VS_OUTPUT input ) : COLOR0
{  
   // look up the normal from the normal map, and transform from tangent space
   // into world space using the matrix created above.  normalize the result
   // in case the matrix contains scaling.
   float3 normalFromMap = tex2D(NormalMapSampler, input.texCoord);
   normalFromMap = mul(normalFromMap, input.tangentToWorld);
   normalFromMap = normalize(normalFromMap);
   
   // clean up our inputs a bit
   input.viewDirection = normalize(input.viewDirection);
   input.lightDirection = normalize(input.lightDirection);    
   
   // use the normal we looked up to do phong diffuse style lighting.    
   float nDotL = max(dot(normalFromMap, input.lightDirection), 0);
   // RK: this is the disturbance of the normal of the surface at the pixel we are calculating, this parameter is usually between 0 to 1
   // 0 means that the contribution of light is 0 (the surface is looking away of the light), 1 is that the entire light contribution is used 
   // as the surface is looking directly to the light.
   float4 diffuse = LightColor * nDotL;
   
   // use phong to calculate specular highlights: reflect the incoming light
   // vector off the normal, and use a dot product to see how "similar"
   // the reflected vector is to the view vector.    
   float3 reflectedLight = reflect(input.lightDirection, normalFromMap);
   float rDotV = max(dot(reflectedLight, input.viewDirection), 0);
   float4 specular = Shininess * LightColor * pow(rDotV, SpecularPower);
   
   // RK: This is the texture that you are using.
   float4 diffuseTexture = tex2D(DiffuseTextureSampler, input.texCoord);
   
   // return the combined result.
   return (diffuse + AmbientLightColor) * diffuseTexture + specular;
}

 

I will upload the .fx file and the Normal Map generated with Paint.Net

 

The changes needed for the shader to work in the GeoGlobe.cs file is to change the Draw method to give it access to the Projection and the View matrix, you already have the light direction (given the position of the globe in the scene and the position of the light) and the World matrix. Then you have to activate the Effect like in the Lizard example:

 

            foreach (ModelMesh mesh in model.Meshes)
           {
               foreach (Effect effect in mesh.Effects)
               {
                   Matrix world = transforms[mesh.ParentBone.Index];

                   effect.Parameters["World"].SetValue(world);
                   effect.Parameters["View"].SetValue(view);
                   effect.Parameters["Projection"].SetValue(projection);
                   effect.Parameters["LightPosition"].SetValue(lightPosition);
               }

               mesh.Draw();
           }

This code assumes that you used a ContentProcessor to bake the Effect inside the mesh, but the idea is the same ;). Remember that you have to set the Textures too in the effect both the diffuse and the normal map... With all that you are done ;).

 

Edit: Couldnt upload the texture as it is too big for the forum's limit.

 

Greetings

Red Knight

Link to comment
Share on other sites

I didn't think about making a normal out of them... I'd like to see the one you made, could you save as jpeg so you can upload it?

 

I could have saved you time, I have a plugin for photoshop that makes normals out of the pic plus a height map...

 

(Free from NVIDIA, http://developer.nvidia.com/object/photosh...s_plugins.html)

 

It didn't look right so I inverted x and y values and then just y both are attached as jpegs for now because of space reasons. let me know if this looks right have never played with normals before. Theres a lot of values to play with.

xny.jpg

y_only.jpg

Edited by Darkhomb
Link to comment
Share on other sites

Ahh green channel should be on the bottom... I reversed the normal this time and it looks good.

Attached...

 

Edit I think we should over exaggerate the amount of bump we use so you can see it easier, This 150 percent

noninve.jpg

earth152.jpg

Edited by Darkhomb
Link to comment
Share on other sites

×
×
  • Create New...