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
![]() |
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 72 73 74 75 76 77 78 |
//------- Technique: Multitextured -------- struct MTVertexToPixel { float4 Position : POSITION; float4 Color : COLOR0; float3 Normal : TEXCOORD0; float2 TextureCoords : TEXCOORD1; float4 LightDirection : TEXCOORD2; float4 TextureWeights : TEXCOORD3; float Depth : TEXCOORD4; }; struct MTPixelToFrame { float4 Color : COLOR0; }; MTVertexToPixel MultiTexturedVS( float4 inPos : POSITION, float3 inNormal: NORMAL, float2 inTexCoords: TEXCOORD0, float4 inTexWeights: TEXCOORD1) { MTVertexToPixel Output = (MTVertexToPixel)0; float4x4 preViewProjection = mul (xView, xProjection); float4x4 preWorldViewProjection = mul (xWorld, preViewProjection); Output.Position = mul(inPos, preWorldViewProjection); Output.Normal = mul(normalize(inNormal), xWorld); Output.TextureCoords = inTexCoords; Output.LightDirection.xyz = -xLightDirection; Output.LightDirection.w = 1; Output.TextureWeights = inTexWeights; Output.Depth = Output.Position.z/Output.Position.w; return Output; } MTPixelToFrame MultiTexturedPS(MTVertexToPixel PSIn) { MTPixelToFrame Output = (MTPixelToFrame)0; float lightingFactor = 1; if (xEnableLighting) lightingFactor = saturate(saturate(dot(PSIn.Normal, PSIn.LightDirection)) + xAmbient); float blendDistance = 0.99f; float blendWidth = 0.005f; float blendFactor = clamp((PSIn.Depth-blendDistance)/blendWidth, 0, 1); float4 farColor; farColor = tex2D(TextureSampler0, PSIn.TextureCoords)*PSIn.TextureWeights[0]; farColor += tex2D(TextureSampler1, PSIn.TextureCoords)*PSIn.TextureWeights[1]; farColor += tex2D(TextureSampler2, PSIn.TextureCoords)*PSIn.TextureWeights[2]; farColor += tex2D(TextureSampler3, PSIn.TextureCoords)*PSIn.TextureWeights[3]; float4 nearColor; float2 nearTextureCoords = PSIn.TextureCoords*5; nearColor = tex2D(TextureSampler0, nearTextureCoords)*PSIn.TextureWeights[0]; nearColor += tex2D(TextureSampler1, nearTextureCoords)*PSIn.TextureWeights[1]; nearColor += tex2D(TextureSampler2, nearTextureCoords)*PSIn.TextureWeights[2]; nearColor += tex2D(TextureSampler3, nearTextureCoords)*PSIn.TextureWeights[3]; Output.Color = lerp(nearColor, farColor, blendFactor); Output.Color *= lightingFactor; return Output; } technique MultiTextured { pass Pass0 { VertexShader = compile vs_2_0 MultiTexturedVS(); PixelShader = compile ps_2_0 MultiTexturedPS(); } } |
![]() |
Quellcode |
1 |
public TextureWeights TexWeights; |
![]() |
Quellcode |
1 |
private struct TextureWeights { public float A; public float B; public float C; public float D; } |
![]() |
Quellcode |
1 2 3 4 |
farColor = tex2D(TextureSampler0, PSIn.TextureCoords)*PSIn.TextureWeights[0]; farColor += tex2D(TextureSampler1, PSIn.TextureCoords)*PSIn.TextureWeights[1]; farColor += tex2D(TextureSampler2, PSIn.TextureCoords)*PSIn.TextureWeights[2]; farColor += tex2D(TextureSampler3, PSIn.TextureCoords)*PSIn.TextureWeights[3]; |
![]() |
Quellcode |
1 |
farColor = tex2D(TextureSampler0, PSIn.TextureCoords)*PSIn.TextureWeights.A; |
Das geht nicht, weil es wenn dann .a sein müsste; oder .w das geht auch.*PSIn.TextureWeights.A;
Da kann ich mir vorstellen, dass ein ganz anderes Problem dies verhindert. Sieh mal in deinen Shader. Dort hast du zustehen: "float Depth : TEXCOORD4;".
Zitat
Auch gelingt es nicht die
float4 TextureWeights : TEXCOORD3;
als
float4 TextureWeights[4] : TEXCOORD3;
Das liegt daran, dass wahrscheinlich keiner so genau weiß, wie du denn überhaupt intern weiterentwickeln möchtest. Das sieht mir mehr nach einem Projekt aus, welches du allein besser entwickeln kannst.
Zitat
Wann steigen eigentlich mal per Leute mit ein? Die Bilder reichen wohl nicht oder was?
Ja ok. Das wird bald klarer, hoffe ich.
Zitat
Das liegt daran, dass wahrscheinlich keiner so genau weiß, wie du denn überhaupt intern weiterentwickeln möchtest. Das sieht mir mehr nach einem Projekt aus, welches du allein besser entwickeln kannst.
Du kannst nicht erwarten das die Leute sagen "Hey der hat Bilder, ich steig mit ein"Wann steigen eigentlich mal per Leute mit ein? Die Bilder reichen wohl nicht oder was?
Nicht ganz richtigDenke die Vermarktung läuft über Youtube Videos und Foren. So ein Spiel gibt es ja bisher nicht.
Werbeanzeige