Searc

Monday, 2 January 2012

BoundingBox's A pain in the but

I have spent a long time trying to ificiantly calculate bounding boxes for my terrain patches, i have resorted to bruteforce once the patch is created, the code is just a modifyed version of the standard xna method for calculting mesh bounding boxes. Here is a little update pic and the code used. I dont think this really needs an explanation, it just checks all vertices and then calculates the max and min bounds.



  public BoundingBox CalculateBoundingBox()
  
  {
  
    Vector3 Max = new Vector3(float.MinValue, float.MinValue, float.MinValue);
  
    Vector3 Min = new Vector3(float.MaxValue, float.MaxValue, float.MaxValue);
  
     for (int i = 0; i < VertexData.Length; i ++)
  
     {
  
       Vector3 vectCurrentVertex = VertexData[i].Position;
  
       if (VertexData[i].Position.X < Min.X) Min.X = VertexData[i].Position.X;
  
       if (VertexData[i].Position.X > Max.X) Max.X = VertexData[i].Position.X;
  
       if (VertexData[i].Position.Y < Min.Y) Min.Y = VertexData[i].Position.Y;

  
       if (VertexData[i].Position.Y > Max.Y) Max.Y = VertexData[i].Position.Y;
  
       if (VertexData[i].Position.Z < Min.Z) Min.Z = VertexData[i].Position.Z;
  
       if (VertexData[i].Position.Z > Max.Z) Max.Z = VertexData[i].Position.Z;
  
     }
  
     return new BoundingBox(Min, Max); 
  
  }  

Tuesday, 27 December 2011

Merry Christmas Evereybody

Well its been a while ive been working hard on porting my engine to XNA4.0 and c#, also have rewritten the planet engine and finally got the atsmopheric scattering working properly , its looking ok, well got a few things i got to work out still. Terrain crack fixing and culling is not working properly yet and also maybe a little water will be nice. But what the heck its christmas, and i just wanted to offer my followers a little eye canddy. Here we go. My new engine now goes down to the ground level, on a planet the size of earth. Water at the moment is just the colour blue, really need to fix this. Well here is it enjoy.






A little edit i thought was necesary. and i have just realised i cant spell, can you see it in these pictures lol.


Saturday, 6 August 2011

Little more progress

i have been working hard on this for a while now and i think i am getting someware i am although getting a bit stcuk with normal generation for dif lod levels, but im sure i will figure it out soon enough.
for now a few more screenys.




Saturday, 9 July 2011

Just some updated screenshots

Just wanted to post some new screenshots, starting look like a real planet.

Anybody want some info on the techniques used just mail me and ill get back to you as soon as possible.




I added some clouds,water and a nice lense effect. Gotta work on the terrain now to lower the draw calls and up the fps, but not a bad job i think so far, i am quite happy with the results.

Friday, 8 July 2011

Finally worked the basics out

Well i been grafting hard on the planet and settled someware in the middle, its a gemipmap implementation, which is going to evolve in to a chunked lod, but that is later on got the atmospheric scattering working properly. I will post some implementation info soon, just need the time to do so but for now got some eye candy.


Its a lovely sunrise from the mountains, normals are not yet generated so shadows are not great but its getting there.

Saturday, 25 June 2011

Got the atmospheric scattering working

Well finally managed to get the atmospheric scattering shader, geometry and the shader working properly and its looking pretty nice if i do say so myself. Now i gotta start to add some nicer effect. This may ateka while as this is not on my initial TODO list, as i have to fix the planet LOD first.




Saturday, 18 June 2011

Update on what i have been working on

Ok well i have now decided i am going to stick with 6 square clipmaps and morph them in to a sphere, as spherical clipmaps is way beyind my math skills, and also alot more work maybe i will come back to it later on, so far i have managed to get the cube somewhat working and some multitexturing, but still alot of work needed. Its actually quite simple to get the planet its just making it look realistic is the hard part. I have also improved the atmospheric scattering shader a bit, but i cant seem to get the sphere to cull properly im currently working on that , and syncing the clipmap centers too. I have also vastly improved the framerate , by adding some adition optimization to the mesh code.