Lieber Besucher, herzlich willkommen bei: AnnoZone Forum. Falls dies Ihr erster Besuch auf dieser Seite ist, lesen Sie sich bitte die Hilfe durch. Dort wird Ihnen die Bedienung dieser Seite näher erläutert. Darüber hinaus sollten Sie sich registrieren, um alle Funktionen dieser Seite nutzen zu können. Benutzen Sie das Registrierungsformular, um sich zu registrieren oder informieren Sie sich ausführlich über den Registrierungsvorgang. Falls Sie sich bereits zu einem früheren Zeitpunkt registriert haben, können Sie sich hier anmelden.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »Legofan« (18. Januar 2010, 21:26)
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »Larnak« (18. Januar 2010, 21:59)
Zitat
Nur: Ist eben nicht.
Dieser Beitrag wurde bereits 3 mal editiert, zuletzt von »Larnak« (18. Januar 2010, 22:23)
Zitat
Hier ist alles gesagt, was man dazu sagen kann.
Dieser Beitrag wurde bereits 2 mal editiert, zuletzt von »colombus« (20. Juni 2010, 16:31)
Quellcode |
|
1 2 3 4 5 6 7 |
<Width>128</><Height>128</> <Clime>0</> <Difficulty>2</> <AIPoints><i> <m_AIPointID>1</><m_RasterPosition><x>39</><y>80</></></><i> <..........><Rivers><i><hasValue>1</><m_ID>1</><m_GUID>235</> <m_Variation>0</><m_Polygon><i><position><data>CDATA |
Zitat
What is texture splatting? In its simplest form, it is a way to blend textures together on a surface using alphamaps.
I will use the term alphamap to refer to a grayscale image residing in a single channel of a texture. It can be any channel – alpha, red, green, blue, or even luminance. In texture splatting, it will be used to control how much of a texture appears at a given location. This is done by a simple multiplication, alphamap * texture. If the value of a texel in the alphamap is 1, that texture will appear there in full value; if the value of a texel in the alphamap is 0, that texture will not appear there at all.
For terrain, the texture might be grass, dirt, rock, snow, or any other type of terrain you can think of. Bloom refers to a texture and its corresponding alphamap as a splat. An analogy would be throwing a glob of paint at a canvas. The splat is wherever you see that glob. Multiple globs of paint layered on top of each other create the final picture.
Let's say you have a 128x128 heightmap terrain, divided into 32x32 chunks. Each chunk would then be made up of 33x33 vertices. Each chunk has the base textures repeated several times over it – but the alphamap is stretched over the entire area. (0, 0) of the chunk would have alphamap coordinates of (0, 0) and texture coordinates of (0, 0). (33, 33) of the chunk would have alphamap coordinates of (1, 1) and texture coordinates of (x, x), where x is the number of times you want the textures to be repeated. x will depend on the resolution of the textures. Try to make sure they repeat enough to make detail up close, but not so much that the repetition is obvious from far away.
The resolution of your alphamap per chunk is something you need to decide for yourself, but I recommend powers of two. For a 32x32 chunk, you could have a 32x32 alphamap (one texel per unit), a 64x64 alphamap (two texels per unit), or even a 128x128 alphamap (four texels per unit). When deciding what resolution to use, remember that you need an alphamap for every texture that appears on a given chunk. The higher the resolution is, the more control over the blending you have, at the cost of memory.
The size of the chunk is a little trickier to decide. Too small and you will have too many state changes and draw calls, too large and the alphamaps may contain mostly empty space. For example, if you decided to create an alphamap with 1 texel per unit with a chunk size of 128x128, but the alphamap only has non-zero values in one small 4x4 region, 124x124 of your alphamap is wasted memory. If your chunk size was 32x32, only 28x28 would be wasted. This brings up a point: if a given texture does not appear at all over a given chunk, don't give that chunk an alphamap for that texture.
The reason the terrain is divided into chunks is now apparent. Firstly, and most importantly, it can save video memory, and lots of it. Secondly, it can reduce fillrate consumption. By using smaller textures, the video card has less sampling to do if the texture does not appear on every chunk. Thirdly, it fits into common level of detail techniques such as geomipmapping that require the terrain to be divided into chunks anyway.
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »colombus« (21. Juni 2010, 17:18)
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »colombus« (22. Juni 2010, 06:17)
Zitat
data\levels\RandomMap\Small_small_01.tww
Zitat
data\levels\RandomMap\Norm_small_01.tww
Zitat
data\levels\RandomMap\Big_small_01.tww
S_SG04 bennenen. oder N_SG04, und in das Verzeichniss Nord oder zu der Süden inseln Verzeichniss hinfüge.Zitat
data\levels\Islands\South\S_SG03.isc
Quellcode |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
struct MY_INPUT { float2 tuv0 : TEXCOORD0; float2 tuv1 : TEXCOORD1; float3 lightDir : TEXCOORD2; float3 halfVec : TEXCOORD3; #ifdef SW_CLIPPLANE float InvHeight: TEXCOORD4; #endif }; struct MY_OUTPUT { float4 oColor : COLOR0; }; MY_OUTPUT main( in MY_INPUT input, uniform float4 LightDiffuseColor, uniform float4 LightAmbientColor, uniform sampler2D cTexDiffuse : register(s0), uniform sampler2D cTexAlpha : register(s1), uniform sampler2D cTexNormal : register(s2) ) { #ifdef SW_CLIPPLANE //Clip Pixels lying over the Waterplane clip(input.InvHeight); #endif MY_OUTPUT output; float4 col1 = tex2D(cTexDiffuse,input.tuv0); float4 col2 = tex2D(cTexAlpha,input.tuv1); float4 col3 = tex2D(cTexAlpha,input.tuv1*16); output.oColor.rgb = col1.rgb; //texture stecils for stones etc. float tmpa= col2.a+col2.a*col1.a*5.0f; tmpa= min(1.0f, tmpa); output.oColor.a = tmpa; // normal mapping float4 normalSample = tex2D(cTexNormal, input.tuv0); float3 normalVec = normalSample.rgb*2-1; float specAlpha = normalSample.a; //normalVec.z *= 3; normalVec = normalize(normalVec); float n_dot_l = saturate(dot(normalVec, input.lightDir)); float n_dot_h = saturate(dot(normalVec, input.halfVec)); float3 Specular = n_dot_h; float3 Specular2 = Specular * Specular; float3 Specular4 = Specular2 * Specular2; float3 Specular8 = Specular4 * Specular4; //float3 Specular16 = Specular8 * Specular8; float3 SpecularColor = Specular8 * specAlpha; float3 DiffuseColor = col1.rgb * saturate(n_dot_l * LightDiffuseColor + LightAmbientColor); output.oColor.rgb = DiffuseColor + DiffuseColor * SpecularColor; //output.oColor.a = 1; return output; } |
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »colombus« (23. Juni 2010, 23:25)