Sims 3:Texture Layering

From SimsWiki
Revision as of 01:38, 27 July 2009 by JohanTSR (Talk | contribs)

Jump to: navigation, search

Work in progress...

Contents

Sims 3 Texture Layering

Overview

Textures in Sims 3 are very flexible beings, you can tell the game rendering engine exactly what steps it should take to create your final texture. This means it's not possible to give one universal description for how to generate a texture since it all depends on how the complate for a given item is constructed. This is true for both patterns and final "textures" seen on game items. In order to replicate the behavior of the game's rendering of textures you need to look at the complate and the preset, fortunately this is XML so it's pretty straightforward to interpret them. Some items (some hairs for example) use a binary format for this but the principle is the same.

Example files

Here comes an example preset and complate that will be used for illustrating the process of generating a final texture.

First the Preset:

 <preset>
 <complate name="CasRgbaMask" reskey="key:0333406C:00000000:E37696463F6B2D6E">
 <value key="assetRoot" value="X:" /> 
 <value key="daeFileName" value="amTopJacketSmoking" /> 
 <value key="age" value="A" /> 
 <value key="gender" value="M" /> 
 <value key="bodyType" value="Top" /> 
 <value key="partType" value="Body" /> 
 <value key="filename" value="CasRgbaMask" /> 
 <value key="Overlay" value="key:00B2D882:00000000:F9F07373B76D4042" /> 
 <value key="Mask" value="key:00B2D882:00000000:6A27D9DFE5206BCB" /> 
 <value key="Multiplier" value="key:00B2D882:00000000:F9F07373B76D4040" /> 
 <value key="Stencil A" value="key:00B2D882:00000000:75F8F21E0F143CAC" /> 
 <value key="Stencil B" value="key:00B2D882:00000000:75F8F21E0F143CAC" /> 
 <value key="Stencil C" value="key:00B2D882:00000000:75F8F21E0F143CAC" /> 
 <value key="Stencil D" value="key:00B2D882:00000000:75F8F21E0F143CAC" /> 
 <value key="Stencil E" value="key:00B2D882:00000000:75F8F21E0F143CAC" /> 
 <value key="Stencil F" value="key:00B2D882:00000000:75F8F21E0F143CAC" /> 
 <value key="Pattern A" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Pattern A Enabled" value="true" /> 
 <value key="Pattern A Linked" value="false" /> 
 <value key="Pattern A Tiling" value="4.0000,4.0000" /> 
 <value key="Pattern B" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Pattern B Enabled" value="true" /> 
 <value key="Pattern B Linked" value="false" /> 
 <value key="Pattern B Tiling" value="4.0000,4.0000" /> 
 <value key="Pattern C" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Pattern C Enabled" value="true" /> 
 <value key="Pattern C Linked" value="false" /> 
 <value key="Pattern C Tiling" value="4.0000,4.0000" /> 
 <value key="Pattern D" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Pattern D Enabled" value="true" /> 
 <value key="Pattern D Linked" value="false" /> 
 <value key="Pattern D Tiling" value="4.0000,4.0000" /> 
 <value key="Stencil A Tiling" value="1.0000,1.0000" /> 
 <value key="Stencil B Tiling" value="1.0000,1.0000" /> 
 <value key="Stencil C Tiling" value="1.0000,1.0000" /> 
 <value key="Stencil D Tiling" value="1.0000,1.0000" /> 
 <value key="Stencil E Tiling" value="1.0000,1.0000" /> 
 <value key="Stencil F Tiling" value="1.0000,1.0000" /> 
 <value key="Stencil A Rotation" value="0" /> 
 <value key="Stencil B Rotation" value="0" /> 
 <value key="Stencil C Rotation" value="0" /> 
 <value key="Stencil D Rotation" value="0" /> 
 <value key="Stencil E Rotation" value="0" /> 
 <value key="Stencil F Rotation" value="0" /> 
 <value key="Stencil A Enabled" value="False" /> 
 <value key="Stencil B Enabled" value="False" /> 
 <value key="Stencil C Enabled" value="False" /> 
 <value key="Stencil D Enabled" value="False" /> 
 <value key="Stencil E Enabled" value="False" /> 
 <value key="Stencil F Enabled" value="False" /> 
 <value key="IsNaked" value="False" /> 
 <value key="IsNotNaked" value="True" /> 
 <value key="Skin Specular" value="key:00B2D882:00000000:4DB46D1662895FDD" /> 
 <value key="Skin Ambient" value="key:00B2D882:00000000:4DB46D1662895FCF" /> 
 <value key="Clothing Specular" value="key:00B2D882:00000000:F9F07373B76D405E" /> 
 <value key="Clothing Ambient" value="key:00B2D882:00000000:90DE6DB90E35FEB7" /> 
 <value key="Rotation" value="0" /> 
 <value key="Logo UpperLeft" value="0.30000,0.17000" /> 
 <value key="Logo LowerRight" value="0.43000,0.30000" /> 
 <value key="Logo Enabled" value="false" /> 
 <value key="Logo" value="Logos\None" /> 
 <value key="Part Mask" value="key:00B2D882:00000000:B6E46F5107C8FC74" /> 
 <pattern name="solidColor_1" reskey="key:0333406C:00000000:71D5EFB6C391BC17" variable="Pattern A">
 <value key="assetRoot" value="X:" /> 
 <value key="filename" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Color" value="0.4455,0.1011,0.1011,1.0000" /> 
 </pattern>
 <pattern name="solidColor_1" reskey="key:0333406C:00000000:71D5EFB6C391BC17" variable="Pattern B">
 <value key="assetRoot" value="X:" /> 
 <value key="filename" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Color" value="0.1181,0.1188,0.1150,1.0000" /> 
 </pattern>
 <pattern name="solidColor_1" reskey="key:0333406C:00000000:71D5EFB6C391BC17" variable="Pattern C">
 <value key="assetRoot" value="X:" /> 
 <value key="filename" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Color" value="0.9794,1.0000,1.0000,1.0000" /> 
 </pattern>
 <pattern name="solidColor_1" reskey="key:0333406C:00000000:71D5EFB6C391BC17" variable="Pattern D">
 <value key="assetRoot" value="X:" /> 
 <value key="filename" value="Materials\Miscellaneous\solidColor_1" /> 
 <value key="Color" value="0.8317,0.4320,0.5977,1.0000" /> 
 </pattern>
 <pattern name="None" reskey="key:0333406C:00000000:BE63187EBBDBBC3B" variable="Logo">
 <value key="assetRoot" value="X:" /> 
 <value key="filename" value="Logos\None" /> 
 </pattern>
 <value key="MaskHeight" value="-1" cloneDefault="-1" /> 
 <value key="MaskWidth" value="-1" cloneDefault="-1" /> 
 </complate>
 </preset>

