Bonjour,
J'ai un soucis de build de mon fichier fx avec Monogame alors que avec XNA tout ce passe bien.
J'ai cru comprendre que les list de struct ne passaient pas avec Monogame mais sans en être sur, mon anglais n'est pas terrible.
Fichier fx XNA
Fichier fx de Monogame
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 struct Light { float3 position; float3 color; float invRadius; }; texture normaltexture; int numberOfLights; Light lights[3]; float3 ambientColor; float screenWidth; float screenHeight; sampler ColorMap : register(s0); sampler NormalMap : samplerState { Texture = normaltexture; MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; }; float3 CalculateLight(Light light, float3 normal,float3 pixelPosition) { float3 direction = light.position - pixelPosition; float atten = length(direction); direction /= atten; float amount = max(dot(normal, direction), 0); atten *= light.invRadius; float modifer = max((1 - atten), 0); return light.color * modifer * amount; } float4 DeferredNormalPS(float2 texCoords : TEXCOORD0) : COLOR { float4 base = tex2D(ColorMap, texCoords); float3 normal = normalize(tex2D(NormalMap, texCoords) * 2.0f - 1.0f); float3 pixelPosition = float3(screenWidth * texCoords.x,screenHeight * texCoords.y,0); float3 finalColor = 0; for (int i=0;i<numberOfLights;i++) { finalColor += CalculateLight(lights[i], normal, pixelPosition); } return float4((ambientColor + finalColor) * base.rgb, base.a); } technique Deferred { pass Pass0 { PixelShader = compile ps_2_0 DeferredNormalPS(); } }
Le message d'erreur est le suivant
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 struct Light { float3 position; float3 color; float invRadius; }; int numberOfLights; Light lights [3]; float3 ambientColor; float screenWidth; float screenHeight; sampler ColorMapSampler : register(s0); sampler NormalMapSampler : register(s1) { Texture = (normaltexture); MinFilter = Linear; MagFilter = Linear; AddressU = Clamp; AddressV = Clamp; }; float3 CalculateLight(Light light, float3 normal, float3 pixelPosition) { float3 direction = light.position - pixelPosition; float atten = length(direction); direction /= atten; float amount = max(dot(normal, direction), 0); atten *= light.invRadius; float modifer = max((1 - atten), 0); return light.color * modifer * amount; } float4 DeferredNormalPS(float2 texCoord : TEXCOORD0) : COLOR0 { float4 base = tex2D(ColorMapSampler, texCoord); float3 normal = normalize(tex2D(NormalMapSampler, texCoord) * 2.0f - 1.0f); float3 pixelPosition = float3(screenWidth * texCoord.x, screenHeight * texCoord.y,0); float3 finalColor = 0; for (int i=0;i<numberOfLights;i++) { finalColor = CalculateLight(lights, normal, pixelPosition); } return float4((ambientColor + finalColor) * base.rgb, base.a); } technique Deferred { pass Pass1 { PixelShader = compile ps_4_0_level_9_1 DeferredNormalPS(); } }
Erreur Processor 'EffectProcessor' had unexpected failure! Light E:/projetWinDev/Light/Light/Content/Deferred.fx
Je vous remercie d'avance





Répondre avec citation
Partager