S&box Wiki

Revision Difference

using_custom_sprites#529767

<cat>Dev.Particles</cat> <title>Using custom sprites</title> <warning>This was created using the Half-Life Alyx Workshop Tools, so the pathing for your `.tga` or `.png` file might be different, I can not test this currently.</warning>⤶ <validate>This was created using the Half-Life Alyx Workshop Tools, so the pathing for your `.tga`, `.png` or `.mks` file might be different, I can not test this currently.</validate>⤶ ## Prerequisites All you need before we get started is your sprite in `.tga` or `.png` form, placed somewhere inside your addon folder. All you need before we get started is your image file in `.tga`, `.png` or [.mks](https://developer.valvesoftware.com/wiki/Animated_Particles) format, placed somewhere inside your addon folder. ## 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 `.tga` or `.png` file. 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: <upload src="3dc48/8d90821b106c7ec.png" size="373455" name="image.png" />