Jump to content
  • Advertisement
Sign in to follow this  
jjanevski

Heightmap Texturing Under Limited Conditions

This topic is 3638 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings, I'm trying to program a simple terrain engine and build on it. I am quite new to this so I am learning more stuff all the time. What I have right now is a simple engine that read a .raw file (64x64 -- my heightmap) and creates mesh using triangle strips stored in a vertex array. I have also computed vertex normals, and texture coords. I have stretched a 512x512 texture over my terrain, but things will not look good once I progress and get a larger terrain. I have done some research and found some things such as texture splatting, procedural texturing, and detail texturing. These all seem nice (better than what I currently have). I have some issues though. I am limited to a max texture size of 512x512 pixels, and I have no hardware support for multitextuing. I would like to create a nice looking terrain that is pleasant to the eye and yet still functional on my target hardware. Does anyone have an recommendations and or methods? Any help would be greatly appreciated. :)

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by jjanevski
I am limited to a max texture size of 512x512 pixels, and I have no hardware support for multitextuing. I would like to create a nice looking terrain that is pleasant to the eye and yet still functional on my target hardware.
Those are pretty tight limits in this day and age - would you mind telling us what hardware that is? I assume an elderly integrated video setup I see it is a PSP.

First off, you aren't going to be able to do anything much in the way of splatting or detail texturing with that setup, so you will have to do multipass rendering if you want that type of effect. Chances are however, that you don't have enough horsepower to do many passes either, so stick with detail texturing at best.

I would suggest that you texture your terrain in 512x512 tiles, and bake all the details of your terrain into each tile. This takes a huge amount of disk-space compared to on-the-fly splatting, but it allows you to do all the blending and what-not you need to as a pre-process step.

Share this post


Link to post
Share on other sites
Well, first of all are you sure about this:

Quote:
I am limited to a max texture size of 512x512 pixels, and I have no hardware support for multitextuing.


A max texture size of 512x512 and no hw multitexturing support sounds like a *really* old graphics card. If it's a project spec you'll have to live with it of course, but if you have the DX SDK installed take a look at the cardcaps.xls file (hidden away in the SDK install directory, you'll have to do a quick search). Any non-ancient card should support somewhat larger textures and at least a few so-called TextureStageStates to do basic multitexturing.

If you really have no choice, you could construct the entire terrain texture on the CPU in a prepocessing step (manually or by using DX texture shaders). Depending on your terrain size that would be pretty prone to magnification artifacts though. To make it look somewhat ok I think you'd have to cut the terrain up in a number of chunks and render/texture these seperately.

Hope this helps and/or makes some sense at least [smile]


[Edit] Getting started with a PSP no less, nice! With the relatively low specs of the device, I think you'd be better off with swiftcoder's suggestion of baking as much information as possible in the terrain, offline during content creation. I'm no PSP expert by any means, but I'd imagine the tradeoff in diskspace is well worth it if you can free up some precious CPU time.

Share this post


Link to post
Share on other sites
Hey, thanks for the ideas!

Yes, I am programming on PSP. :)

Well, even though there is no GPU doesn't have multitexturing I'm still going to try to fight on. ;) I'm not sure how much HP it will take to do multiple passes.

swiftcoder: You mentioned baking my textures. I was hoping to have a simple day / night cycle that ran off the PSP internal clock, so the light source would change according to this, as well as the color of the sky. So I'm not sure how baking textures would work with this (unless I have textures with no light shadows baked into them).

I could just use photoshop and build a type of megatexture that covers the entire terrain in detail, and then break that 1 huge texture up into small chunks of 256x256 textures. Would that look good enough? This would be quite a lot of data though no?

Right now I have no LOD system implemented, but I am planning on using a quadtree to do the sorting of vertexes and hopefully ease the stress of rendering. If I have a LOD system using quadtrees, wouldn't I be able to do some sort of texture splatting then? I could perhaps do some detailed texturing w/ splatting near the camera where the LOD is high, and then for stuff in the distance use some less detailed stuff.

remigius: On PSP I use GU, which is pretty much the PC equivalent of OpenGL.

I know I am under some tight restrictions here, but I want to try and create something beautiful none the less on the PSP. Thanks for all the feedback and ideas!

Share this post


Link to post
Share on other sites
Quote:
Original post by jjanevski
I could just use photoshop and build a type of megatexture that covers the entire terrain in detail, and then break that 1 huge texture up into small chunks of 256x256 textures. Would that look good enough? This would be quite a lot of data though no?

This really depends on the details you want - the texel/pixel ratio. In the end, the full texture can be quite big but remember that there is no need to get more than one texel for any screen pixel. To get this ratio you can display a typical terrain triangle (viewed from the top) and count the number of pixels on each direction.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
First off, you aren't going to be able to do anything much in the way of splatting or detail texturing with that setup, so you will have to do multipass rendering if you want that type of effect.


Actually, the origin of the name 'splatting' comes from the idea of compositing layers in the framebuffer - like throwing splats of paint onto the screen. Bloom's notes suggest that this is exactly the type of situation he used it for - multipass rendering to accumulate apparent texture detail when texture size and number of texture units per-pass are limited.

Terrain Texture compositing by Blending in the Frame-Buffer(aka "Splatting" Textures)

Here's a good thread Mephs started on the topic: Creating detailed terrain under severe limitations


Share this post


Link to post
Share on other sites
Ah, mrbastard! Thank you very much for this info! From what you are saying, I gather that texture splatting is actually useful in my situation. This is good.

Here are some screen shots of what my terrain currently looks like:








I know it's not very much right now, but it's a start for me. Hopefully I can continue to improve on it.

Currently my terrain is small as you can see from the pictures above. It seems to me that loading a larger heightmap file to get a larger map will create a lot more vertex data just to get a larger map. Should I just spread out the vertices's along the x, z plane by increasing the x, and z in my terrain mesh create loop?

[Edited by - jjanevski on July 3, 2008 12:16:34 PM]

Share this post


Link to post
Share on other sites
Well, as others have said, multiple passes come at a cost. It's up to you whether the extra texture detail is worth that cost. If your heightmap is split up into chunks for culling, you could just do the splatting on the chunks nearest the viewpoint.

Yes, you could scale up your terrain vertex grid, or you could change your camera setup.

Share this post


Link to post
Share on other sites
If you don`t have the option of loading all terrain textures due to space issues, I would definitely construct the final texture per each chunk on CPU.

From what I recall, the PSP has 333 MHz CPU ? Something like that. It shouldn`t be a big deal trying to construct 3x3 chunks with 64x64 texture at runtime. Of course, you`ll do the first 3x3 chunks while loading the level and later, when you move throughout the world, you slowly create other chunks - each frame one chunk, or if it takes too long, just spread the computation through several frames (i.e. compute 8 rows each frame, or sth like that) - meaning you create the FIFO queue, where all 3x3 chunks will be and every time you create the texture for one chunk, just pick it from the queue.

Of course, depending on size of your terrain tiles, it might be necessary to create 5x5 chunks - it all depends how it looks during gameplay, so there`ll be some tweaking to size of chunks/textures (as always is).

Since PSPs come in 2 CPU clock versions, it would be nice, if you allowed for more detail textures for those that have the OC`ed version ;-)

Share this post


Link to post
Share on other sites
I'd say if you need it to look good then you need the 2nd detail modulation pass.
You can't do this (different resolution) pass by splatting on a single base texture that large.
At least try it; you probably won't want to go back ;)
Look at these two shots 1 2 and tell me which looks better (both have the same res base colour texture.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!