1
\$\begingroup\$

I am asking myself how to solve the granularity of terrain by zooming into it.

My idea is to create very first just a square represented by four vertices and 6 indices. By zooming in the square is divided into smaller squares each representing a chunk. My question is now: Do I have to scale the whole quad or do I have to generate in the very first state just a very big square?

And how is the granularity of terrain determined? By distance obviously, but what is the formula?

I thank You in advance!

\$\endgroup\$

1 Answer 1

0
\$\begingroup\$

This is very broad, but let me try to explain how it might work in a typical case.

You would need to either make or generate a high-res texture for the most detailed level of the terrain. Using a GPU tech like OpenGL or DirectX, we'd then turn on mipmapping for this (power-of-2 sized) texture, to allow the GPU to auto-generate successively coarser versions of that highly detailed quad; each successive level of the mipmap is used when the camera is at some distance away from the surface in question (of course, we use the most detailed when we are very close by, and the least detailed when we are very far away). Even when not using a GPU, this is still a common pattern.

One of the benefits of mipmapping at least in the GPU context, is that sampling the texture is more efficient since not as many texels need be sampled when the player is far away from the textured object. This is typical of any kind of LoD approach - what is further away requires less work to render.

There's no particular formula; you may want to use powers-of-2 distance to determine what level of detail you will display, or this may depend on your field-of-view angle, or some other factors... all down to your implementation and your own choices. Best is to experiment and see what works for you.

\$\endgroup\$
4
  • \$\begingroup\$ It's a good explanation ! I also thought about using 1/r^2 for measuring the distance.. The idea of mipmap is indeed very good. \$\endgroup\$ Commented Jul 26, 2017 at 20:03
  • \$\begingroup\$ @φConst.NET Then upvote it or accept it :) \$\endgroup\$
    – Engineer
    Commented Jul 26, 2017 at 20:04
  • 1
    \$\begingroup\$ I am sorry, not able to upvote ^^+ \$\endgroup\$ Commented Jul 26, 2017 at 20:04
  • \$\begingroup\$ Thanks. Glad it helped; come back to us if you have further questions. \$\endgroup\$
    – Engineer
    Commented Jul 26, 2017 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .