S&box Wiki

Using custom sprites

Using custom sprites


All you need before we get started is your image file in .tga, .png or .mks format, placed somewhere inside your addon folder.

Both the width and height of your image file should be in the power of 2, otherwise the sprite won't render.

Creating the VTEX file

The Particle Editor currently only renders sprites which are in .vtex format.
To create your own .vtex sprite, copy the following code snippet into your favorite text editor, and change the materials/snowflake.tga value to point to your image file.

<!-- dmx encoding keyvalues2_noids 1 format vtex 1 --> "CDmeVtex" { "m_inputTextureArray" "element_array" [ "CDmeInputTexture" { "m_name" "string" "0" "m_fileName" "string" "materials/snowflake.tga" "m_colorSpace" "string" "srgb" "m_typeString" "string" "2D" } ] "m_outputTypeString" "string" "2D" "m_outputFormat" "string" "DXT5" "m_textureOutputChannelArray" "element_array" [ "CDmeTextureOutputChannel" { "m_inputTextureArray" "string_array" [ "0" ] "m_srcChannels" "string" "rgba" "m_dstChannels" "string" "rgba" "m_mipAlgorithm" "CDmeImageProcessor" { "m_algorithm" "string" "" "m_stringArg" "string" "" "m_vFloat4Arg" "vector4" "0 0 0 0" } "m_outputColorSpace" "string" "srgb" } ] }

Once you've changed the property, save it was a .vtex file.

Selecting your sprite

The Render sprites renderer has a property called texture, not to be confused with normal texture. Click the spyglass next to texture and select your sprite. You should now be able to see your custom sprite as pictured below:


Special Pages



Render Time: 79ms

DB GetPage 16
Generate Html 1
SaveChanges (1) 60
Render Body 0
Render Sidebar 0