Procedural texturing: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 33: Line 33:
Tiling is also reduced if the variation of contrast inside a texture is reduced, i.e. the texture becomes more 'dull' and the pattern repetition is less obvious:
Tiling is also reduced if the variation of contrast inside a texture is reduced, i.e. the texture becomes more 'dull' and the pattern repetition is less obvious:


[[File:tiling_example.jpg|300px|An example for texture tiling]]
[[File:tiling_example.jpg|400px|An example for texture tiling]]
[[File:contrast_reduction.jpg|300px|Reduced contrast makes the problem less apparent]]
[[File:contrast_reduction.jpg|400px|Reduced contrast makes the problem less apparent]]


However, contrasts within a texture are the best way to distract the eye from the sharp landclass boundaries, so if one uses low contrast textures, the landclass boundary problem gets often worse.
However, contrasts within a texture are the best way to distract the eye from the sharp landclass boundaries, so if one uses low contrast textures, the landclass boundary problem gets often worse.
Line 52: Line 52:
Procedural texturing is a solution to both the tiling and the resolution problem, and partially also for the boundary problem. A mathematical function, unlike a lookup table (which a texture in essence is) does not end at any boundary, i.e. it can simply be used across the whole scene without ever creating a repetition. Using a suitable noise function to mix various textures, a complete de-tiling effect can be achieved (this is really the same scene):
Procedural texturing is a solution to both the tiling and the resolution problem, and partially also for the boundary problem. A mathematical function, unlike a lookup table (which a texture in essence is) does not end at any boundary, i.e. it can simply be used across the whole scene without ever creating a repetition. Using a suitable noise function to mix various textures, a complete de-tiling effect can be achieved (this is really the same scene):


[[File:tiling_example.jpg|300px|An example for texture tiling]]
[[File:tiling_example.jpg|400px|An example for texture tiling]]
[[File:procedural_detiling.jpg|300px|Procedural texturing removes the tiling]]
[[File:procedural_detiling.jpg|400px|Procedural texturing removes the tiling]]


A function can also be evaluated at any scale resolution. Unlike a texture which needs to be stored regardless if it is used or not, a function only needs to be evaluated for every screen pixel, i.e. the workload and memory requirement do not grow quadratically with the needed resolution but only linear. This scaling allows to dynamically add details to the scene as one gets closer (this is really the same scene):
A function can also be evaluated at any scale resolution. Unlike a texture which needs to be stored regardless if it is used or not, a function only needs to be evaluated for every screen pixel, i.e. the workload and memory requirement do not grow quadratically with the needed resolution but only linear. This scaling allows to dynamically add details to the scene as one gets closer (this is really the same scene):


[[File:resolution_example.jpg|300px|An example for low texture resolution]]
[[File:resolution_example.jpg|400px|An example for low texture resolution]]
[[File:procedural_resolution.jpg|300px|Procedural texturing adds details at close range]]
[[File:procedural_resolution.jpg|400px|Procedural texturing adds details at close range]]


== Building blocks of procedural texturing ==
== Building blocks of procedural texturing ==
Line 124: Line 124:
The base texture is used as in the default scheme to give the basic appearance of a landclass. The base texture is assumed to be opaque, and its alpha channel is hence not evaluated to transparent, but rather used to encode where the autumn color effect should be used. An alpha value of 0.5 is appropriate for deciduous forests which should get a strong red-orange appearance in autumn, a value of 0.8-0.9 is more appropriate for grass surfaces.
The base texture is used as in the default scheme to give the basic appearance of a landclass. The base texture is assumed to be opaque, and its alpha channel is hence not evaluated to transparent, but rather used to encode where the autumn color effect should be used. An alpha value of 0.5 is appropriate for deciduous forests which should get a strong red-orange appearance in autumn, a value of 0.8-0.9 is more appropriate for grass surfaces.


[[File:tiling_example.jpg|300px|center|Base Texture]]
[[File:tiling_example.jpg|400px|center|Base Texture]]


The base texture can take some additional parameters. The first is intrinsic wetness. If the quality level of the shader supports it, this will make the texture appear wet and add sparkling specular reflections to the terrain even if the surrounding terrain is dry. The dust resistance acts in the opposite way, it is intended for irrigated terrain in desert areas and is a multiplier for the dust effect, i.e. a value of 0.0 will make a landclass completely impervious to dust. Finally, rock strata represents an integer flag whether a stratified pattern will be drawn on vertical surfaces or not.   
The base texture can take some additional parameters. The first is intrinsic wetness. If the quality level of the shader supports it, this will make the texture appear wet and add sparkling specular reflections to the terrain even if the surrounding terrain is dry. The dust resistance acts in the opposite way, it is intended for irrigated terrain in desert areas and is a multiplier for the dust effect, i.e. a value of 0.0 will make a landclass completely impervious to dust. Finally, rock strata represents an integer flag whether a stratified pattern will be drawn on vertical surfaces or not.   
Line 148: Line 148:
The overlay texture is a texture at a similar resolution level which is mixed with the base texture to achieve de-tiling or gradient effects. By default, it covers about 50% of the available scene. As for the base texture, the alpha channel of the overlay texture encodes color rotations in autumn.
The overlay texture is a texture at a similar resolution level which is mixed with the base texture to achieve de-tiling or gradient effects. By default, it covers about 50% of the available scene. As for the base texture, the alpha channel of the overlay texture encodes color rotations in autumn.


