SInput.m_vNormal.b = 1.0 - sInput.m_vNormal.b // flipped green from the Modeler SOutput.m_vTexture0 = float4(LinearTosRgb(sInput.m_vColor), sInput.m_fOpacity) Void TexturePacking(STexturePackingInput sInput, inout STexturePackingOutput sOutput) Additionally, all processing in the Modeler is done in linear color space, so we must convert the color to sRGB color space before saving by using the LinearTosRgb utility function. The green channel of the normal map is flipped before saving. The shader itself should be saved into a file called “Example.fx” to match the filename declared in the XML file. It describes the two textures that will be written, and also points to the shader to be used to fill them up. The XML file that describes this texture packer should be saved into a file called “Example.xml” in the /texture_packing directory. Our game requires normal maps with green flipped the other way from the SpeedTree Modeler (which is a common change to make). In this example texture packer, we will write color and opacity into one texture, and normal and gloss into another.
#TEXTUREPACKER KEY GENERATOR FULL#
rgba, you will get a full 4 channel texture on disk. r, you will get a grayscale/luminance texture. The packing process tries to be as smart as possible when writing out the textures. The output structure simply contains all of the possible RGBA outputs (up to 16). The input consists of all of the maps from the material, already with texture/color adjustments applied, along with a few extra pieces of information and utilities (like noise). However, for texture packing you will implement a TexturePacking() function whose input and output is a little different. The shader file is similar to a render mode shader, where you are writing a single function called by a bigger shader. Omitting a Texture tag will also skip it. These are flags to help the generation of mips be better for texture formats that store mips (DDS).
MipGenerationFlag - Can be “None” (or missing), “AlphaIsOpacity”, or “RgbIsNormal”. “FullTexture” - Always write a full-resolution texture. This option is the same as the global “ForceTextures” parameter.
If the data does not change, it will write a tiny texture. “Color” - Force this texture to write as a color in the mesh or material file rather than a texture. “Auto” - The default value, the texture is examined to see if it changes. Type - The type of data to write to disk or in the mesh/material file, depending on format: Suffix - suffix added to the filename for this texture