Multimaterial: Difference between revisions
No edit summary |
No edit summary |
||
Line 165: | Line 165: | ||
}; | }; | ||
==External links== | ==External links== | ||
* [http://en.wikipedia.org/wiki/Lerp_(computing) LERP] , wikipedia | * [http://en.wikipedia.org/wiki/Lerp_(computing) LERP] , wikipedia |
Revision as of 16:19, 8 September 2009
Motivation, goal
MultiMaterial is shader that allows composition of textures used in material from multiple layers of common textures via defined mask. Primary purpose is reducing number of sections, thus on surface which mixes multiple materials is needed only one material to combine them all - rendering pass in just one call. Advantage of using MultiMaterial is similar like with landscape (technology is similar) - saves textures, higher detail, prevents repeating. There is no Fresnel for specularity so it is not that valuable for glossy surfaces. Name of this new shader (vertex as well as pixel) is "Multi".
Definition of individual stages in material
Material uses more than 8 stages (14) and must use alternative write for TexGen definition - with "class TexGenX". Details are visible in example. All CO maps may have own TexGen. Mask may have own text gen naturally too. Only first 3 SMDI maps may have own TexGen, fourth using TexGen identical with CO4. MC and AS maps using TexGen identical with mask.
0-3 CO map
Usual CO maps - noteworthy is that it's using also stage 0. On the contrary in model it's awaited that no texture is assigned. While model has also link to texture then it will multiple with stage 0 similarly to macro-map.
4 MASK map
Mask determining in RGB components mixing of separate layers.
5-8 DTSMDI map
Map similar to SMDI map which keeps detail map inside R channel.
9 MC map
Usual macro map - uses same texture coordinates as mask. Calculations with macro map in this shader is different than usual (so LERP with basic map). With macro map we aim to influence only median/average color in the given place - thus original layers aren't overlapped. This technique was taken from mixing with satellite map which is done on terrain.
10 AS map
Usual ambient map - uses same texture coordinates as mask.
11-14 NO map
Usual NO maps.
Example
ambient[]={1,1,1,1.000000};
diffuse[]={1,1,1,1.000000}; forcedDiffuse[]={0.000000,0.000000,0.000000,0.000000}; emmisive[]={0.000000,0.000000,0.000000,1.000000}; specular[]={1.000000,1.0000,1.00000,1.000000}; specularPower=100.000000; PixelShaderID="Multi"; VertexShaderID="Multi"; class TexGen0 { uvSource="tex"; }; class TexGen1 { uvSource="tex"; }; class TexGen2 { uvSource="tex"; }; class TexGen3 { uvSource="tex"; }; class TexGen4 { uvSource="tex"; }; class TexGen5 { uvSource="tex"; }; class TexGen6 { uvSource="tex"; }; class TexGen7 { uvSource="tex"; }; class Stage0 { texture="ca\MultiTest\kostky_CO.paa"; texGen=0; }; class Stage1 { texture="ca\MultiTest\oblaka_CO.paa"; texGen=1; }; class Stage2 { texture="#(rgba,8,8,3)color(0,0,0,1)"; texGen=2; }; class Stage3 { texture="#(rgba,8,8,3)color(0,0,0,1)"; texGen=3; }; class Stage4 { texture="ca\MultiTest\maska_MASK.paa"; texGen=4; }; class Stage5 { texture="ca\MultiTest\kostky_DTSMDI.paa"; texGen=5; }; class Stage6 { texture="ca\MultiTest\oblaka_DTSMDI.paa"; texGen=6; }; class Stage7 { texture="ca\MultiTest\kostky_DTSMDI.paa"; texGen=7; }; class Stage8 { texture="#(rgba,8,8,3)color(0.5,0,1,1)"; texGen=3; }; class Stage9 { texture="#(rgba,8,8,3)color(1,1,1,0)"; // MC map texGen=4; }; class Stage10 { texture="#(rgba,8,8,3)color(0,1,1,1)"; // AS map texGen=4; }; class Stage11 { texture="ca\MultiTest\kostky_NO.paa"; texGen=0; }; class Stage12 { texture="ca\MultiTest\oblaka_NO.paa"; texGen=1; }; class Stage13 { texture="#(rgba,8,8,3)color(0.5,0.5,1,1)"; texGen=2; }; class Stage14 { texture="#(rgba,8,8,3)color(0.5,0.5,1,1)"; texGen=3; };
External links
- LERP , wikipedia