Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


Why terrain mesh consists of elements of unequal size and has vertical walls?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 Misery   Members   -  Reputation: 318

Like
0Likes
Like

Posted 11 August 2014 - 11:29 AM

Hello

I have created my first terrain in Unity using Heightmap.I used a heightmap created in Photoshop.

 

Actually the terrain looks fine. It has only two glitches:

1. On the bounds of the terrain it has vertical walls which - according to the heightmap shouldn't be there. Why such thing occured there?

2. The terrain looks like it has mesh which density becomes larger as it gets closer to the bounds. Is it normal? I am afraid that it can slow down framerate.

Below are the images.

 

Terrain props:

terrain props.PNG

 

Heightmap:

HeightMap.png

 

Vertical walls:

VerticalWall.PNG

 

Terrain mesh:

StrangeHeightmapMesh.PNG

 

 



Sponsor:

#2 Madhed   Crossbones+   -  Reputation: 3709

Like
0Likes
Like

Posted 11 August 2014 - 11:34 AM

The field heightmap resolution reads 1025 although your texture is 1024 pixels wide. Maybe that is the problem with the wall.



#3 Misery   Members   -  Reputation: 318

Like
0Likes
Like

Posted 11 August 2014 - 11:35 AM

The field heightmap resolution reads 1025 although your texture is 1024 pixels wide. Maybe that is the problem with the wall.

I tried with the image 1025x1025 and the result was the same.



#4 Misery   Members   -  Reputation: 318

Like
0Likes
Like

Posted 11 August 2014 - 12:58 PM

After I rescaled my map so some of the heightmap is white vertical walls disappeared. But still I do not understand why the mesh is more dense at the bounds.



#5 Gian-Reto   Members   -  Reputation: 3758

Like
1Likes
Like

Posted 12 August 2014 - 10:10 AM

Altough I have not dabbled to much with the terrain settings (hey, don't fix it if it ain't broken), I'll try to stab in the dark here a little bit:

 

Could this have to do with the Terrain LOD System? Does the shown density stays the same when you move around the camera? Even in Edit mode, terrain LOD System will kick in to keep up a constant FPS Rate.

 

The fact that this higher density areas are only visible in the foreground, is somehow pointing in this direction.

 

If you play around with the pixel error settings, does that change anything for you? AFIAK, the lower the pixel error, the higher the Terrain Resolution. 5 is the default value, so I guess you haven't played around with it yet?

 

Are there active cameras around the bounds that could cause the Terrain LOD System to increase the LOD Level for that areas? (makes little sense to me if the picture was taken in the Scene view, but hell, stranger things have happened).



#6 Hav0c   Members   -  Reputation: 126

Like
1Likes
Like

Posted 12 August 2014 - 11:39 AM

About adding pure white fixing the walls: Height maps should always range from pure white at the highest point to pure black at their lowest. You scale the height map to the actual min and max height later, but that image should use to full range of greys. To properly fix it, check the histogram of the image in Photoshop and adjust the image levels (or hit auto-levels) so that the entire range is used. Be careful not to clip the whites and blacks as you will create flat spots on the terrain.



#7 frob   Moderators   -  Reputation: 31277

Like
2Likes
Like

Posted 12 August 2014 - 02:12 PM

For your wall, as others have pointed out, you specified different resolutions which can cause effects like that. Sounds like you got that figured out.

 

 

For the third image in your post, Gian-Reto is correct that it comes from the dynamic LOD system.  To reduce processing it automatically downsamples the mesh for the less critical areas. Exactly how critical an area is depends on several factors, including its depth,  but also how prominently it is displayed on the screen (such as mountain peaks in the distance) and the mathematically-accumulated visual error. Whenever they switch between depths there adjacent region needs to be broken up carefully to avoid t-junctions.

 

Picture found online of a t-junction in terrain:

 

T-Junction.jpg

 

It has to break up the mesh a certain way to prevent tiny holes, or to prevent some slight flickering, which can occur at boundaries.

 

 

Finally, for your other settings, you have a fairly dense texture map. Usually you want somewhere around 2-4 meters per pixel, then use models to represent critical things on the terrain. You've got about 0.67 meters per pixel, which means you'll be spending more processing time on rendering. It is not a wrong value, but it can mean additional LOD processing, additional draw calls, and additional rendering effort on the terrain.  Given the tradeoff most games prefer to spend the effort on game models rather than the ground.

 

As you are just learning those settings are fine, but as you gain experience and your scenes become more complicated you will eventually need to make decisions about where to spend your computing power. Decreasing the terrain density is an easy tradeoff, since dense terrains and especially dense control textures can consume quite a lot of resources.  

 

For now, even though the many options are confusing when you start out just know that there are good reasons for the choices and they become important details in bigger projects.


Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.


#8 Misery   Members   -  Reputation: 318

Like
0Likes
Like

Posted 13 August 2014 - 06:42 AM

Thanks a lot. Now I know where were the issues :]



#9 Gian-Reto   Members   -  Reputation: 3758

Like
0Likes
Like

Posted 13 August 2014 - 07:57 AM

Finally, for your other settings, you have a fairly dense texture map. Usually you want somewhere around 2-4 meters per pixel, then use models to represent critical things on the terrain. You've got about 0.67 meters per pixel, which means you'll be spending more processing time on rendering. It is not a wrong value, but it can mean additional LOD processing, additional draw calls, and additional

 

About that: AFAIK, one easy fix can be to set the pixel error setting to a higher number. Your Terrain will now look less detailed (most probably because the Terrain LOD Systems uses lesser LOD Levels), but the amount of processing power spent on the terrain can decrease dramatically.

 

Tested that myself and the difference is staggering between pixel error of 1, 5, or 9. Both in Visual impact, and processing power saved.

 

 

Not saying this is better than adjusting the heightmap the Terrain is generated from, its just a good temporary option to reduce the amount of horsepower wasted on your terrain if your FPS are low.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS