Texture update to the Terrain Demo |
||
Monday, 23 October, 2006, 10:13 PM try the Terrain demo hereHave updated the textures on the Terrain demo. I think it makes a world of difference. please comment :) [ 3 comments ] ( 1862 views ) | permalink |
||
A few little updates to the Terrain demo |
||
Friday, 20 October, 2006, 07:20 PM Have made a few little updates to the Terrain demo. Changed the resolution to 800*600 and made it start in fullscreen mode by default. you can toggle fullscreen mode by pressing F1. Changed the mouse-look due to some complaints (let me know what you think of it now). Hopefully have perfected the HUD radar.Well, theres nothing special in this update, but its kind of looking like a game now instead of a demo, and I`m not sure that`s what I wanted . [ 2 comments ] ( 200 views ) | permalink |
||
HUD radar |
||
Wednesday, 18 October, 2006, 12:39 PM Have added a radar to the HUD of the Terrain demo . At the moment, its very basic but it currently displays all the baddies in relation to the player who is displayed in the centre. Distance from player and rotation are properly implemented with baddies further than 1/2 the map size away removed.The idea was to show an upward pointing arrow for baddies above the players height and a downward pointing arrow for baddies below the player. At the moment, these arrows are rendered but their orientation is messed up by the rotation. Ah, and I havent't textured/coloured them properly yet either. [ 3 comments ] ( 960 views ) | permalink |
||
Site Header |
||
Sunday, 15 October, 2006, 05:23 PM Messing about trying to design a site header. comments welcome :)[ 2 comments ] ( 240 views ) | permalink |
||
bilinear interpolation |
||
Saturday, 14 October, 2006, 11:41 PM "What the hell is bilinear interpolation?" I hear you ask.Let me make a few assumptions here to make my explanation simpler. You have made a heightmap Terrain and you want to "walk" around your terrain. You realise that you can set your height at any point on your heightmap and sail around on or just above your terrain. But wait, you realised that when your terrain changes height, you "jump" from the height at one point to the height at the next. then you start wondering what to do about smoothly sliding from one height to the next and you finally come to the conclusion that you need some kind of algorithm for working it out for you. Am I about right so far? ok, so this is where interpolation comes in to the picture. Interpolating is the process of "working out the bits in between". there are loads of algorithms to do this for you, and I have tried most of them with varying degrees of success. I finally settled on bilinear interpolation as it is quite simply the best one out there without getting stupidly complex. Next, how do we calculate this algorithm? well I went and found out the details from my favourite info site (en.wikipedia.org) and from there decided to look a little further. I found a lovely site that gave me everything I needed here and coded the little thing in. it looks really complicated on there, so here`s what I boiled it down to: private float InterpolateGridHeight(float xpos,float zpos,int STEP_SIZE){ float h00 = getheight((int)xpos,(int)zpos); float h10 = getheight((int)xpos+STEP_SIZE,(int)zpos); float h01 = getheight((int)xpos,(int)zpos+STEP_SIZE); float h11 = getheight((int)xpos+STEP_SIZE,(int)zpos+STEP_SIZE); float h1=h00; float h2=h10; float h3=h01; float h4=h11; float a00 = h1; float a10 = h2-h1; float a01=h3-h1; float a11=h1-h2-h3+h4; float partialx=xpos-(int)xpos; float partialz =zpos-(int)zpos; float hi=a00+(a10*partialx)+(a01*partialz)+(a11*partialx*partialz); return hi; } so all we do is send our x and z positions(float) along with the step size - normally 1. And this little baby will interpolate the correct height for us and return it ready to be used as our y position to sit us comfortably on the terrain. simple :) [ 1 comment ] ( 3954 views ) | permalink |
||







