Outerra forum

Outerra Engine => Technology => Topic started by: Tommy on December 12, 2011, 10:27:00 am

Title: Texturing
Post by: Tommy on December 12, 2011, 10:27:00 am
Hi there,
i am doing some planetary stuff as a school project and i want to know how do you manage textures. I have done this:
Level Of Detail (http://www.youtube.com/watch?v=NSclvuioZhc#)
and now i want to add texturing. If i understand it well, in Outerra you generate 256x256 unique texture for every terrain patch - and this is the problem - i dont get it  :-[ . I am newbie in this stuff, can you tell me what is the main idea here? I mean on what basis are patch textures generated? What is the "input stuff" for generation and how the generation work in general? Or can you just lead me to what i need to study first?

Tommy       
Title: Re: Texturing
Post by: cameni on December 12, 2011, 01:46:30 pm
In the ancient Outerra predecessor I was texturing the terrain tiles using the available (or computable) terrain attributes, like height, slope and curvature. The very basic version used just the height and the slope, transforming them into lookup coordinates into 2D texture with simple colors, determining what color to use for given height and slope.

It was producing output like this:
(http://www.outerra.com/cameni/2001/tes32.jpg)

Obviously, to get better results you'd need far more terrain attributes as input to the texture generator. To get rid of artifacts associated with direct terrain attributes (for example bands of colors at the same height) we use additional independent fractal channels (think of it as additional heightfields generated in parallel), that are used for many tasks - for example to displace the lookup coordinates, breaking up the artifacts; to blend alternative materials according to probabilities; to colorize large flat areas etc.
Title: Re: Texturing
Post by: Tommy on December 14, 2011, 07:24:56 am
Hi cameni, thanks for the reply,

I think i understand it little bit more now, i'm going to implement something. The biggest problem i am expecting is how to generate texture fast enought. In case of 256x256 its more than 65 000 computations, including computing pixel height and another parameters, and then some fractal noise... 
Title: Re: Texturing
Post by: noizex on February 10, 2012, 07:36:34 pm
Hello there!

Cameni, could you please tell us some more on how you approached texturing the terrain? I'm working on voxel terrain that can be modified on runtime and I'm heaving really hard time trying to find a good way to texture such a terrain without some megatextures and other tricks that can be applied to static "levels" and maps.

So far I came with a solution that "may" work well - texture far and medium distance with color texture only and possibly perturb normals of that terrain depending on material so it looks good from far (rocks are rocky etc.), then apply detail texture near the player.

I love the look of your terrain (especially rocks) and I'd love to hear some more on technical side of it. What you do in shaders, what you precompute etc. I guess perturbing normals in shader on runtime won't work too well for big terrain, as it will have to do the same operation over and over, every frame.

Thanks for any insight you could give on this topic!
Title: Re: Texturing
Post by: cameni on February 12, 2012, 05:54:01 am
I'm basically using simple terrain textures, which reduce to single color - a 1x1px mipmap level when texturing distant terrain. The textures are nothing much, without additional perturbation they would look pretty bland, see for example this old screen shot:
(http://www.outerra.com/shots/k105.jpg)

The textures applied on large areas show repeating patterns, but it gets remove by the modulation. The trick is indeed in the additional processing, in computing parallel fractal channels and using them for color modulation, normal perturbation etc.

You are right that it would be computationally expensive to perform it all at run time; a large part of it is thus being done in the time of generation, with the resulting textures and geometry being cached. Run-time shaders then perform only some light weight operations. Of course, this requires a clever cache management to keep the GPU memory consumption below some limits - and I'm still having some issues with that.