J'ai développé un petit jeu XNA en 3D. Je voudrais ajouter un "brouillard de guerre" sur mes modèles instanciés avec un effet de mon fichier (.fx) [custom effet]. Le problème, c'est que je ne sais pas comment changer la fonction "PixelShaderFunction" afin d'y appliquer mon brouillard.
Attention ne me demandé pas d'utiliser la class "BasicEffect" , je sais qu'il est très simple d'y appliquer un brouillard avec cette class. Mais je cherche à créer un effet custom car j'utilise du modelInstancing.
merci mille fois
[File. Fx]
Voici la déclaration de mes variables dans mon fichier d'effet custom (fx.):
Et ma fonction "PixelShaderFunction" dans mon fichier d'effet (fx.):
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 // InstancedModel.fx // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- // Camera settings. float4x4 World; float4x4 View; float4x4 Projection; //Fog settings float FogNear; float FogFar; float4 FogColor;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6 // Both techniques share this same pixel shader. float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0 { return tex2D(Sampler, input.TextureCoordinate) * input.Color; }
Partager