Stilllegung des Forums
Das Forum wurde am 05.06.2023 nach über 20 Jahren stillgelegt (weitere Informationen und ein kleiner Rückblick).
Registrierungen, Anmeldungen und Postings sind nicht mehr möglich. Öffentliche Inhalte sind weiterhin zugänglich.
Das Team von spieleprogrammierer.de bedankt sich bei der Community für die vielen schönen Jahre.
Wenn du eine deutschsprachige Spieleentwickler-Community suchst, schau doch mal im Discord und auf ZFX vorbei!
Werbeanzeige
Zitat von »"Dustin Braun"«
Nun frage ich mich, wie man das denn nun hinbekommt, die texturen während der laufzeit zu scalieren, das ist doch viel zu rechenintensiv!
Zitat
Kannst du dich noch entfährnt daran erinnern?
Zitat
Die Alphamap braucht dann keine all zu große Auflösung, sie bestimmt ja nur wo von welcher Textur am meisten zu sehen ist.
C-/C++-Quelltext |
|
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 |
float4x4 xViewProjection; Texture xGround; Texture xRed; Texture xGreen; Texture xBlue; Texture xAlpha; Texture xMap; sampler sGround = sampler_state { texture = <xGround> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;}; sampler sRed = sampler_state { texture = <xRed> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;}; sampler sGreen = sampler_state { texture = <xGreen> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;}; sampler sBlue = sampler_state { texture = <xBlue> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;}; sampler sAlpha = sampler_state { texture = <xAlpha> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;}; sampler sMap = sampler_state { texture = <xMap> ; magfilter = LINEAR; minfilter = LINEAR; mipfilter=LINEAR; AddressU = mirror; AddressV = mirror;}; struct VertexToPixel { float4 Position : POSITION; float2 TexCoords : TEXCOORD0; }; struct PixelToFrame { float4 Color : COLOR0; }; VertexToPixel VS( float4 inPos : POSITION, float2 inTexCoords : TEXCOORD0) { VertexToPixel Output = (VertexToPixel)0; Output.Position = mul(inPos, xViewProjection); Output.TexCoords = inTexCoords; return Output; } PixelToFrame PS(VertexToPixel In) { PixelToFrame Output = (PixelToFrame)0; float4 map = tex2D(sMap, In.TexCoords / 64); //Output.Color = tex2D(sGround, In.TexCoords); Output.Color += tex2D(sRed, In.TexCoords) * map.r; Output.Color += tex2D(sGreen, In.TexCoords) * map.g; Output.Color += tex2D(sBlue, In.TexCoords) * map.b; Output.Color += tex2D(sAlpha, In.TexCoords) * map.a; return Output; } technique Splatting { pass Pass0 { VertexShader = compile vs_1_1 VS(); PixelShader = compile ps_2_0 PS(); } } |
Werbeanzeige