Procedural Textures: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - ";[ ]+ " to "; ")
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{enHeader}}
{{TOC|side}}
== What are procedural textures ==


===What are procedural textures===
Procedural textures are textures generated by our engine on the basis of their text description.
 
Procedural textures are textures generated by our engine on the basis of theirs text description.
They can be used anywhere instead of normal textures.
They can be used anywhere instead of normal textures.
Text description of procedural texture is set in standard place of texture path and filename.
Text description of procedural texture is set in standard place of texture path and filename.
Line 11: Line 10:


Textures may be generated procedurally and they take nearly no space on HDD but they still use space in video-memory.
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 procedural texture with same name then it's taken as only one texture and uses memory space only once.
Yet if two materials use procedural texture with same name then it is taken as only one texture and uses memory space only once.
Thus it's needed to avoid creating unnecessarily nearly same textures.
Thus it is needed to avoid creating unnecessarily nearly same textures.




===Types of procedural textures===
== Types of procedural textures ==


====color====
=== color ===


  #(format,width,height,number of mipmaps)color(r,g,b,a,texture type)
  #(format,width,height,number of mipmaps)color(r,g,b,a,texture type)


*format - texture color format (RGB nebo ARGB)
* format - texture color format (RGB nebo ARGB)
*width - number of pixels in X
* width - number of pixels in X
*height - number of pixels in Y
* height - number of pixels in Y
*number of mipmaps - number of mipmaps
* number of mipmaps - number of mipmaps
*r, g, b, a - texture channels
* r, g, b, a - texture channels (Red, Green, Blue, Alpha). Decimals have to be preceded by a 0 (e.g. 0.5 instead of .5).
*texture type - [[Texture Naming Conventions|texture type]] which match texture name ending without "_"
* texture type - [[Texture Naming Conventions|texture type]] which match texture name ending without "_" (optional)
 


Examples:
Examples:
#(rgb,8,8,3)color(1,0,0,1)
  #(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)


====perlinNoise====
=== 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)
 
{{Feature | Informative | Avoid using capital letters when naming rtt surfaces.}}
 
=== perlinNoise ===


  #(format,width,height,number of mipmaps)perlinNoise(xScale,yScale,min,max)
  #(format,width,height,number of mipmaps)perlinNoise(xScale,yScale,min,max)
Line 46: Line 59:
  #(ai,512,512,9)perlinNoise(256,256,0,1)
  #(ai,512,512,9)perlinNoise(256,256,0,1)


====irradiance====
=== irradiance ===


  #(format,width,height,number of mipmaps)irradiance(specular power)
  #(format,width,height,number of mipmaps)irradiance(specular power)
   
   
*format - texture color format (RGB nebo ARGB)
* format - texture color format (RGB nebo ARGB)
*width - number of pixels in X
* width - number of pixels in X
*height - number of pixels in Y
* height - number of pixels in Y
*number of mipmaps - number of mipmaps
* number of mipmaps - number of mipmaps
*specular power - specular strenght
* specular power - specular strenght


It's values table which is used with per-pixel lighting. Modern shaders aren't using this type of texture anymore.
It's values table which is used with per-pixel lighting. Modern shaders are not using this type of texture anymore.


Examples:
Examples:
Line 62: Line 75:
  #(ai,32,128,1)irradiance(8)
  #(ai,32,128,1)irradiance(8)