[[File:overlay1.jpg|300px|center|The overlay Texture]]
[[File:overlay1.jpg|400px|center|The overlay Texture]]


The overlay texture can be used in two different modes or a mixture of them. The control parameter is <transition_model> - if this parameter is set to 0, the transition between base and overlay texture is determined by a noise function. If the parameter is set to 1, the slope of the terrain determines the transition and the overlay texture is only used on steep slopes. A setting of 0.5 uses a mixture of noise and slope information to drive the transition.
The overlay texture can be used in two different modes or a mixture of them. The control parameter is <transition_model> - if this parameter is set to 0, the transition between base and overlay texture is determined by a noise function. If the parameter is set to 1, the slope of the terrain determines the transition and the overlay texture is only used on steep slopes. A setting of 0.5 uses a mixture of noise and slope information to drive the transition.
Line 177: Line 177:
As for the base texture, the alpha channel of the hires texture encodes color rotations in autumn.
As for the base texture, the alpha channel of the hires texture encodes color rotations in autumn.


[[File:overlay02.jpg|300px|center|The hires Texture]]
[[File:overlay02.jpg|400px|center|The hires Texture]]


The parameter <hires_overlay_bias> controls the fraction of terrain covered by the hires texture patches - by default about 40% of the scene will be covered. Positive or negative biases can make the fraction arbitrarily small or large.
The parameter <hires_overlay_bias> controls the fraction of terrain covered by the hires texture patches - by default about 40% of the scene will be covered. Positive or negative biases can make the fraction arbitrarily small or large.
Line 220: Line 220:
The grain texture adds a grainy pattern to the terrain at close distances, giving the appearance of better resolution. The grain texture parses the texture alpha channel as transparency (since it just superimposes a pattern), so here the alpha channel can not be used to encode vegetation effects, and the grain texture may not have a strong color.
The grain texture adds a grainy pattern to the terrain at close distances, giving the appearance of better resolution. The grain texture parses the texture alpha channel as transparency (since it just superimposes a pattern), so here the alpha channel can not be used to encode vegetation effects, and the grain texture may not have a strong color.


[[File:grain_texture.jpg|300px|center|The grain overlay texture]]
[[File:grain_texture.jpg|400px|center|The grain overlay texture]]


To allow fine-tuning of the grain effect, the texture can be multiplied with the <grain_strength> parameter which sets the overall alpha of the grain effect - a low value works best on bright base textures whereas dark base textures may require a stronger grain.
To allow fine-tuning of the grain effect, the texture can be multiplied with the <grain_strength> parameter which sets the overall alpha of the grain effect - a low value works best on bright base textures whereas dark base textures may require a stronger grain.
Line 248: Line 248:
The dot overlay uses sparse dot noise to create detail in the scene. Sparse dot noise textured with a rock texture can give the appearance of boulders scattered across the terrain, the same noise textured with a grass texture can be used to create round vegetation patches.
The dot overlay uses sparse dot noise to create detail in the scene. Sparse dot noise textured with a rock texture can give the appearance of boulders scattered across the terrain, the same noise textured with a grass texture can be used to create round vegetation patches.


[[File:hires_terrain03.jpg|300px|center|The dot overlay texture creating grass patches]]
[[File:hires_terrain03.jpg|400px|center|The dot overlay texture creating grass patches]]


Both the dot size and the dot density can be controlled by the user. The range out to which the dots are visible is automatically adjusted based on the dot size scale. By default, the dot texture is set to void.png, which means that no dot texture is used.
Both the dot size and the dot density can be controlled by the user. The range out to which the dots are visible is automatically adjusted based on the dot size scale. By default, the dot texture is set to void.png, which means that no dot texture is used.
Line 289: Line 289:
results in marshland drawn like this
results in marshland drawn like this


[[File:marsh_example.jpg|300px|Procedural marshland close-up]]
[[File:marsh_example.jpg|400px|Procedural marshland close-up]]
[[File:wetness.jpg|300px|Procedural marshland from the distance]]
[[File:wetness.jpg|400px|Procedural marshland from the distance]]


The following declaration
The following declaration
Line 308: Line 308:
results in stratified rock structures like the following:
results in stratified rock structures like the following:


[[File:Southwest04.jpg|300px|Procedural rock Grand Canyon]]
[[File:Southwest04.jpg|400px|Procedural rock Grand Canyon]]
[[File:Southwest09.jpg|300px|Procedural rock Zion National Park]]
[[File:Southwest09.jpg|400px|Procedural rock Zion National Park]]


=== Pixel color postprocessing ===
=== Pixel color postprocessing ===
1,360

edits

Navigation menu