The Preset tells what complate to use and provides the values (colors, patterns and textures) to be used when generating the texture. Complate (referenced by the above Preset):

 <complate name="CasRgbaMask" typeConverter="Medator.ComplateConverter, Medator">
 <variables>
 <param type="texture" name="Overlay" hint="($daeFilePath)\($daeFileName)_o.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Mask" hint="($daeFilePath)\($daeFileName)_mask.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyMask.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="float" name="MaskHeight" hint="-1" default="-1" uiCategory="Textures" /> 
 <param type="float" name="MaskWidth" hint="-1" default="-1" uiCategory="Textures" /> 
 <param type="texture" name="Multiplier" hint="($daeFilePath)\($daeFileName)_m.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\neutralMultiplierZeroAlpha.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Stencil A" hint="($daeFilePath)\($daeFileName)_stA.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Stencil B" hint="($daeFilePath)\($daeFileName)_stB.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Stencil C" hint="($daeFilePath)\($daeFileName)_stC.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Stencil D" hint="($daeFilePath)\($daeFileName)_stD.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Stencil E" hint="($daeFilePath)\($daeFileName)_stE.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="texture" name="Stencil F" hint="($daeFilePath)\($daeFileName)_stF.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyOverlay.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" /> 
 <param type="pattern" name="Pattern A" enabled="Pattern A Enabled" linked="Pattern A Linked" default="Materials\Miscellaneous\solidColor_1" uiEditor="Medator.ClothPatternComplateEditor" uiCategory="Pattern A" /> 
 <param type="bool" name="Pattern A Enabled" default="true" uiCategory="Pattern A" /> 
 <param type="bool" name="Pattern A Linked" default="false" uiCategory="Pattern A" /> 
 <param type="vec2" name="Pattern A Tiling" default="4.0000,4.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Pattern A" /> 
 <param type="pattern" name="Pattern B" enabled="Pattern B Enabled" linked="Pattern B Linked" default="Materials\Miscellaneous\solidColor_1" uiEditor="Medator.ClothPatternComplateEditor" uiCategory="Pattern B" /> 
 <param type="bool" name="Pattern B Enabled" default="true" uiCategory="Pattern B" /> 
 <param type="bool" name="Pattern B Linked" default="false" uiCategory="Pattern B" /> 
 <param type="vec2" name="Pattern B Tiling" default="4.0000,4.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Pattern B" /> 
 <param type="pattern" name="Pattern C" enabled="Pattern C Enabled" linked="Pattern C Linked" default="Materials\Miscellaneous\solidColor_1" uiEditor="Medator.ClothPatternComplateEditor" uiCategory="Pattern C" /> 
 <param type="bool" name="Pattern C Enabled" default="true" uiCategory="Pattern C" /> 
 <param type="bool" name="Pattern C Linked" default="false" uiCategory="Pattern C" /> 
 <param type="vec2" name="Pattern C Tiling" default="4.0000,4.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Pattern C" /> 
 <param type="pattern" name="Pattern D" enabled="Pattern D Enabled" linked="Pattern D Linked" default="Materials\Miscellaneous\solidColor_1" uiEditor="Medator.ClothPatternComplateEditor" uiCategory="Pattern D" /> 
 <param type="bool" name="Pattern D Enabled" default="true" uiCategory="Pattern D" /> 
 <param type="bool" name="Pattern D Linked" default="false" uiCategory="Pattern D" /> 
 <param type="vec2" name="Pattern D Tiling" default="4.0000,4.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Pattern D" /> 
 <param type="vec2" name="Stencil A Tiling" default="1.0000,1.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Stencil A" /> 
 <param type="vec2" name="Stencil B Tiling" default="1.0000,1.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Stencil B" /> 
 <param type="vec2" name="Stencil C Tiling" default="1.0000,1.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Stencil C" /> 
 <param type="vec2" name="Stencil D Tiling" default="1.0000,1.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Stencil D" /> 
 <param type="vec2" name="Stencil E Tiling" default="1.0000,1.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Stencil E" /> 
 <param type="vec2" name="Stencil F Tiling" default="1.0000,1.0000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Stencil F" /> 
 <param type="float" name="Stencil A Rotation" uiCategory="Stencil A" default="0" /> 
 <param type="float" name="Stencil B Rotation" uiCategory="Stencil B" default="0" /> 
 <param type="float" name="Stencil C Rotation" uiCategory="Stencil C" default="0" /> 
 <param type="float" name="Stencil D Rotation" uiCategory="Stencil D" default="0" /> 
 <param type="float" name="Stencil E Rotation" uiCategory="Stencil E" default="0" /> 
 <param type="float" name="Stencil F Rotation" uiCategory="Stencil F" default="0" /> 
 <param type="bool" name="Stencil A Enabled" uiCategory="Stencil A" default="False" /> 
 <param type="bool" name="Stencil B Enabled" uiCategory="Stencil B" default="False" /> 
 <param type="bool" name="Stencil C Enabled" uiCategory="Stencil C" default="False" /> 
 <param type="bool" name="Stencil D Enabled" uiCategory="Stencil D" default="False" /> 
 <param type="bool" name="Stencil E Enabled" uiCategory="Stencil E" default="False" /> 
 <param type="bool" name="Stencil F Enabled" uiCategory="Stencil F" default="False" /> 
 <param type="bool" name="IsNaked" uiCategory="PartHighlighting" default="False" /> 
 <param type="bool" name="IsNotNaked" uiCategory="PartHighlighting" default="True" /> 
 <param type="texture" name="Skin Specular" hint="($assetRoot)\InGame\Sims\($partType)\($age)($gender)($partType)\($age)($gender)($partType)_s.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\defaultCompositor_s.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" uiDescription="Specular mask for the skin (($partType))." /> 
 <param type="texture" name="Skin Ambient" hint="($assetRoot)\InGame\Sims\($partType)\($age)($gender)($partType)\($age)($gender)($partType)_a.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\defaultCompositor_s.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" uiDescription="Ambient occlusion for the skin (($partType))." /> 
 <param type="texture" name="Clothing Specular" hint="($daeFilePath)\($daeFileName)_s.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\defaultCompositor_s.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" uiDescription="Specular mask for the clothing." /> 
 <param type="texture" name="Clothing Ambient" hint="($daeFilePath)\($daeFileName)_a.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\flatWhite.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" uiDescription="Ambient Occlusion mask for the clothing." /> 
 <param type="float" name="Rotation" uiCategory="Settings" default="0" /> 
 <param type="vec2" name="Logo UpperLeft" default="0.30000,0.17000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Logo" /> 
 <param type="vec2" name="Logo LowerRight" default="0.43000,0.30000" uiEditor="Medator.Vector2TypeEditor" uiCategory="Logo" /> 
 <param type="bool" name="Logo Enabled" default="false" uiCategory="Logo" /> 
 <param type="pattern" name="Logo" enabled="($Logo Enabled)" default="Logos\None" uiEditor="Medator.ClothPatternComplateEditor" uiCategory="Logo" /> 
 <param type="texture" name="Part Mask" hint="($assetRoot)\InGame\GlobalTextures\Sims\($age)($gender)($bodyType)Mask.tga" default="($assetRoot)\InGame\GlobalTextures\Sims\emptyMask.tga" uiEditor="Medator.ImageFileEditor, Medator" uiCategory="Textures" uiDescription="Global Mask for type (($partType))." /> 
 </variables>
 <texturePart part="($partType)" uniqueTextureSpace="false">
 <destination textureName="diffuse">
 <step type="SetTarget" renderTarget="RenderTarget_B" /> 
 <step type="ColorFill" color="1,1,1,1" /> 
 <step type="ChannelSelect" enabled="($Pattern A Enabled)" texture="($Mask)" select="1,0,0,0" colorWrite="Alpha" /> 
 <step type="DrawFabric" enabled="($Pattern A Enabled)" uiVisible="true" rotation="{0.0174532925 * ($Rotation)}" pattern="($daeFileName)Pattern A" sourceRect="0,0,($Pattern A Tiling)" enableBlending="true" srcBlend="DestAlpha" dstBlend="InvDestAlpha" colorWrite="Color" /> 
 <step type="ChannelSelect" enabled="($Pattern B Enabled)" texture="($Mask)" select="0,1,0,0" colorWrite="Alpha" /> 
 <step type="DrawFabric" enabled="($Pattern B Enabled)" uiVisible="true" rotation="{0.0174532925 * ($Rotation)}" pattern="($daeFileName)Pattern B" sourceRect="0,0,($Pattern B Tiling)" enableBlending="true" srcBlend="DestAlpha" dstBlend="InvDestAlpha" colorWrite="Color" /> 
 <step type="ChannelSelect" enabled="($Pattern C Enabled)" texture="($Mask)" select="0,0,1,0" colorWrite="Alpha" /> 
 <step type="DrawFabric" enabled="($Pattern C Enabled)" uiVisible="true" rotation="{0.0174532925 * ($Rotation)}" pattern="($daeFileName)Pattern C" sourceRect="0,0,($Pattern C Tiling)" enableBlending="true" srcBlend="DestAlpha" dstBlend="InvDestAlpha" colorWrite="Color" /> 
 <step type="ChannelSelect" enabled="($Pattern D Enabled)" texture="($Mask)" select="0,0,0,1" colorWrite="Alpha" /> 
 <step type="DrawFabric" enabled="($Pattern D Enabled)" uiVisible="true" rotation="{0.0174532925 * ($Rotation)}" pattern="($daeFileName)Pattern D" sourceRect="0,0,($Pattern D Tiling)" enableBlending="true" srcBlend="DestAlpha" dstBlend="InvDestAlpha" colorWrite="Color" /> 
 <step type="DrawImage" texture="($Overlay)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" /> 
 <step type="DrawImage" texture="($Multiplier)" colorWrite="Alpha" /> 
 <step type="DrawImage" texture="($Overlay)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="One" colorWrite="Alpha" /> 
 <step type="DrawFabric" enabled="($Logo Enabled)" uiVisible="true" rotation="0" pattern="($daeFileName)Logo" destRect="($Logo UpperLeft),($Logo LowerRight)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" /> 
 <step type="DrawImage" texture="($Multiplier)" enableBlending="true" srcBlend="DestColor" dstBlend="SrcColor" colorWrite="Color" /> 
 <step type="DrawImage" texture="($Stencil A)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" enabled="($Stencil A Enabled)" rotation="{0.0174532925 * ($Stencil A Rotation)}" sourceRect="0,0,($Stencil A Tiling)" /> 
 <step type="DrawImage" texture="($Stencil B)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" enabled="($Stencil B Enabled)" rotation="{0.0174532925 * ($Stencil B Rotation)}" sourceRect="0,0,($Stencil B Tiling)" /> 
 <step type="DrawImage" texture="($Stencil C)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" enabled="($Stencil C Enabled)" rotation="{0.0174532925 * ($Stencil C Rotation)}" sourceRect="0,0,($Stencil C Tiling)" /> 
 <step type="DrawImage" texture="($Stencil D)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" enabled="($Stencil D Enabled)" rotation="{0.0174532925 * ($Stencil D Rotation)}" sourceRect="0,0,($Stencil D Tiling)" /> 
 <step type="DrawImage" texture="($Stencil E)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" enabled="($Stencil E Enabled)" rotation="{0.0174532925 * ($Stencil E Rotation)}" sourceRect="0,0,($Stencil E Tiling)" /> 
 <step type="DrawImage" texture="($Stencil F)" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" colorWrite="Color" enabled="($Stencil F Enabled)" rotation="{0.0174532925 * ($Stencil F Rotation)}" sourceRect="0,0,($Stencil F Tiling)" /> 
 <step type="SetTarget" renderTarget="RenderTarget_A" /> 
 <step type="DrawImage" texture="RenderTexture_B" enableFiltering="false" enableBlending="true" srcBlend="SrcAlpha" dstBlend="InvSrcAlpha" /> 
 </destination>
 <destination textureName="specular">
 <step type="SetTarget" renderTarget="RenderTarget_B" /> 
 <step type="ColorFill" color="0,0,0,1" /> 
 <step type="DrawImage" texture="($Multiplier)" colorWrite="Alpha" /> 
 <step type="ChannelSelect" texture="($Skin Specular)" select="1,0,0,0" colorWrite="Blue" /> 
 <step type="ChannelSelect" texture="($Clothing Specular)" select="1,0,0,0" colorWrite="Blue" enableBlending="true" srcBlend="DestAlpha" dstBlend="InvDestAlpha" /> 
 <step type="ChannelSelect" texture="($Skin Ambient)" select="1,0,0,0" colorWrite="Red" /> 
 <step type="ChannelSelect" texture="($Clothing Ambient)" select="1,0,0,0" colorWrite="Red" enableBlending="true" srcBlend="DestAlpha" dstBlend="InvDestAlpha" /> 
 " 
 <step type="ChannelSelect" texture="($Clothing Specular)" select="1,0,0,0" colorWrite="Alpha" /> 
 <step type="SetTarget" renderTarget="RenderTarget_A" /> 
 <step type="DrawImage" texture="RenderTexture_B" enableFiltering="false" maskBias="-0.5" maskSelect="0,0,0,1" mask="($Multiplier)" /> 
 <step type="ChannelSelect" texture="RenderTexture_B" select="1,0,0,0" enableFiltering="false" maskBias="-0.5" maskSelect="0,0,0,1" mask="($Multiplier)" colorWrite="Alpha" /> 
 <step type="ChannelSelect" texture="RenderTexture_B" select="0,0,1,0" enableFiltering="false" maskBias="-0.5" maskSelect="0,0,0,1" mask="($Multiplier)" colorWrite="Green" /> 
 <step type="CASPickData" enabled="($IsNotNaked)" enableFiltering="false" maskBias="-0.5" maskSelect="0,0,0,1" texture="($Mask)" mask="($Multiplier)" colorWrite="All" /> 
 <step type="CASPickData" enabled="($IsNaked)" enableFiltering="false" maskBias="-0.5" maskSelect="0,0,0,1" mask="($Part Mask)" colorWrite="Red" /> 
 </destination>
 </texturePart>
 </complate>

