Path: chuka.playstation.co.uk!news From: "D Smethurst" Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: 3D Uneven Terrain Date: Sun, 26 Jul 1998 10:53:57 +0100 Organization: PlayStation Net Yaroze (SCEE) Lines: 91 Message-ID: <6pg28c$3ue1@chuka.playstation.co.uk> References: <6otsjq$cv91@scea> <35B328FC.E0B64296@hinge.mistral.co.uk> NNTP-Posting-Host: ulthwe.demon.co.uk X-Newsreader: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Craig Graham wrote in message <35B328FC.E0B64296@hinge.mistral.co.uk>... >Nathan Miller wrote: > >> 1) You make a data structure in addition to the tmd that represents the >> terrain that divides the level into your average cell based world: >> struct mapdata >> { >> int flag; >> //Link list containing items and such for cell >> }; >> mapdata level1[50][50]; > >That's similar to a Voxel. > >What you can do is generate a 'height map' bitmap on the fly: >Here's one way : >1) Setup the fogging so that you get a fairly good fade out effect from high >intensity >pixels at the highest point on the map to low intensity/black at the lowest >point of >the map. >2) Have the playstation render a top-down view of your map model to an offscreen > >area of VRAM (size is relative to how accurate you need the map to be). >3) Copy the VRAM area into DRAM - viola, you've generated the height map. >Black == low , white==high. Interesting way to generate a landscape, I've seen it used alot before though I haven't coded one this way yet. I suppose it would make map creation easier aswell. Anyway , I've done a similar project under DOS/professional PSX Dev kit. I used an array of int's to give a landscape height at a certain point on the map. The co-ords for the polygons were then generated from this with a tile size of 32x32 so that the x & z components were generated so that each tile was aligned with the one next to it. The height (y) component was generated for each of the 4 tile points by taking the 3 neighboring values and finding the heighest point. i.e. 3 4 4 3 2 2 2 1 1 Given this general array above when you generate the 4 corner y values you get 4 4 3 2 Then these are also applied a height factor (I think I used 16 !) to give it's relative display position. The map only needed to be generated once as all other functions of moving/rotating/ scaling can be done after, it also means that I can write (in the end) a program to generate each map cell from the map and save it to a file. Of course I haven't done much on this recently due to time constraints etc though I am working on a 3Dfx (Glide) version atm ... and a D3D version some time in the future when I get to it. >Advantages: >1) This solves the problem of interpolating polygons yourself to generate the >height map. >2) You only have to do it once for the current map. >3) If you want high accuracy and a real big map, you can regenerate the height >map >every N frames or whenever the player moves to far. >4) Can be used with dynamically generated TMD landscapes. >5) Very Very fast. > >> 2) you check the players height level directly with the tmd's vertex data > >Can be done, but you then have to interpolate to create the polygon planesto get >the height at a given point. D.