Textures
Textures are assets that contain an image made of pixel-data. They are mainly used in materials to cover surfaces.
For example, a texture can contain color information or material roughness variation so using it in a material shader adds more realism.
Textures can also be used outside of materials. For instance in the UI or via direct CPU calculations. For more information about C# scripting see the Texture class page in the C# API documentation.
Supported file types
Flax Engine supports importing the following list of file types as textures:
.png
.jpg
.jpeg
.bmp
.gif
.tga
.tif
.tiff
.dds
.hdr
.raw
.exr
Note
Flax imports only the first frame of animated image files, such as animated gifs or PNGs. They don't animate in Flax; they appear as static images.
Note
For documentation related to cube textures check out this page.
Note
Files of type .RAW
are assumed to contain 16-bit grayscale raw unsigned normalized values in little-endian byte order (it must be a square, width equals height). You can use them to import heightmaps for your terrain to minimize quality loss during generating terrain from asset exported by an external tool (choose suggested HdrRGBA
format with no compression
).
Importing a texture
The easiest way to import one or more textures is to drag them from a file Explorer window (Finder on MacOS) to the Content window.
Alternatively, you can use the Import button in a Content window toolbar and then select the files to import.
After choosing the files the Import file settings dialog is shown. It's used to specify import options per texture. In most cases the default values are fine and you can just press the Import button.
Note
- Flax automatically detects the imported texture type based on its name. For instance: Chair_Normal.png will be detected as a normal map and Chair_AO.png will be detected as a grayscale texture (as it contains single channel ambient occlusion data).
- Using the Import file settings dialog you can select more than one texture at once (or use Ctrl+A to select all) and specify import options at once.
Every texture can be re-imported (the relative path to the source file is cached) and the import settings modified using the Texture Window.
For more information about texture import settings read the dedicated documentation page Textures Import Settings.
Using textures
To use your texture asset in a material simply drag and drop it into the material surface graph and use a Texture node for sampling it.
To learn more about materials and using textures for rendering go to the Materials Basics page.
Procedural textures
Flax API exposes several methods that enable you to create and use procedural textures from your code. To learn how to use these features see the related tutorial here: How to create a procedural texture.
Texture Groups
Flax supports grouping textures inside Streaming settings for easier texture streaming configuration and quality options. See the dedicated documentation page to learn more about Texture Groups.