{"name":"Procedural Textures","title":"Procedural Textures","type":"topic","url":"https://community.bistudio.com/wiki/Procedural_Textures","revid":376105,"updated":"2025-08-21T12:47:31Z","aliases":["r2t"],"markdown":"Procedural textures are textures generated by the engine on the basis of their text description.\nThey can be used anywhere instead of normal textures.\nText description of procedural texture is set in standard place of texture path and filename.\nTo identify that a procedural texture is used, the character \"#\" is set at the beginning of the string.\nUsually the string consists of procedural texture type name and arguments on both sides enclosed in brackets, in format `#(leftArgs)TypeName(rightArgs)`.\n\nTextures may be generated procedurally and they take nearly no space on HDD but they still use space in video memory.\nYet, 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.\n\n> [!IMPORTANT]\n> - There cannot be any spaces or mathematical expressions within the string.\n> - Decimals always have to be preceded by a 0 (e.g. `0.5` instead of `.5`).\n> - Only double quotes `\"` are supported within the string, single quotes `'` are not:\n>\n>   ```sqf\n>   _object setObjectTexture [0, \"#something(\"\"text\"\")\"];    // OK\n>   _object setObjectTexture [0, '#something(\"text\")'];        // OK\n>   _object setObjectTexture [0, \"#something('text')\"];        // not OK\n>   ```\n\n### Procedural Texture Types\n\nNote that all texture types have in common the left-hand parameters list:\n\n- format - texture color format (can be `rgb`, `argb`, `ai`, `a`, `i`)\n- width - number of pixels in X, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc)\n- height - number of pixels in Y, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc)\n- mipmapsAmount - number of [mipmaps](https://en.wikipedia.org/wiki/Mipmap) to generate\n\n#### Color\n\n> [!NOTE]\n> Always produces 1x1 texture, regardless of width and height provided\n\n```\n#(format,width,height,mipmapsAmount)color(r,g,b,a)\n```\n\nand\n\n```\n#(format,width,height,mipmapsAmount)color(r,g,b,a,textureType)\n```\n\n- r, g, b, a - texture channels (Red, Green, Blue, Alpha)\n- textureType - texture type which match texture name ending without \"_\" (optional)\n\nExamples:\n\n```\n#(rgb,8,8,3)color(1,0,0,1)\n#(rgb,1,1,1)color(0.5,0.5,0.5,1)    // empty 1×1 detail map\n#(rgb,1,1,1)color(0.5,0.5,1,1)        // empty 1×1 normal map\n#(rgb,8,8,3)color(0.5,0.5,0.5,1,dt)\n#(rgb,8,8,3)color(0.5,0.5,1,1,no)\n```\n\n#### Render To Texture\n\n> [!IMPORTANT]\n> Render to Texture texture requires Picture-in-Picture (PiP) to be enabled in the Video options (see isPiPEnabled).\n\n```\n#(argb,512,512,1)r2t(surface,aspect)\n```\n\n- surface - The name that will later be used as reference in the camera script\n- aspect - Aspect ratio of the image\n\n> [!NOTE]\n> Do not use capital letters when naming RTT surfaces.\n\nExamples:\n\n```\n#(argb,512,512,1)r2t(rtt,1.0)\n#(argb,512,512,1)r2t(rendersurface,1.333)\n```\n\n> [!IMPORTANT]\n> Aspect parameter ignored as late as 2.14\n\n#### Perlin Noise\n\n```\n#(format,width,height,mipmapsAmount)perlinNoise(xScale,yScale,min,max)\n```\n\n- xScale - horizontal noise scale (typically a multiple of 256)\n- yScale - horizontal noise scale (typically a multiple of 256)\n- min - minimum value\n- max - minimum value\n\nExamples:\n\n```\n#(ai,512,512,9)perlinNoise(256,256,0,1)\n```\n\n#### Irradiance\n\n```\n#(format,width,height,mipmapsAmount)irradiance(specularPower)\n```\n\n- specularPower - specular strength\n\nIt is a values table that is used with per-pixel lighting. Modern shaders are not using this type of texture anymore.\n\nExamples:\n\n```\n#(ai,32,128,1)irradiance(8)\n```\n\n#### Fresnel\n\n```\n#(format,width,height,mipmapsAmount)Fresnel(N,K)\n```\n\n- N - refractive index\n- K - absorption coefficient\n\n> [!NOTE]\n> see Super shader - Fresnel function.\n\nExample:\n\n```\n#(ai,64,64,1)Fresnel(1.3,7)\n```\n\n#### Fresnel Glass\n\n```\n#(format,width,height,mipmapsAmount)fresnelGlass()\n```\n\nExamples:\n\n```\n#(ai,64,64,1)fresnelGlass()\n```\n\n#### Water Irradiance\n\n```\n#(format,width,height,mipmapsAmount)waterIrradiance(specularPower)\n```\n\n- specularPower - specular strength\n\nThis texture main value is solely with special pixel shaders for water.\n\nExamples:\n\n#### Tree Crown\n\n```\n#(format,width,height,mipmapsAmount)treeCrown(density)\n```\n\nand\n\n```\n#(format,width,height,mipmapsAmount)treeCrownAmb(density)\n```\n\nfor ambient lighting.\n\n- density - defines how much light passes thought tree-top via the longest line segment\n\nThis texture is used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture).\n\nParameter defines how much surrounding light passes into the defined point.\nIt uses an exponential function of distance from circle boundary.\n\nExamples:\n\n```\n#(ai,32,32,1)treeCrown(0.2)\n#(ai,32,32,1)treeCrownAmb(0.5)\n```\n\n#### Point\n\n```\n#(format,width,height,mimapsAmount)point()\n```\n\nCreate a white dot on a transparent background.\n\nExamples:\n\n```\n#(rgb,64,64,1)point()\n```\n\n#### Dither\n\n```\n#(format,width,height,mipmapsAmount)dither(min,max)\n```\n\n- min - minimum value\n- max - minimum value\n\nThe format **has** to be `ai`.\n\nExamples:\n\n```\n#(ai,8,8,1)dither(0,150)\n```\n\n#### Text (Arma 3 v2.12)\n\nCreates a text texture.\n\n```\n#(rgb,width,height,3)text(vAlign,hAlign,\"FontName\",fontSize,backgroundColor,textColor,\"text\")\n```\n\n- vAlign - from 0(top), 1(center), 2(bottom)\n- hAlign - from 0(left), 1(center), 2(right)\n- fontName - Available fonts\n- fontSize - number\n- backgroundColor - in format #RRGGBB or #RRGGBBAA\n- textColor - in format #RRGGBB or #RRGGBBAA\n- text - the text to display\n\nExamples:\n\n```\n#(rgb,512,512,3)text(0,0,\"Caveat\",0.3,\"#0000ff7f\",\"#ff0000\",\"Hallo\\nWelt\")\n```\n\nNote the importance of double quotation marks:\n\n```sqf\n// does not work:\ncursorobject setObjectTexture [\"Screen_1\", \"#(rgb,512,512,3)text(0,0,'Caveat',0.3,'#0000ff7f','#ff0000','Hallo\\nWelt')\"];\n\n// works:\ncursorobject setObjectTexture [\"Screen_1\", \"#(rgb,512,512,3)text(0,0,\"\"Caveat\"\",0.3,\"\"#0000ff7f\"\",\"\"#ff0000\"\",\"\"Hallo\\nWelt\"\")\"];\n```\n\n#### UI On Texture (Arma 3 v2.12)\n\nGenerates an UI Display and renders the result into a texture.\n\n```\n#(rgb,width,height,mipCount)ui(\"displayClassName\",\"uniqueName\",\"texType\")\n```\n\n- displayClassName - case-sensitive, classname from Description.ext (Mission Config File) or `config.cpp` (Mod Config)\n- uniqueName - a string to declare the display's unique name. Naming is the same as classnames (a-z, A-Z, 0-9, _)\n- texType - (Optional, default \"ca\"?) see Texture Map Types\n\nExamples:\n\n```\n#(rgb,1024,1024,1)ui(\"RscDisplayRenderTest\",\"abc\")\n#(rgb,1024,1024,1)ui(RscDisplayMain,abc)\n```\n\nRelated commands:\ndisplayUpdate, displayUniqueName\n\n#### UI On Texture Advanced (Arma 3 v2.14)\n\nSame as UI On Texture but has a different way of providing arguments and supports more advanced arguments.\nString values can be quoted in \" or '. If no whitespace is in the string, quotes are not required.\n\n```\n#(rgb,width,height,mipCount)uiEx(paramName1:value1,paramName2:value2,...)\n```\n\nCurrently supported parameters:\n\n- display: String - the case-sensitive display's class name, from Description.ext (Mission Config File) or `config.cpp` (Mod Config)\n- uniqueName: String - a string to declare the display's unique name. Naming is the same as classnames (a-z, A-Z, 0-9, _)\n- texType: String - (Optional, default \"ca\") see Texture Map Types\n- viewportX: Number - (Optional, default 0) horizontal offset for rendering viewport; can be used to only render specific section of the Display\n- viewportY: Number - (Optional, default 0) vertical offset\n- viewportW: Number - (Optional, default 1) width multiplier in percent\n- viewportH: Number - (Optional, default 1) height multiplier\n- bgColor: String - (Optional, default transparent `#00000000`) format `#RRGGBB` or `#RRGGBBAA`\n- mipFilter: String - (Optional, default point) either `point` or `linear`\n\nExamples:\n\n```\n#(rgb,2048,4096,1)uiEx(display:RscDisplayFieldManual,uniqueName:\"test name with space and quotes\")\n#(rgb,2048,4096,1)uiEx(display:RscDisplayFieldManual,uniqueName:testName,viewportX:-0.5,viewportW:2,bgColor:#ff000000)\n```\n\n#### Extension (Arma 3 v2.22)\n\nSee Extensions - Extension_Texture_Source.\nThe texture data is provided by an Extension.\n\n```\n#(rgb,width,height,mipCount)extension(\"extensionName\", \"uniqueName\", isAnimated, \"texType\")\n```\n\nCurrently supported parameters:\n\n- extensionName: String - The name of an extension, same as in callExtension\n- uniqueName: String - a string to declare the texture's unique name. It is passed to the extension to identify the specific texture\n- isAnimated: Number - (Optional, default 0) Set to 1 to have the texture be animated (refreshed every frame). For animated textures it is recommended to use only 1 mip.\n- texType: String - (Optional, default \"co\") see Texture Map Types\n\nExamples:\n\n```\n#(rgb,2048,2048,1)extension(\"GifImageExtension\", \"arma.gif\", 1)\n```","sections":[{"heading":null,"level":1,"markdown":"Procedural textures are textures generated by the engine on the basis of their text description.\nThey can be used anywhere instead of normal textures.\nText description of procedural texture is set in standard place of texture path and filename.\nTo identify that a procedural texture is used, the character \"#\" is set at the beginning of the string.\nUsually the string consists of procedural texture type name and arguments on both sides enclosed in brackets, in format `#(leftArgs)TypeName(rightArgs)`.\n\nTextures may be generated procedurally and they take nearly no space on HDD but they still use space in video memory.\nYet, 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.\n\n> [!IMPORTANT]\n> - There cannot be any spaces or mathematical expressions within the string.\n> - Decimals always have to be preceded by a 0 (e.g. `0.5` instead of `.5`).\n> - Only double quotes `\"` are supported within the string, single quotes `'` are not:\n>\n>   ```sqf\n>   _object setObjectTexture [0, \"#something(\"\"text\"\")\"];    // OK\n>   _object setObjectTexture [0, '#something(\"text\")'];        // OK\n>   _object setObjectTexture [0, \"#something('text')\"];        // not OK\n>   ```"},{"heading":"Procedural Texture Types","level":3,"markdown":"Note that all texture types have in common the left-hand parameters list:\n\n- format - texture color format (can be `rgb`, `argb`, `ai`, `a`, `i`)\n- width - number of pixels in X, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc)\n- height - number of pixels in Y, in power of two (e.g 1, 2, 4, 8, 16, 32, 64, 128 etc)\n- mipmapsAmount - number of [mipmaps](https://en.wikipedia.org/wiki/Mipmap) to generate"},{"heading":"Color","level":4,"markdown":"> [!NOTE]\n> Always produces 1x1 texture, regardless of width and height provided\n\n```\n#(format,width,height,mipmapsAmount)color(r,g,b,a)\n```\n\nand\n\n```\n#(format,width,height,mipmapsAmount)color(r,g,b,a,textureType)\n```\n\n- r, g, b, a - texture channels (Red, Green, Blue, Alpha)\n- textureType - texture type which match texture name ending without \"_\" (optional)\n\nExamples:\n\n```\n#(rgb,8,8,3)color(1,0,0,1)\n#(rgb,1,1,1)color(0.5,0.5,0.5,1)    // empty 1×1 detail map\n#(rgb,1,1,1)color(0.5,0.5,1,1)        // empty 1×1 normal map\n#(rgb,8,8,3)color(0.5,0.5,0.5,1,dt)\n#(rgb,8,8,3)color(0.5,0.5,1,1,no)\n```"},{"heading":"Render To Texture","level":4,"markdown":"> [!IMPORTANT]\n> Render to Texture texture requires Picture-in-Picture (PiP) to be enabled in the Video options (see isPiPEnabled).\n\n```\n#(argb,512,512,1)r2t(surface,aspect)\n```\n\n- surface - The name that will later be used as reference in the camera script\n- aspect - Aspect ratio of the image\n\n> [!NOTE]\n> Do not use capital letters when naming RTT surfaces.\n\nExamples:\n\n```\n#(argb,512,512,1)r2t(rtt,1.0)\n#(argb,512,512,1)r2t(rendersurface,1.333)\n```\n\n> [!IMPORTANT]\n> Aspect parameter ignored as late as 2.14"},{"heading":"Perlin Noise","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)perlinNoise(xScale,yScale,min,max)\n```\n\n- xScale - horizontal noise scale (typically a multiple of 256)\n- yScale - horizontal noise scale (typically a multiple of 256)\n- min - minimum value\n- max - minimum value\n\nExamples:\n\n```\n#(ai,512,512,9)perlinNoise(256,256,0,1)\n```"},{"heading":"Irradiance","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)irradiance(specularPower)\n```\n\n- specularPower - specular strength\n\nIt is a values table that is used with per-pixel lighting. Modern shaders are not using this type of texture anymore.\n\nExamples:\n\n```\n#(ai,32,128,1)irradiance(8)\n```"},{"heading":"Fresnel","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)Fresnel(N,K)\n```\n\n- N - refractive index\n- K - absorption coefficient\n\n> [!NOTE]\n> see Super shader - Fresnel function.\n\nExample:\n\n```\n#(ai,64,64,1)Fresnel(1.3,7)\n```"},{"heading":"Fresnel Glass","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)fresnelGlass()\n```\n\nExamples:\n\n```\n#(ai,64,64,1)fresnelGlass()\n```"},{"heading":"Water Irradiance","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)waterIrradiance(specularPower)\n```\n\n- specularPower - specular strength\n\nThis texture main value is solely with special pixel shaders for water.\n\nExamples:"},{"heading":"Tree Crown","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)treeCrown(density)\n```\n\nand\n\n```\n#(format,width,height,mipmapsAmount)treeCrownAmb(density)\n```\n\nfor ambient lighting.\n\n- density - defines how much light passes thought tree-top via the longest line segment\n\nThis texture is used only for diffuse lighting actually it just counts exponential function (v PS2 can be done easily w/o texture).\n\nParameter defines how much surrounding light passes into the defined point.\nIt uses an exponential function of distance from circle boundary.\n\nExamples:\n\n```\n#(ai,32,32,1)treeCrown(0.2)\n#(ai,32,32,1)treeCrownAmb(0.5)\n```"},{"heading":"Point","level":4,"markdown":"```\n#(format,width,height,mimapsAmount)point()\n```\n\nCreate a white dot on a transparent background.\n\nExamples:\n\n```\n#(rgb,64,64,1)point()\n```"},{"heading":"Dither","level":4,"markdown":"```\n#(format,width,height,mipmapsAmount)dither(min,max)\n```\n\n- min - minimum value\n- max - minimum value\n\nThe format **has** to be `ai`.\n\nExamples:\n\n```\n#(ai,8,8,1)dither(0,150)\n```"},{"heading":"Text (Arma 3 v2.12)","level":4,"markdown":"Creates a text texture.\n\n```\n#(rgb,width,height,3)text(vAlign,hAlign,\"FontName\",fontSize,backgroundColor,textColor,\"text\")\n```\n\n- vAlign - from 0(top), 1(center), 2(bottom)\n- hAlign - from 0(left), 1(center), 2(right)\n- fontName - Available fonts\n- fontSize - number\n- backgroundColor - in format #RRGGBB or #RRGGBBAA\n- textColor - in format #RRGGBB or #RRGGBBAA\n- text - the text to display\n\nExamples:\n\n```\n#(rgb,512,512,3)text(0,0,\"Caveat\",0.3,\"#0000ff7f\",\"#ff0000\",\"Hallo\\nWelt\")\n```\n\nNote the importance of double quotation marks:\n\n```sqf\n// does not work:\ncursorobject setObjectTexture [\"Screen_1\", \"#(rgb,512,512,3)text(0,0,'Caveat',0.3,'#0000ff7f','#ff0000','Hallo\\nWelt')\"];\n\n// works:\ncursorobject setObjectTexture [\"Screen_1\", \"#(rgb,512,512,3)text(0,0,\"\"Caveat\"\",0.3,\"\"#0000ff7f\"\",\"\"#ff0000\"\",\"\"Hallo\\nWelt\"\")\"];\n```"},{"heading":"UI On Texture (Arma 3 v2.12)","level":4,"markdown":"Generates an UI Display and renders the result into a texture.\n\n```\n#(rgb,width,height,mipCount)ui(\"displayClassName\",\"uniqueName\",\"texType\")\n```\n\n- displayClassName - case-sensitive, classname from Description.ext (Mission Config File) or `config.cpp` (Mod Config)\n- uniqueName - a string to declare the display's unique name. Naming is the same as classnames (a-z, A-Z, 0-9, _)\n- texType - (Optional, default \"ca\"?) see Texture Map Types\n\nExamples:\n\n```\n#(rgb,1024,1024,1)ui(\"RscDisplayRenderTest\",\"abc\")\n#(rgb,1024,1024,1)ui(RscDisplayMain,abc)\n```\n\nRelated commands:\ndisplayUpdate, displayUniqueName"},{"heading":"UI On Texture Advanced (Arma 3 v2.14)","level":4,"markdown":"Same as UI On Texture but has a different way of providing arguments and supports more advanced arguments.\nString values can be quoted in \" or '. If no whitespace is in the string, quotes are not required.\n\n```\n#(rgb,width,height,mipCount)uiEx(paramName1:value1,paramName2:value2,...)\n```\n\nCurrently supported parameters:\n\n- display: String - the case-sensitive display's class name, from Description.ext (Mission Config File) or `config.cpp` (Mod Config)\n- uniqueName: String - a string to declare the display's unique name. Naming is the same as classnames (a-z, A-Z, 0-9, _)\n- texType: String - (Optional, default \"ca\") see Texture Map Types\n- viewportX: Number - (Optional, default 0) horizontal offset for rendering viewport; can be used to only render specific section of the Display\n- viewportY: Number - (Optional, default 0) vertical offset\n- viewportW: Number - (Optional, default 1) width multiplier in percent\n- viewportH: Number - (Optional, default 1) height multiplier\n- bgColor: String - (Optional, default transparent `#00000000`) format `#RRGGBB` or `#RRGGBBAA`\n- mipFilter: String - (Optional, default point) either `point` or `linear`\n\nExamples:\n\n```\n#(rgb,2048,4096,1)uiEx(display:RscDisplayFieldManual,uniqueName:\"test name with space and quotes\")\n#(rgb,2048,4096,1)uiEx(display:RscDisplayFieldManual,uniqueName:testName,viewportX:-0.5,viewportW:2,bgColor:#ff000000)\n```"},{"heading":"Extension (Arma 3 v2.22)","level":4,"markdown":"See Extensions - Extension_Texture_Source.\nThe texture data is provided by an Extension.\n\n```\n#(rgb,width,height,mipCount)extension(\"extensionName\", \"uniqueName\", isAnimated, \"texType\")\n```\n\nCurrently supported parameters:\n\n- extensionName: String - The name of an extension, same as in callExtension\n- uniqueName: String - a string to declare the texture's unique name. It is passed to the extension to identify the specific texture\n- isAnimated: Number - (Optional, default 0) Set to 1 to have the texture be animated (refreshed every frame). For animated textures it is recommended to use only 1 mip.\n- texType: String - (Optional, default \"co\") see Texture Map Types\n\nExamples:\n\n```\n#(rgb,2048,2048,1)extension(\"GifImageExtension\", \"arma.gif\", 1)\n```"}],"categories":["ArmA: Armed Assault: Texturing","Arma 2: Editing","Arma 3: Editing","Operation Flashpoint: Editing","Take On Helicopters: Editing"],"groups":["Tools and File Formats"]}