Shot of some detail textures in engine

This is a discussion on Shot of some detail textures in engine within the Game Programming forums, part of the General Programming Boards category; Had to dump the large land texture for my landscape. Not using tiles as of yet...just one bitmap. Here is ...

  1. #1
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598

    Shot of some detail textures in engine

    Had to dump the large land texture for my landscape. Not using tiles as of yet...just one bitmap.

    Here is a sample of one of them layered over the terrain.

    Kinda bland as is...but...

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Looks nice, screwed with my eyes for a second though

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Now I added some lighting to the terrain - I wasn't calculating the normals.

    Another screenshot to follow.

  4. #4
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Here is a shot of the tile texture with lighting.

  5. #5
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Here is a shot with my old texture and the lighting.

  6. #6
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    That looks insanely awesome! Good job with the terrain renderer! Are you using PVS or how are you getting the high framerate, because the terrain looks incredibly smooth (might just be because of the lighting...)
    Last edited by jverkoey; 05-25-2004 at 05:27 PM.

  7. #7
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Now I have a very big problem....the lighting changes so quickly that the normals flitter around causing a lot of flashing in the shading.

    Solution is pixel shaders or I could average 3 normals together for each vertex normal on creation.

    Dunno yet.

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Well I'm not happy with the framerate because with Nvidia 56.64's I was getting over 90 and now I'm at 70. But I can't install 56.64 for 98 because for some reason after my OS reinstall...they cause D3D to fail on initialization.

    This algorithm folks is simply brute force. As of yet I've not touched the algorithm at all. Every vertex is pre-computed as well as the normals and then its all thrown to the card. Quite amazing really.

    I guess D3D actually works better with meshes all at once in DX9 rather than several smaller ones. This mesh has also not yet been optimized. I'm hoping for much higher framerates or my special effects and foliage will bring it to a crawl.

    I created the height map in a paint program and smoothed it a bunch of times. That's it really. I'm going to average the terrain here soon but nothing has been done as of yet.

    Thanks for your encouraging comments. Sometimes when you develop you look at it and are like....yuk.....which causes you to do more.

  9. #9
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    looking very good. are you just straight height mapping or are you using any type of interpolation? (ie. height map used as sparse data and terrain mesh generated by interpolating data points.)

  10. #10
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Just straight heightmapping right now. Probably will do some bilinear filtering soon.

  11. #11
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    University of Waterloo
    Posts
    1,903
    Do you do your heightmapping from an image file? if so, how high of quality is the image? Because in most of my terrain renderers, whenever i do heightmapping with a bmp or something, it tends to look very blocky unless i make the polygons close together, which causes a ton of polygons to have to be rendered....

    I've heard of doing things like removing polygons on flat stretches of ground or removing polygons that rest on the same planes as others next to them and connecting them or whatever....

  12. #12
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    Yes the first images are simply pure heightmap values.

    This shot shows the fog system I'm using and you will notice the terrain has an even smoother look. The terrain here has been bilinear interpolated - upon loading of course - not during rendering.

  13. #13
    Banned
    Join Date
    May 2004
    Posts
    129
    Now I have a very big problem....the lighting changes so quickly that the normals flitter around causing a lot of flashing in the shading.

    Solution is pixel shaders or I could average 3 normals together for each vertex normal on creation.

    Dunno yet.
    If you didn't know, thats goraud shading (sp?) and it works very nicely if you are using the built in lighting for the renderer (just RENORMALIZE AFTER AVERAGING...i learned that the hard way for an ASE renderer). I've looked into some shading languages but like, in order to use them (any! whether it be HLSL, cg, or pure asm in d3d) you need to re-write the basic transformations and basic texture applications, because the built in stuff gets tossed as soon as you utilize the new fragment programs.

    have you looked into voxel based renderers? theyre fast and come with near perfect culling (occlusion and otherwise!) but that stuff is a bit beyond me

  14. #14
    Banned
    Join Date
    Dec 2003
    Posts
    367
    Now you just have to have a volcano with an alpha blended particle effect for its lava that is spewing out on the 200,000 polygon village with 500 actors running away in pain in all of their nueral net AI beauty, all rendered to a texture that is mapped onto a piece of toilet paper.

  15. #15
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,598
    I know...but I'm using phong shading not gouraud which really doesn't change much. I am renormalizing the normals or I'm telling Direct3D to do it...but I'm still getting the flickery crap.

    I will implement a pixel shader or vertex shader very soon in HLSL...but not quite yet.


    Voxels are what got me starting doing terrains and yes I've coded several and I have one in DirectX except that I changed something and now I don't have any height in it. I optimized it so much that I...optimized myself out of the code. I'm totally lost when I look at it. Shame, shame Bubba, I know.

    The heightmap is 256x256 and the cellsize for those shots I think is about 10. The tile screenshot is using a cellsize of 4 and a texture increment the same size as the texture which causes it to tile nicely and yet gives a lot of detail up close. I can't tile the terrain texture because it is not tileable and looks ugly when it is done. The clouds are not going to stay there and I've changed the bitmap since those shots because that one sucks. You can clearly see the grid in the sky. Not anymore. Also using 2 alpha blended cloud layers so I can simulate some pretty cool stuff. The sun glare is simply going to be a pure white quad the size of the screen alpha blended depending on the sun's position (alpha coeficient is derived from sun's position). This will cause a white out. Cheesy but it works. Also I'm looking at some docs concerning real-time volumetric fog - might use this for the clouds...but major framerate hit for this.


    BTW if anyone wants to help with models contact me. I do not have a 3D modeling program so I'm SOL right now. Also I rather suck at creating textures so I need some artists. Any help would be greatly appreciated. I'm a programmer and therefore I suck at art.



    By the way the blockiness you are talking about comes from the fact that the map has a definite resolution and you are attempting to project a map on the screen that has more resolution than your map.

    There are several things you can do.

    First you need to select a cellsize for your world and a magnification factor. Larger cellsizes produce smoother terrain because the changes are not so abrupt but you will get flatter land unless you up the magnification factor. If its too high...same problem. Small cellsizes work well except that you must reduce the mag factor by a lot or you will have some very spikey terrain. Cellsize should be larger than 3. Any less and you effectively eliminate the magnification effect on the terrain. You will get nearly an exact representation of the heightmap on screen....which is blocky.

    So here are things to remember:

    1. Too blocky -> increase cellsize
    2. Too flat -> increase magnification


    Also you must change the walking speed of the player relative to your cellsize. Larger cellsizes will require bigger 'steps' or you will feel like you are crawling. Smaller cellsizes require smaller steps or you will feel like you are zipping across the terrain at light speed and it gives your terrain a very 'small cramped' feeling.

    Here is some basic code to get you started:

    Code:
    ...
    ...
    int mapsizex=256;
    int mapsizey=256;
    int maxworldx=mapsizex*cellsize;
    int maxworldz=mapsizey*cellsize;
    int vertexnum=0;
    float view_mag=3.0;
    int cellsize=10;
     
    for (int worldx=0;worldx<maxworldx;worldx+=cellsize)
    {
    for (int worldz=0;worldz<maxworldz;worldz+=cellsize)
    {
    	 int mapx=worldx/cellsize;
    	 int mapz=worldz/cellsize;
    	 TerrainVertexes[vertexnum].x=worldx;
    	 TerrainVertexes[vertexnum].y=GetMapHeight(mapx,mapz)*view_mag;
    	 TerrainVertexes[vertexnum].z=worldz;
    	 vertexnum++;
    }
    }
    ...
    ...
    And a simple average filter.

    Code:
     
    int numRows=(maxworldz)/cellsize;
    int numCols=(maxworldx)/cellsize;
     
    for (int i=0;i<numRows;i++)
    {
      for (int j=0;i<numCols;j++)
      {
    	 int pos_i=i+1;
    	 int pos_j=j+1;
    	 int neg_i=i-1;
    	 int neg_j=j-1
     
    	 if (neg_j<1) neg_j+=(numCols-1);
    	 if (pos_j>numCols) pos_j-=(numCols-1);
    	 if (neg_i<1) neg_i+=(numRows-1);
    	 if (pos_i>numRows) pos_i-=(numRows-1);
     
    	 int index0=neg_i*numCols+neg_j;
    	 int index1=neg_i*numCols+j;
    	 int index2=neg_i*numCols+pos_j;
     
    	 int index3=i*numCols+neg_j;
    	 int index4=i*numCols+j;
    	 int index5=i*numCols+pos_j;
     
    	 int index6=pos_i*numCols+neg_j;
    	 int index7=pos_i*numCols+j;
    	 int index8=pos_i*numCols+pos_j;
     
    	 int h0=TerrainVertexes[index0].y;
    	 int h1=TerrainVertexes[index1].y;
    	 int h2=TerrainVertexes[index2].y;
    	 int h3=TerrainVertexes[index3].y;
    	 int h4=TerrainVertexes[index4].y;
    	 int h5=TerrainVertexes[index5].y;
    	 int h6=TerrainVertexes[index6].y;
    	 int h7=TerrainVertexes[index7].y;
    	 int h8=TerrainVertexes[index8].y;
     
    	 int finalheight=(h0+h1+h2+h3+h4+h5+h6+h7+h8)/9;
     
    	 TerrainVertexes[index4]=finalheight;
      }
    }
    Can also be done with a matrix....but easier to show this. You can also linear interpolate:

    vi=v1+f1*(v2-v1);

    where f1 varies from 0 to 1.

    or bi-linear interpolate:

    v1i=v1+f1*(v2-v1);
    v2i=v3+f1*(v4-v3);
    vf=v1i+f2*(v2i-v1i);

    where f1 and f2 vary from 0 to 1.
    Last edited by VirtualAce; 05-26-2004 at 05:45 PM.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. lots of freeware
    By major_small in forum General Discussions
    Replies: 57
    Last Post: 05-28-2014, 05:42 PM
  2. get keyboard and mouse events
    By ratte in forum Linux Programming
    Replies: 10
    Last Post: 11-17-2007, 05:42 PM
  3. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  4. the effects of textures on my frame rate
    By DavidP in forum Game Programming
    Replies: 37
    Last Post: 10-03-2003, 12:24 PM
  5. What's a 3D engine?
    By Garfield in forum Game Programming
    Replies: 6
    Last Post: 12-18-2001, 04:06 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21