The complate defines the variables (the values used by the presets that use it) and the rendering steps used to create a final texture, found in the texturePart node. Add to that the patterns defined in the Preset, they contain references to their own complates and can be thought of as internal presets within this preset.

In this example complate the texturePart node contains two targets which means it will generate two textures, one diffuse and one specular, the steps are somewhat differnt between them but the principle is the same, we'll look at the diffuse texture in this example. We will go through each step and go through what it does but first we need to look at the rendering steps that can be used.

Render Parts

Italic means optional field, bold indicates default value if parameter is missing

SetTarget

Parameters:
renderTarget [RenderTarget_A|RenderTarget_B]
Description:
Tells you what surface it should render to, there can be two render targets, set the renderer to the one specified. Both render targets should be 1024x1024.


ChannelSelect

Parameters:
texture [Reference to a DDS]
select [R,G,B,A] one value is 1 the rest are 0
enabled [true|false]
colorWrite [alpha|red|green|blue|color]
enableBlending [true|false]
srcBlend [srcalpha|invsrcalpha|one|srccolor|zero]
dstBlend [destalpha|invdestalpha|one|destcolor|zero]
(todo: mask attribute)
Description:
ChannelSelect masks out an area of the render target where following render steps should be applied.
The texture parameter specifies the source texture to be used for masking
Select tells you what color channel to use in the source texture.
First apply source and dest blending (source color is read from the source texture, dest color comes from the current render target) if blending is enabled.
Then fill each pixels color component specified by the colorWrite attribute on the render target with the color component of the source texture specified by the select attribute.


ColorFill

Parameters:
color [R,G,B,A] each value is a float between 0 and 1
enabled [true|false]
colorWrite [alpha|red|green|blue|color]
enableBlending [true|false]
srcBlend [srcalpha|invsrcalpha|one|srccolor|zero]
dstBlend [destalpha|invdestalpha|one|destcolor|zero]
Description:
Fill every pixels color component specified by the colorWrite attribute (all of them if it's set to color) of the active region with the color specified, if blending is ::enabled perform the specified src and dest blending operations.

Example walkthrough

 <step type="SetTarget" renderTarget="RenderTarget_B" />

Set up the specified render target

 <step type="ColorFill" color="1,1,1,1" /> 

Fills the currenttly selected region with the specified color, in this case the entire render target is filled with white.

 <step type="ChannelSelect" enabled="($Pattern A Enabled)" texture="($Mask)" select="1,0,0,0" colorWrite="Alpha" /> 

Fills the alpha channel of the render target with the red channel values of the mask texture


To be continued

--JohanTSR 17:36, 26 July 2009 (CDT)

Personal tools
Namespaces

Variants
Actions
Navigation
game select
Toolbox