Procedural Textures: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - ";[ ]+ " to "; ") |
Lou Montana (talk | contribs) (Add Point and Dithering + wiki formatting) |
||
Line 1: | Line 1: | ||
{{TOC|side}} | {{TOC|side}} | ||
Procedural textures are textures generated by the engine on the basis of their text description. | |||
They can be used anywhere instead of normal textures.<br> | |||
Text description of procedural texture is set in standard place of texture path and filename. | |||
To identify that a procedural texture is used, the character "#" is set at the beginning of the string.<br> | |||
Usually the string consists of procedural texture type name and arguments on both sides enclosed in brackets, in format {{hl|#(leftArgs)TypeName(rightArgs)}}. | |||
Textures may be generated procedurally and they take nearly no space on HDD but they still use space in video memory. | |||
Yet, if two materials use the exact same procedural texture string, the texture already existing in video memory is used and not duplicated - thus it may be important to try and avoid creating unnecessary similar textures. | |||
{{Feature|important| | |||
* There cannot be any spaces or mathematical expressions within the string. | |||
* Decimals always have to be preceded by a 0 (e.g. {{hl|0.5}} instead of {{hl|.5}}). | |||
There | }} | ||
== Procedural Texture Types == | |||
Note that all texture types have in common the left-hand parameters list: | |||
* format - texture color format (can be {{hl|rgb}}, {{hl|argb}}, {{hl|ai}}), {{hl|a}}), {{hl|i}}) | |||
* width - number of pixels in X, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc) | |||
* height - number of pixels in Y, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc) | |||
* mipmapsAmount - number of mipmaps | |||
=== | === Color === | ||
#(format,width,height, | #(format,width,height,mipmapsAmount)'''color'''(r,g,b,a) | ||
and | |||
#(format,width,height,mipmapsAmount)'''color'''(r,g,b,a,textureType) | |||
* r, g, b, a - texture channels (Red, Green, Blue, Alpha) | |||
* textureType - [[Texture Naming Conventions|texture type]] which match texture name ending without "_" (optional) | |||
* r, g, b, a - texture channels (Red, Green, Blue, Alpha) | |||
* | |||
Examples: | Examples: | ||
#(rgb,8,8,3)color(1,0,0,1) | #(rgb,8,8,3)color(1,0,0,1) | ||
#(rgb,1,1,1)color(0.5,0.5,0.5,1) {{cc|empty 1×1 detail map}} | |||
#(rgb,1,1,1)color(0.5,0.5,1,1) {{cc|empty 1×1 normal map}} | |||
#(rgb,8,8,3)color(0.5,0.5,0.5,1,dt) | #(rgb,8,8,3)color(0.5,0.5,0.5,1,dt) | ||
#(rgb,8,8,3)color(0.5,0.5,1,1,no) | #(rgb,8,8,3)color(0.5,0.5,1,1,no) | ||
Line 34: | Line 40: | ||
=== Render To Texture === | === Render To Texture === | ||
#(argb,512,512,1)r2t(surface,aspect) | #(argb,512,512,1)'''r2t'''(surface,aspect) | ||
* surface - The name that will later be used as reference in the camera script | * surface - The name that will later be used as reference in the camera script | ||
* aspect - Aspect ratio of the image | * aspect - Aspect ratio of the image | ||
{{Feature|informative|Do not use capital letters when naming RTT surfaces.}} | |||
Examples: | Examples: | ||
#(argb,512,512,1)r2t(rtt,1.0) | #(argb,512,512,1)r2t(rtt,1.0) | ||
#(argb,512,512,1)r2t(rendersurface,1.333) | #(argb,512,512,1)r2t(rendersurface,1.333) | ||
=== Perlin Noise === | |||
#(format,width,height,mipmapsAmount)'''perlinNoise'''(xScale,yScale,min,max) | |||
* xScale - horizontal noise scale (typically a multiple of 256) | |||
* yScale - horizontal noise scale (typically a multiple of 256) | |||
* xScale - horizontal noise scale (typically a | |||
* yScale - horizontal noise scale (typically a | |||
* min - minimum value | * min - minimum value | ||
* max - minimum value | * max - minimum value | ||
Examples: | Examples: | ||
#(ai,512,512,9)perlinNoise(256,256,0,1) | |||
=== Irradiance === | |||
#(format,width,height,mipmapsAmount)'''irradiance'''(specularPower) | |||
* specularPower - specular strenght | |||
* | |||
It | It is a values table that is used with per-pixel lighting. Modern shaders are not using this type of texture anymore. | ||
Examples: | Examples: | ||
#(ai,32,128,1)irradiance(8) | #(ai,32,128,1)irradiance(8) | ||
Line 80: | Line 79: | ||
Example: | Example: | ||
#(ai,64,64,1)Fresnel(1.3,7) | #(ai,64,64,1)Fresnel(1.3,7) | ||
=== | === Fresnel Glass === | ||
#(format,width,height, | #(format,width,height,mipmapsAmount)'''fresnelGlass'''() | ||
Examples: | Examples: | ||
#(ai,64,64,1)fresnelGlass() | #(ai,64,64,1)fresnelGlass() | ||
=== | === Water Irradiance === | ||
#(format,width,height, | #(format,width,height,mipmapsAmount)'''waterIrradiance'''(specularPower) | ||
* | * specularPower - specular strenght | ||
This texture main value is solely with special pixel shaders for water. | |||
Examples: | |||
=== | === Tree Crown === | ||
#(format,width,height, | #(format,width,height,mipmapsAmount)'''treeCrown'''(density) | ||
and | |||
#(format,width,height,mipmapsAmount)'''treeCrownAmb'''(density) | |||
for ambient lighting. | |||
* density - defines how much light passes thought tree-top ''via'' the longest line segment | |||
* density - defines how much light | |||
This texture is used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture). | |||
Parameter defines how much surrounding light passes into the defined point. | |||
Parameter defines how much surrounding light | It uses an exponential function of distance from circle boundary. | ||
Examples: | Examples: | ||
#(ai,32,32,1)treeCrown(0.2) | |||
#(ai,32,32,1)treeCrownAmb(0.5) | |||
=== Point === | |||
#( | #(format,width,height,mimapsAmount)point() | ||
Create a white dot on a transparent background. | |||
Examples: | |||
#(rgb,64,64,1)point() | |||
=== | === Dither === | ||
#(format,width,height,mipmapsAmount)dither(min,max) | |||
* min - minimum value | |||
* max - minimum value | |||
The format '''has''' to be {{hl|ai}} | |||
Examples: | |||
#( | #(ai,8,8,1)dither(0,150) | ||
Revision as of 18:29, 31 January 2022
Procedural textures are textures generated by the engine on the basis of their text description.
They can be used anywhere instead of normal textures.
Text description of procedural texture is set in standard place of texture path and filename.
To identify that a procedural texture is used, the character "#" is set at the beginning of the string.
Usually the string consists of procedural texture type name and arguments on both sides enclosed in brackets, in format #(leftArgs)TypeName(rightArgs).
Textures may be generated procedurally and they take nearly no space on HDD but they still use space in video memory. Yet, if two materials use the exact same procedural texture string, the texture already existing in video memory is used and not duplicated - thus it may be important to try and avoid creating unnecessary similar textures.
Procedural Texture Types
Note that all texture types have in common the left-hand parameters list:
- format - texture color format (can be rgb, argb, ai), a), i)
- width - number of pixels in X, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc)
- height - number of pixels in Y, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc)
- mipmapsAmount - number of mipmaps
Color
#(format,width,height,mipmapsAmount)color(r,g,b,a)
and
#(format,width,height,mipmapsAmount)color(r,g,b,a,textureType)
- r, g, b, a - texture channels (Red, Green, Blue, Alpha)
- textureType - texture type which match texture name ending without "_" (optional)
Examples:
#(rgb,8,8,3)color(1,0,0,1) #(rgb,1,1,1)color(0.5,0.5,0.5,1) // empty 1×1 detail map #(rgb,1,1,1)color(0.5,0.5,1,1) // empty 1×1 normal map #(rgb,8,8,3)color(0.5,0.5,0.5,1,dt) #(rgb,8,8,3)color(0.5,0.5,1,1,no)
Render To Texture
#(argb,512,512,1)r2t(surface,aspect)
- surface - The name that will later be used as reference in the camera script
- aspect - Aspect ratio of the image
Examples:
#(argb,512,512,1)r2t(rtt,1.0) #(argb,512,512,1)r2t(rendersurface,1.333)
Perlin Noise
#(format,width,height,mipmapsAmount)perlinNoise(xScale,yScale,min,max)
- xScale - horizontal noise scale (typically a multiple of 256)
- yScale - horizontal noise scale (typically a multiple of 256)
- min - minimum value
- max - minimum value
Examples:
#(ai,512,512,9)perlinNoise(256,256,0,1)
Irradiance
#(format,width,height,mipmapsAmount)irradiance(specularPower)
- specularPower - specular strenght
It is a values table that is used with per-pixel lighting. Modern shaders are not using this type of texture anymore.
Examples:
#(ai,32,128,1)irradiance(8)
Fresnel
see Super shader - Fresnel function
Example:
#(ai,64,64,1)Fresnel(1.3,7)
Fresnel Glass
#(format,width,height,mipmapsAmount)fresnelGlass()
Examples:
#(ai,64,64,1)fresnelGlass()
Water Irradiance
#(format,width,height,mipmapsAmount)waterIrradiance(specularPower)
- specularPower - specular strenght
This texture main value is solely with special pixel shaders for water.
Examples:
Tree Crown
#(format,width,height,mipmapsAmount)treeCrown(density)
and
#(format,width,height,mipmapsAmount)treeCrownAmb(density)
for ambient lighting.
- density - defines how much light passes thought tree-top via the longest line segment
This texture is used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture).
Parameter defines how much surrounding light passes into the defined point. It uses an exponential function of distance from circle boundary.
Examples:
#(ai,32,32,1)treeCrown(0.2) #(ai,32,32,1)treeCrownAmb(0.5)
Point
#(format,width,height,mimapsAmount)point()
Create a white dot on a transparent background.
Examples:
#(rgb,64,64,1)point()
Dither
#(format,width,height,mipmapsAmount)dither(min,max)
- min - minimum value
- max - minimum value
The format has to be ai
Examples:
#(ai,8,8,1)dither(0,150)