====Fresnel====
=== Fresnel ===
see [[Super_shader#6._Fresnel_function]]
 
see [[Super shader#6._Fresnel function|Super shader - Fresnel function]]
 
Example:
 
  #(ai,64,64,1)Fresnel(1.3,7)
  #(ai,64,64,1)Fresnel(1.3,7)


====fresnelGlass====
=== fresnelGlass ===


  #(format,width,height,number of mipmaps)fresnelGlass()
  #(format,width,height,number of mipmaps)fresnelGlass()
   
   
*format - texture color format (RGB nebo ARGB)
* format - texture color format (RGB nebo ARGB)
*width - number of pixels in X
* width - number of pixels in X
*height - number of pixels in Y
* height - number of pixels in Y
*number of mipmaps - number of mipmaps
* number of mipmaps - number of mipmaps


Examples:
Examples:
Line 79: Line 96:
  #(ai,64,64,1)fresnelGlass()
  #(ai,64,64,1)fresnelGlass()


====waterIrradiance====
=== waterIrradiance ===


  #(format,width,height,number of mipmaps)waterIrradiance(specular power)
  #(format,width,height,number of mipmaps)waterIrradiance(specular power)


*format - texture color format (RGB nebo ARGB)
* format - texture color format (RGB nebo ARGB)
*width - number of pixels in X
* width - number of pixels in X
*height - number of pixels in Y
* height - number of pixels in Y
*number of mipmaps - number of mipmaps
* number of mipmaps - number of mipmaps
*specular power - specular strenght
* specular power - specular strenght


Possible future expansion : As addition to specular exponen there might be refractive index.
Possible future expansion : As addition to specular exponen there might be refractive index.
Line 93: Line 110:
This texture main value is solely with special pixel shaders for water.
This texture main value is solely with special pixel shaders for water.


====treeCrown====
=== treeCrown ===


  #(format,width,height,number of mipmaps)treeCrown(density)
  #(format,width,height,number of mipmaps)treeCrown(density)


*format - texture color format (RGB nebo ARGB)
* format - texture color format (RGB nebo ARGB)
*width - number of pixels in X
* width - number of pixels in X
*height - number of pixels in Y
* height - number of pixels in Y
*number of mipmaps - number of mipmaps
* number of mipmaps - number of mipmaps
*specular power - specular strenght
* specular power - specular strenght
*density - defines how much light pass thought tree-top via longest line segment  
* density - defines how much light pass thought tree-top via longest line segment  


It's used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture)
It's used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture)


For ambient lighting is used another type of textures: texture="#(ai,32,32,1)treeCrownAmb(0.5)";  
For ambient lighting is used another type of textures: texture="#(ai,32,32,1)treeCrownAmb(0.5)";
Parameter defines how much surrounding light pass into defined point.
Parameter defines how much surrounding light pass into defined point.
Textura is exponential function of distance from circle boundary.
Textura is exponential function of distance from circle boundary.
Line 114: Line 131:
  #(ai,32,32,1)treeCrown(0.2)
  #(ai,32,32,1)treeCrown(0.2)


=== Others ===


===Others===
Engine supports also simple procedural textures, you can just write instead of filename
Engine supports also simple procedural textures, you can just write instead of filename


  #(format,width,height,number of mipmaps)color(r,g,b,a)
  #(format,width,height,number of mipmaps)color(r,g,b,a)


 
==== Empty detail map ====
====Empty detail map====
 
  #(rgb,1,1,1)color(0.5,0.5,0.5,1)
  #(rgb,1,1,1)color(0.5,0.5,0.5,1)


====Empty normal map====
==== Empty normal map ====
  #(rgb,1,1,1)color(0.5,0.5,1,1)
  #(rgb,1,1,1)color(0.5,0.5,1,1)


[[Category:ArmA: Texturing]]
 
[[Category:ArmA 2: Editing]]
{{GameCategory|arma1|Texturing}}
{{GameCategory|arma2|Editing}}
{{GameCategory|arma3|Editing}}

Revision as of 01:53, 8 August 2021

What are procedural textures

Procedural textures are textures generated by our 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 procedural texture is used character "#" on beginning of string. Usually string consists of procedural texture type name and arguments on sides enclosed in brackets: #(A)TypeName(B). There can't be any spaces or mathematical expressions within name.

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 procedural texture with same name then it is taken as only one texture and uses memory space only once. Thus it is needed to avoid creating unnecessarily nearly same textures.


Types of procedural textures

color

#(format,width,height,number of mipmaps)color(r,g,b,a,texture type)
  • format - texture color format (RGB nebo ARGB)
  • width - number of pixels in X
  • height - number of pixels in Y
  • number of mipmaps - number of mipmaps
  • r, g, b, a - texture channels (Red, Green, Blue, Alpha). Decimals have to be preceded by a 0 (e.g. 0.5 instead of .5).
  • texture type - texture type which match texture name ending without "_" (optional)

Examples:

#(rgb,8,8,3)color(1,0,0,1)
#(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)
Avoid using capital letters when naming rtt surfaces.

perlinNoise

#(format,width,height,number of mipmaps)perlinNoise(xScale,yScale,min,max)
  • xScale - horizontal noise scale (typically a multiply of 256)
  • yScale - horizontal noise scale (typically a multiply of 256)
  • min - minimum value
  • max - minimum value

Examples:

#(ai,512,512,9)perlinNoise(256,256,0,1)

irradiance

#(format,width,height,number of mipmaps)irradiance(specular power)

  • format - texture color format (RGB nebo ARGB)
  • width - number of pixels in X
  • height - number of pixels in Y
  • number of mipmaps - number of mipmaps
  • specular power - specular strenght

It's values table which 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)

fresnelGlass

#(format,width,height,number of mipmaps)fresnelGlass()

  • format - texture color format (RGB nebo ARGB)
  • width - number of pixels in X
  • height - number of pixels in Y
  • number of mipmaps - number of mipmaps

Examples:

#(ai,64,64,1)fresnelGlass()

waterIrradiance

#(format,width,height,number of mipmaps)waterIrradiance(specular power)
  • format - texture color format (RGB nebo ARGB)
  • width - number of pixels in X
  • height - number of pixels in Y
  • number of mipmaps - number of mipmaps
  • specular power - specular strenght

Possible future expansion : As addition to specular exponen there might be refractive index.

This texture main value is solely with special pixel shaders for water.

treeCrown

#(format,width,height,number of mipmaps)treeCrown(density)
  • format - texture color format (RGB nebo ARGB)
  • width - number of pixels in X
  • height - number of pixels in Y
  • number of mipmaps - number of mipmaps
  • specular power - specular strenght
  • density - defines how much light pass thought tree-top via longest line segment

It's used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture)

For ambient lighting is used another type of textures: texture="#(ai,32,32,1)treeCrownAmb(0.5)"; Parameter defines how much surrounding light pass into defined point. Textura is exponential function of distance from circle boundary.

Examples:

#(ai,32,32,1)treeCrown(0.2)

Others

Engine supports also simple procedural textures, you can just write instead of filename

#(format,width,height,number of mipmaps)color(r,g,b,a)

Empty detail map

#(rgb,1,1,1)color(0.5,0.5,0.5,1)

Empty normal map

#(rgb,1,1,1)color(0.5,0.5,1,1)