Jump to content
  • Advertisement
Sign in to follow this  
Halsafar

Improve alpha map resolution on one buffer terrain

This topic is 4709 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

The subject says it all. I have a one DIP call terrain. I wish to use one alpha map stretched over it but at current it looks like this: 513x513 heightmap scaled by 100 into vertices (0 - 5130) the largest texture possible, 512x512 results in 1pixel/100 texels. How can I avoid this?

Share this post


Link to post
Share on other sites
Advertisement
can't you tile the alpha map ? or u dont want to tile it ? tiling will increase the pixel to texel ratio. If that is not what you want, you will have to use more than one alpha map.

Share this post


Link to post
Share on other sites
I cannot possibly tile the alpha map.
The alpha map has certain regions shaded to match the terrain's height and to mask certain textures in certain area's. It can only be tiled once.

Share this post


Link to post
Share on other sites
Well I got texture splatting working fine.
It has been incorporated into my engine.

Now it is a matter of solving what this subject claims.


I have to loose some fps and render terrain chunks with seperate DIP calls.
Or
I can find a way to increase alphamap resolution without tiling it. (read the first post)

Share this post


Link to post
Share on other sites
Either way, the only way to increase the alpha map resolution is to do just that -- increase the resolution. This is done either by enlarging the alpha map for that one giant zone for the entire terrain, or by splitting up the terrain into zones, each with its own alpha map. Both of these increase the effective terrain alpha map size. Splitting into zones also will help collision detection (especially ray casting) down the road.

I wouldn't worry about losing fps with multiple DIP calls. It's better than sending half a million triangles to the card just for the terrain, especially if you add multiple ground-type texture layers where it ends up requiring more than one pass (I've used up to 7 layers in one area).

Where did this "1pixel/100texels" thing come from though? I presume you mean 1 texel per 100 units.

Share this post


Link to post
Share on other sites
....ugh

My terrain is already in a quad-tree, it is also being frustum culled. It is also being rendered in a single buffer, which means one DIP call. The only expensive part of the operation is when a node memcpy's its vertices into the vertex buffer.

A texel in a texture pixel as it is mapped into the hardware.

For each pixel in the alpha map 100 texel's will use the point for its alpha blend. 513x513 heightmap, scaled by 100 to vertices, thus 5130x5130. The largest texture possible on most cards is 512x512, thus leaving me with an exact ratio of 1 alphamap pixel to every 100 texels.


Multiple DIP calls are ineffecient but it seems the only way.

I was pondering a way where I could send 4 alpha maps and 4 textures, each of the 4 alphamaps could represent the 4 most outer quad tree nodes. That would then give me a 1/50 ratio, but that is still pretty bad.

I need a 2/1 ratio, 2 pixels for every 1 texel...

Share this post


Link to post
Share on other sites
why would you need 2 alpha map pixels for 1 texel? Can´t think of a reason for such a HUGE alpha map resolution.

Share this post


Link to post
Share on other sites
Quote:
Original post by Halsafar
....ugh

My terrain is already in a quad-tree, it is also being frustum culled. It is also being rendered in a single buffer, which means one DIP call. The only expensive part of the operation is when a node memcpy's its vertices into the vertex buffer.

A texel in a texture pixel as it is mapped into the hardware.

For each pixel in the alpha map 100 texel's will use the point for its alpha blend. 513x513 heightmap, scaled by 100 to vertices, thus 5130x5130. The largest texture possible on most cards is 512x512, thus leaving me with an exact ratio of 1 alphamap pixel to every 100 texels.


Multiple DIP calls are ineffecient but it seems the only way.

I was pondering a way where I could send 4 alpha maps and 4 textures, each of the 4 alphamaps could represent the 4 most outer quad tree nodes. That would then give me a 1/50 ratio, but that is still pretty bad.

I need a 2/1 ratio, 2 pixels for every 1 texel...


Yes, I understand your "pixel/texel" arrangement independent of whatever naming convention you're using -- didn't need the definition of texel (even though it's just a texture element regardless of if it's being "mapped into hardware" or not)

Multiple DIP calls are not inefficient if you control the batch size properly. In fact, I'd sooner call DIP a few times rather than try and drop 40k triangles worth of vertices with memcpy. That way, I could stay over 500fps.

Why isn't it feasible to increase the alpha map size to 1024 or even 2048? The largest texture on most cards exceeds 512..

Share this post


Link to post
Share on other sites
It seems the point of dumping 40k triangles at once has been made twice....

In any scenerio, 40k triangles for the terrain at once is too much.
At most I probably run around 1k triangles, probably less.
Using one buffer for that is FAR faster than using one buffer for each bit of triangles in a node.


The resolution could be 1/1, that would be perfect.
I haven't had much time the past few days, no programming has been done. I'll be altering the terrain engine with a few tweaks, shouldn't take no more than 10 minutes and I'll have it set up with multiple buffers, which is wut I want to avoid.


The max on most older cards are 512x512.
My card happens to support 2048x2048, I suppose that would get me a 1/25 ratio...hmmm.

Share this post


Link to post
Share on other sites
40k is too much? Who has the say in what's too much?
Chalk that up to somebody saying that nobody would need more than 640kb of memory. Multiple passes for layering or other techniques can push 40k.

And can you prove that memcpy'ing random strips of vertices from one buffer to another is actually faster than calling DIP on maybe 5 or 6 different buffers.. all of which most likely already reside within the memory on the video card itself still (rather than having to retrieve a new memory block/dma & re-upload it every frame)?

It may be possible that it's "fast" because you're using such a huge XZ scale for vertices and are copying so few actual vertices, but I can't see that having any natural fidelity. What's your typical batch size?

I haven't heard of a card having a texture limit size of 512x512 for a long, *long* time. Even a GF3 Ti200 has a max texture size of 4096x4096. though limits for 3D textures of 512x512x512 still exist. However, that's huge anyway.

So we're left with your original problem. You're either stuck with increasing the resolution of the alpha image, splitting the possible 4 channels of it into 4 sections of mapped terrain (creating a need for a pixel shader to unsplit it.. which rules out any limit of 512 sized textures anyway), or making more than one DIP call.

more than one DIP call (especially since you've got such a huge scale, you'll only call it probably a maximum of 2 or 3 times in a frame) is NOT going to hinder your performance.

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!