Choosing Shaders from 3DS MAX.
Different shaders should have unique names. To specify shader name from MAX you should use 's_' prefix for material name. For example - shader 's_HeroHand1'. Shader name isn't case sensitive. As usual shader template choosing automatically and depends on material properties. For example if we specify only diffuse and bump textures -automatically selected TemplBumpDiffuse_NOCM template. If we specify additionally specular hightlights TemplBumpSpec_NOCM will be selected. But some time we need possibility to specify template manually. For example we cannot use template TemplBumpDiffuse_NOCM for big non-tesselated polygons (indoor areas). In this case we can specify template name in round brackets. For example: 's_HeroHand1(TemplBumpDiffuse)'.
Light sources from 3DS MAX.
Engine supports Point light sources without attenuation, Point light sources with attenuation and Projected light sources without attenuation.
NOTE For outdoor shaders (Plants, Terrain, Entities .) projected lights use vertex attenuation.
All light sources should have substring "_ls" in name.
All heat sources should have substring "_hs" in name.
For example: light with name is $1_ls_blabla is light source
light with name is $1_hs_blabla is heat source
light with name is $1_ls_hs_blabla is light source and heat source simultaneously.
Animated textures from 3DS MAX.
Each texture you specify in MAX can be animated. For animated textures used follow format:
prefix ns_nesuffix time), where
prefix - start of the texture name,
## - means digits of animated sequence (two characters # mean two digits of animated sequence),
ns_ne - this is just first and last numbers of animated sequence respectively.
suffix - optional end of texture name.
Time - optional time of single frame in seconds (default value is 0.05 seconds = 50 ms).
For example, texture animated format Explode##00_12Bar(0.01)
Means it will be used textures with names: Explode00Bar, Explode01Bar, Explode02Bar,., Explode12Bar Animated with speed 10 ms per frame).
Also it's possible to use such format: sta00##. In this case engine will try to load all textures from name sta0000 until last texture file available.
Procedural textures from 3DS MAX.
In MAX you can specify name of procedure as ambient color texture J. All procedures applied only on diffuse texture. Important note: Size of procedure should be not more than 256x256 and should be the same as size of diffuse texture. Otherwise engine will ignore procedure and put warning to the console. All procedures descriptions is in folder Shaders/Scripts/CryShaders/Procedures.
Detail textures from 3DS MAX.
In MAX you can specify detail texture as filter color map. For detail textures you can set U and V tiling separately. In the engine detail textures use per-pixel blending (depend on the distance) and multi-layering technology. Yo can change desired distance using console variable "r_DetailDistance" (default distance is 4). Number of layers you can easily change using variable "r_DetailNumLayers". There is some optimization in renderer that don't allow to draw detail layers on far objects. Detail layers can be use in indoor environments.
Transparency and alpha-test.
With new MAX material plugin (Crytek Shader) it's possible to change material global transparency by specifying opacity value. 100% means non-transparent at all (full opaque). 0% means full transparent (invisible). By default engine use alpha-blending for transparency. But you can use Additive Blending instead by setting corresponding check box. Alpha-test is optimized version of alpha-blending. If Alpha-test value isn't zero render device reject pixels that less then this value. Big difference between alpha-testing and alpha-blending is alpha-test allow writing to Z-buffer and as result alpha-tested polygons allow receiving of stencil shadows and work well using multi-pass rendering (multiple light sources for example).
IMPORTANT NOTES: Alpha blended polygons don't support multiple passes. For example it will not work with multiple light sources wit per-pixel lighting. Renderer automatically truncate number of light sources to 1 if multiple light sources affect alpha-blended polygon. Alpha-blended polygons cannot receive stencil shadows.
Decals.
With new MAX material plugin (Crytek Shader) there is possibility to specify overlay decal texture for the material. For decal texture you can specify tiling, offset and rotating in texture map properties.
Generating of Cube Maps.
All refraction/reflec 434t1913e tion shaders require CubeMaps to work properly. Generally we have two types of refract/reflect shaders with cubemaps.
As you can see for static objects is much better to use custom cube-maps instead of realtime ones. To prepare custom cube-map you need to apply to the object real-time shader (like "TemplGlassEnvCM"), then run the game or the editor (but not the previewer), and using console command r_EnvCMWrite=1 you can save cube-map on the disk (it will be 6 textures in MasterCD root directory with names: Cube_negx.jpg, Cube_posx.jpg, Cube_negy.jpg, Cube_posy.jpg,
Cube_negz.jpg, Cube_posz.jpg. After this you can preprocess this images (reduce size, convert to another format, .), rename it and then you have to change the shader for the object in MAX to use custom cube-map (like "TemplGlassCM"), and specify generated cube-map in refraction/reflection map slot in MAX materials properties.
General Bump mapping |
||||||||
Shader templates |
Direct3D |
OpenGL |
XBox |
Game-Cube |
||||
GF2 |
GF3 |
Radeon |
GF2 |
GF3 |
Radeon |
|||
TemplBumpDiffuse_NOCM diffuse bump-map for high-poly models (supports transparency and Bump amount) (GF2, GF3) EFT_BUMP_MODEL From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. No specular lights
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_Glow diffuse bump-map for high-poly model with glow 2D texture (add operation) (shader supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Opacity 2D texture (as glow texture)
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_Env2dAdd diffuse bump-map for high-poly model with environment 2D texture (add operation) (shader supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflection 2D texture
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_Env2dAddSig diffuse bump-map for high-poly model with environment 2D texture (add-signed operation) (supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflection 2D texture
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_Env2dMod diffuse bump-map for high-poly model with environment 2D texture (modulate operation) (shader supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflection 2D texture
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_CMAdd diffuse bump-map for high-poly model with environment cube-map texture (add operation) (shader supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflection cube-map texture
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_CMAddSig diffuse bump-map for high-poly model with environment cube-map texture (add-signed operation) (supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflection cube-map texture
|
X |
X |
X | |||||
TemplBumpDiffuse_NOCM_CMMod diffuse bump-map for high-poly model with environment cube-map texture (modulate operation) (shader supports transparency and Bump amount) (GF2, GF3) From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflection cube-map texture
|
X |
X |
X | |||||
TemplBumpSpec_NOCM - diffuse and specular bump-mapping for high-poly models. Supports multiple light sources. (shader supports transparency Bump amount and specular glossiness/shininess) EFT_BUMPSPEC_MODEL From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Specular highlights
|
X |
X |
X | |||||
TemplBumpDiffuse - diffuse bump usually for indoors for point and projected light sources for low-poly geometry (support multiple light sources and light maps) EFT_BUMP
|
X |
X | ||||||
TemplBumpDiffuse_ProjAtten - the same as TemplBumpDiffuse except this shader use vertex attenuation for projected lights (supports multiple light sources and light maps)
|
X |
X | ||||||
TemplBumpDiffuse_AlphaGlow - diffuse bump mapping usually for indoors for point and projected light sources for low-poly geometry with ambient in alpha channel of base texture (support multiple light sources and light maps)
|
X |
X | ||||||
TemplBumpSpec -diffuse and specular bump mapping usually for indoors for point and projected light sources for low-poly geometry (support multiple light sources and light maps) EFT_BUMPSPEC
|
X |
X | ||||||
TemplBumpSpec_HP - much faster version of TemplBumpSpec without normalization cube-maps and as result only for high-poly geometry.diffuse and specular bump mapping in one pass usually for indoors for point and projected light sources for low-poly geometry (support multiple light sources and light maps)
|
X |
X |
| |||||
TemplBumpSpec_HP_GlossAlpha - pretty fast specular shader with supporting of glossiness as alpha channel of diffuse texture. Shader without normalization cube-maps and as result only for high-poly geometry.diffuse and specular bump mapping in one pass usually for indoors for point and projected light sources for low-poly geometry (support multiple light sources and light maps)
|
X |
X | ||||||
TemplBumpSpec_GlossAlpha -diffuse and specular bump mapping usually for indoors with Gloss-map in alpha channel of decal texture for point and projected light sources for low-poly geometry (support multiple light sources and light maps). Much optimized and faster version of previous shader.
|
X |
X | ||||||
TemplBumpOffset - environment bump-mapping with 2D texture). Environment texture is moving. (GF3 only) EFT_ENVBUMP From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflect 2D texture
|
X | |||||||
TemplBumpOffsetEnv - environment bump-mapping with environment 2D texture) (Bump Refractions) (GF3 only) On GF2 it's just refractions without bump EFT_ENVBUMPENV From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Refract 2D texture For bump texture amount value is works.
|
X |
X | ||||||
TemplBumpOffset_2dEnv - environment bump-mapping with 2D texture as environment map) (GF3 only) On GF2 it's just reflections without bump From MAX: 1. Diffuse 2D texture 2. Bump 2D texture 3. Reflect 2D texture For bump texture amount value is works.
|
X |
X | ||||||
Lighting |
||||||||
Shader templates |
Direct3D |
OpenGL |
XBox |
Game-Cube |
||||
GF2 |
GF3 |
Rad.8500 |
GF2 |
GF3 |
Rad.8500 |
|||
TemplLightDiffuse - diffuse lighting without bump for point and projected light sources for low-poly geometry (support multiple light sources and light maps) From MAX: 1. Diffuse 2D texture
|
X |
X | ||||||
TemplLightDiffuse_AlphaGlow - diffuse lighting for point and projected light sources for low-poly geometry with ambient in alpha channel of base texture (support multiple light sources and light maps)
|
X |
X | ||||||
Reflections/Refractions |
||||||||
Shader templates |
Direct3D |
OpenGL |
XBox |
Game-Cube |
||||
GF2 |
GF3 |
Rad.8500 |
GF2 |
GF3 |
Rad.8500 |
|||
TemplReflCMDecal - CubeMap reflections with decal texture (Add ) (GF2 and GF3) From MAX: 1. Diffuse 2D texture 2. Reflect CM texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplReflCMDecal_ReflAmountAlpha - CubeMap reflections with decal texture (Add). Alpha channel of decal texture modulates reflected texture. (GF2 and GF3) From MAX: 1. Diffuse 2D texture 2. Reflect CM texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplReflCMDecal_ReflAmountOpacity - CubeMap reflections with decal texture (Add). Opacity map modulates reflected texture. (GF2 and GF3) From MAX: 1. Diffuse 2D texture 2. Reflect CM texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplReflCMDecalAddSig - CubeMap reflections with decal texture (Add signed) (GF2 and GF3) EFT_REFLECTCMDECAL From MAX: 1. Diffuse 2D texture 2. Reflect CM texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplReflCMDecalMod - CubeMap reflections with decal texture (Modulate) (GF2 and GF3) From MAX: 1. Diffuse 2D texture 2. Reflect CM texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplRefrEnvTex - environment refractions using 2D texture (render to texture) (GF2 and GF3) EFT_REFRACTENVTEX From MAX: 1. No Diffuse 2D texture 2. Refract 2D texture
|
X |
X |
X | |||||
TemplRefrEnvCM - environment refractions using environment CubeMap (render to CM) (GF2 and GF3) EFT_REFRACTENVCM From MAX: 1. No Diffuse 2D texture 2. Refract AutoCM texture
|
X |
X | ||||||
TemplReflEnvCM - environment reflections using environment CubeMap (render to CM) (GF2 and GF3) EFT_REFLECTENVCM From MAX: 1. No Diffuse 2D texture 2. Reflect AutoCM texture
|
X |
X | ||||||
TemplGlassEnvTex - reflections for flat surfaced with using 2D texture (render to Texture) ( GF3)
|
X |
X | ||||||
TemplGlassEnvCM - fresnel based reflections and refractions using environment CubeMap and additive blended with duffuse texture (render to CM) ( GF3)
|
X |
X | ||||||
TemplGlassDispersionEnvCM - fresnel based reflections and refractions using environment CubeMap with separate refraction coefficients for R, G and B channels (render to CM) ( GF3)
|
X |
X | ||||||
TemplBumpReflCM - bump reflections using custom CubeMap (GF3 only) From MAX: 1. Bump 2D texture 2. Reflect CM texture Public parameters: BumpScale bump amount for reflections
|
X |
X | ||||||
TemplBumpReflCM_Light - bump reflections using custom CubeMap with specular highlighting (GF3 only) From MAX: 1. Bump 2D texture 2. Reflect CM texture Public parameters: BumpScale bump amount for reflections
|
X |
X | ||||||
TemplBumpRefrCM - bump refractions using custom CubeMap (GF3 only) EFT_BUMPREFRACTCM From MAX: 1. Bump 2D texture 2. Refract CM texture Public parameters: BumpScale bump amount for refractions Refraction (1.2): Refraction factor
|
X |
X | ||||||
TemplBumpGlassCM - bump refractions and reflections using custom CubeMap (GF3 only) From MAX: 1. Bump 2D texture 2. Refract CM texture Public parameters: ReflectBumpScale bump amount for reflections RefractBumpScale bump amount for refractions Refraction (1.2): Refraction factor RefractAmount Refraction map contribution ReflectAmount Reflection map contribution NOTE: Sum of RefractAmount and ReflectAmount should be 1 for proper result.
|
X |
X | ||||||
TemplBumpGlassFresnelCM - bump refractions and reflections using custom CubeMap. Reflection-Refraction amount balance is calculated depends on fresnel reflection calculations (angle between surface normal and camera vector) like in real life (GF3 only) From MAX: 1. Bump 2D texture 2. Refract CM texture Public parameters: ReflectBumpScale bump amount for reflections RefractBumpScale bump amount for refractions Refraction (1.2): Refraction factor
|
X |
X | ||||||
TemplBumpReflEnvCM - bump reflections using environment CubeMap (GF3 only) From MAX: 1. Bump 2D texture 2. Reflect AutoCM texture Public parameters: BumpScale bump amount for reflections
|
X |
X | ||||||
TemplBumpGlassEnvCM - bump refractions and reflections using environment CubeMap (GF3 only) From MAX: 1. Bump 2D texture Public parameters: ReflectBumpScale bump amount for reflections RefractBumpScale bump amount for refractions Refraction (1.2): Refraction factor RefractAmount Refraction map contribution ReflectAmount Reflection map contribution NOTE: Sum of RefractAmount and ReflectAmount should be 1 for proper result.
|
X |
X | ||||||
TemplBumpGlassFresnelEnvCM - bump refractions and reflections using environment CubeMap, Reflection-Refraction amount balance is calculated depends on fresnel reflection calculations (angle between surface normal and camera vector) like in real life (GF3 only) From MAX: 1. Bump 2D texture Public parameters: ReflectBumpScale bump amount for reflections RefractBumpScale bump amount for refractions Refraction (1.2): Refraction factor
|
X |
X | ||||||
TemplBumpRefrEnvCM - bump refractions using environment CubeMap (GF3 only) From MAX: 1. Bump 2D texture Refract AutoCM texture Public parameters: BumpScale bump amount for refractions Refraction (1.2): Refraction factor
|
X |
X | ||||||
TemplReflCM - reflections using custom CubeMap (GF2 and GF3) EFT_REFLECTCM From MAX: 1. No Diffuse texture 2. Reflect CM texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplGlassDispersionCM - fresnel based reflections and refractions with separate refraction coefficients for R, G and B channels using custom CubeMap (GF2 and GF3) From MAX: 1. No Diffuse texture Reflect CM texture Public parameters: RefractionR 1): refraction amount for R channel RefractionG 08): refraction amount for G channel RefractionB : refraction amount for B channel FresnleBias bias for fresnal reflect computations FresnelScale scale for fresnal reflect computations FresnelPower power factor for fresnal reflect computations
|
X |
X |
X |
X |
X |
X |
X | |
TemplGlassCM - fresnel based reflections and refractions using custom CubeMap and additive blended with Diffuse texture (GF2 and GF3) From MAX: 1. Diffuse texture 2. Reflect CM texture Public parameters: Refraction (1.05): refraction amount FresnleBias bias for fresnal reflect computations FresnelScale scale for fresnal reflect computations FresnelPower power factor for fresnal reflect computations DiffuseAmount 1): amount for blending with diffuse texture
|
X |
X |
X |
X |
X |
X |
X | |
TemplRefrCM - refractions using custom CubeMap (GF2 and GF3) EFT_REFRACTCM From MAX: 1. Diffuse texture Refract CM texture Public parameters: Refraction (1.05): refraction amount DiffuseAmount 1): amount for blending with diffuse texture
|
X |
X | ||||||
Misc templates |
||||||||
Shader templates |
Direct3D |
OpenGL |
XBox |
Game-Cube |
||||
GF2 |
GF3 |
Rad.8500 |
GF2 |
GF3 |
Rad.8500 |
|||
TemplDecalOpacity - decal texture with opacity map EFT_DECALOPACITY From MAX: 1. Diffuse texture 2. Opacity map |
X |
X |
X | |||||
TemplDecalAlphaBlend - decal texture with alpha blending (no Z-test, no Z-write) |
X |
X |
X |
X |
X |
X | ||
TemplDecalAlphaTest - decal texture with alpha test (Z-test and Z-write is enabled) |
X |
X |
X |
X |
X |
X | ||
TemplTextureShiftS05 - shift of the texture along X axis with period 0.5 sec (no blend Z-test and Z-write is enabled) |
X |
X |
X |
X |
X |
X | ||
TemplTextureShiftT05 - shift of the texture along Y axis with period 0.5 sec (no blend Z-test and Z-write is enabled) |
X |
X |
X |
X |
X |
X | ||
TemplTextureShiftST05 - shift of the texture along X and Y axis with period 0.5 sec (no blend Z-test and Z-write is enabled) |
X |
X |
X |
X |
X |
X | ||
TemplTextureShiftST_2T - shift of the 2 textures along X and Y axis with different moving speed (no blend, Z-test and Z-write is enabled) From MAX: 1. Diffuse texture 2. Filter texture |
X |
X |
X |
X |
X |
X | ||
TemplTextureShiftST_2T_AlphaBlend - shift of the 2 textures along X and Y axis with different moving speed. Two passes with alpha blend (no blend, Z-test and Z-write is enabled) From MAX: 1. Diffuse texture 2. Filter texture |
X |
X |
X |
X |
X |
X | ||
TemplDecalGlow - decal texture with glow texture (Z-test and Z-write is enabled). Glow is affected by light From MAX: 1. Diffuse texture 2. Opacity map (as glow texture) |
X |
X |
X |
X |
X |
X | ||
TemplDecalGlowSelfIllum - decal texture with glow texture (Z-test and Z-write is enabled). Glow isn't affected by light From MAX: 1. Diffuse texture 2. Opacity map (as glow texture) |
X |
X |
X |
X |
X |
X | ||
Templates for plants and trees |
||||||||
TemplPlants - template for tree leaves and plants with small moving of the texture (using alpha-test, Z-test and Z-write is enabled). |
X |
X |
X |
X |
X |
X | ||
TemplPlants1 - template for tree leaves and plants without moving of the texture (using alpha-test, Z-test and Z-write is enabled). |
X |
X |
X |
X |
X |
X | ||
TemplPlantsAnimated - template for plants without moving of the texture, but with animated deformations (using alpha-test, Z-test and Z-write is enabled). |
X |
X |
X |
X |
X |
X | ||
TemplPlantsBark - template for tree barks, stones,. Opaque. (Z-test and Z-write is enabled). |
X |
X |
X |
X |
X |
X | ||
TemplPlantsBark_SunRabbits - template for tree barks, stones,. with moving glow texture as sun rabbits. Opaque. (Z-test and Z-write is enabled). |
X |
X |
X |
X |
X |
X | ||
Templates for entities (Models) |
||||||||
TemplModelCommon - general template for all entities (characters, vechicles, .). Use Diffuse bump per-pixel lighting. Can receive shadows. Allways opaque. (Z-test and Z-write is enabled). Light Maps isn't supported |
X |
X |
X |
X |
X |
X | ||
TemplModelPolybump - general template for all entities with polybump texture (characters, vechicles, .). Use Diffuse bump per-pixel lighting. Can receive shadows. Allways opaque. (Z-test and Z-write is enabled). Light Maps isn't supported |
X |
X |
X |
X |
X |
X | ||
TemplModelPolybumpSpec - general template for all entities with polybump texture (characters, vechicles, .). Use bump Diffuse and Specular per-pixel lighting. Can receive shadows. Allways opaque. (Z-test and Z-write is enabled). Light Maps isn't supported. |
X |
X |
X |
X |
X |
X |
|