Is there any way to adjust terrain texture size dynamically? How to deal with the near/far problem?

Hi all. I’m poking around with terrain, and terrain textures today. I’m using 2048x2048 images which, i believe, are the biggest unity can suppoirt (is that incorrect? i can generate larger if i can use them)

Textures have a mapping properety called Size, which is just how much space one tile of the image takes up. A higher number means less tiling/repetition

What i’m noticing is the following things:
-For up-close examination, ie a character walking around on the ground, a small Size property looks best, as you can see sharp details. A larger size is very spread out and looks more blurry

-For far away examination, eg looking into the distance, or standing on a high place, a larger size property looks best. Because with smaller sizes, you can see the repetitions in the pattern and it looks very artificial

It seems i just can’t win. How do others deal with this problem?

Is it possible for a script to access and change these values? Would it look odd if i had the size scale dynamically with the camera’s height? (doesn’t solve distance at the same height though)

Hey, well first off, I wouldn’t use 2048 x 2048 textures unless I had too LOL.
But that’s just personal preference…

There’s a couple things you can try with the blurriness.

1 - Make sure your textures have a high Ansio level (I’ve noticed it helps with getting rid of blurriness on models at least)
2 - Change the Base Map Distance on Terrain to a higher number. (this tells Unity when to use a lower res texture for distant terrain).
3 - Change Tile Sizes of textures.
4 - Try messing with the Resolutions (may or may not helps depending what your are trying to do).

Hope this helps!

This actually looks worse. Considerably so. I LIKE the blurriness at long distance, because it obscures some of the detail. As mentioned the problem with long distance viewing is that the texture looks more repetitive and unatural. This is due to the tiling, not the resolution. Having textures drawn at higher detail in the distance makes this repetition far more noticeable.

Why not 2048 textures anyways? I’m not going to slap them on every tiny thing, obviously, but terrain is a massive object and i think it’s the most important thing as far as texture size goes. The more detailed the texture, the higher i can set the size for closerange viewing, which impacts on the longrange problem.

Because 2048 x 2048 texture uses 16 megs of video memory x 4 (for 4 textures per splat map) is 64 megs of graphics memory. Which need I say would over run a decent laptop like mine which only has 60 megs of integrated video memory.

Now if you’re targeting like 2 gig graphics cards go right ahead it won’t hurt anything.

But I’d recommend adding foliage (grass, trees, rocks, etc) to cover a lot of areas to hide the fact the terrain is tiling.

I got an ICore 3 2.4 Ghz Duel Core Sony Vaio, it can handle pretty decent games actually despite the 60 Megs Integrated Video memory. But when Unity gets that high, kiss that good buy lol.

1 Like

lol. I’m definitely not targeting your laptop, or anything anywhere near that hardware class. I’m aiming for generally “modern” hardware.

But in any case, won’t these massive textures only apply on the highest video settings? unity has options for quality and stuff like that, doesn’t it? i’d assume lower hardware could turn down texture sizes if necessary.

I do have a 2GB video card, expecting everyone to might be a bit excessive, but i’m certainly not targeting low end stuff, i’ll probably look at the steam hardware survey or somesuch to get an idea of market demographics. Does anyone know of similar resources for that sort of thing? I’ll work on memory budgeting as i get nearer to some sort of completion, i’ve literally just started on a project today.

foliage isn’t an option in my specific case, but i’m sure i can place artificial obstacles of some sort

btw, no response on my original question; Can terrain texture size be altered with scripts at runtime?

Oh also, as near as i can tell, terrain textures only have two images, diffuse and normal map, so wouldn’t that halve your estimate of memory cost?

Sorry went to pick somebody up.

Well then you’ll be fine Graphics wise just make sure you target a mainstream audience like you were saying checking Steam demographics.

But the last thing you posted, not sure. I always just read that terrain had 4 textures per splat map and always worked off of that.

But I would assume you could somehow make a script to do that (to adjust the terrain texture size) at a distance, but I honestly wouldn’t know how to go about doing that.

I’d put this on the Answers page and see if anyone there can help you.

(Sorry we got off topic) I was just trying to help.

1 Like

Hope someone can help you with that. Good luck!

If you want good looking terrain, I’d recommend looking into RTP: Unity Asset Store - The Best Assets for Game Making

They deal with the problem you’re talking about in a couple of ways, for example:

  • UV layering: This is where far away textures have a larger, sometimes different bump map texture overlayed on top of them to break up the tile pattern and make it less obvious.
  • Color maps at distance: You can have textures fade out to just flat colors in the distance so that you don’t end up with dark lines in rocks creating obvious tiles.

You could implement these things yourself but RTP does a very good job of it.

hi guys, I posted solution here: How do i adjust terrain texture sizes via script - Questions & Answers - Unity Discussions