Bladeren bron

[NetRumble] Try to fix shaders, but no joy.

Dominique Louis 3 weken geleden
bovenliggende
commit
270f297ba4

+ 8 - 6
NetRumble/Core/Content/Effects/BloomCombine.fx

@@ -16,21 +16,22 @@ DECLARE_TEXTURE(BaseSampler, 1);
 
 
 // Helper for modifying the saturation of a color.
-float4 AdjustSaturation(float4 color, float saturation)
+float3 AdjustSaturation(float3 color, float saturation)
 {
     // The constants 0.3, 0.59, and 0.11 are chosen because the
     // human eye is more sensitive to green light, and less to blue.
     float grey = dot(color, float3(0.3, 0.59, 0.11));
 
-    return lerp(grey, color, saturation);
+    return lerp(grey.xxx, color, saturation);
 }
 
 
 float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
 {
     // Look up the bloom and original base image colors.
-    float4 bloom = SAMPLE_TEXTURE(BloomSampler, texCoord);
-    float4 base = SAMPLE_TEXTURE(BaseSampler, texCoord);
+    float3 bloom = SAMPLE_TEXTURE(BloomSampler, texCoord).rgb;
+    float4 baseSample = SAMPLE_TEXTURE(BaseSampler, texCoord);
+    float3 base = baseSample.rgb;
     
     // Adjust color saturation and intensity.
     bloom = AdjustSaturation(bloom, BloomSaturation) * BloomIntensity;
@@ -41,7 +42,8 @@ float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
     base *= (1 - saturate(bloom));
     
     // Combine the two images.
-    return base + bloom;
+    float3 combined = base + bloom;
+    return float4(combined, baseSample.a);
 }
 
 
@@ -49,6 +51,6 @@ technique BloomCombine
 {
     pass Pass1
     {
-    PixelShader = compile ps_4_0_level_9_1 PixelShaderF();
+        PixelShader = compile PS_SHADERMODEL PixelShaderF();
     }
 }

+ 1 - 1
NetRumble/Core/Content/Effects/BloomExtract.fx

@@ -24,6 +24,6 @@ technique BloomExtract
 {
     pass Pass1
     {
-    PixelShader = compile ps_4_0_level_9_1 PixelShaderF();
+        PixelShader = compile PS_SHADERMODEL PixelShaderF();
     }
 }

+ 1 - 1
NetRumble/Core/Content/Effects/Clouds.fx

@@ -34,6 +34,6 @@ technique Clouds
 {
     pass P0
     {
-    PixelShader = compile ps_4_0_level_9_1 MainPS();
+        PixelShader = compile PS_SHADERMODEL MainPS();
     }
 }

+ 3 - 3
NetRumble/Core/Content/Effects/GaussianBlur.fx

@@ -21,7 +21,7 @@ float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0
     // Combine a number of weighted image filter taps.
     for (int i = 0; i < SAMPLE_COUNT; i++)
     {
-    c += SAMPLE_TEXTURE(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
+        c += SAMPLE_TEXTURE(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
     }
     
     return c;
@@ -32,6 +32,6 @@ technique GaussianBlur
 {
     pass Pass1
     {
-    PixelShader = compile ps_4_0_level_9_1 PixelShaderF();
+        PixelShader = compile PS_SHADERMODEL PixelShaderF();
     }
-}
+}