Bonjour,
Je me penche actuellement sur la génération d'un terrain basé sur une heigthmap. Cependant je souhaite utiliser la technique du normal mapping en multitexturing. Pour schématiser, je souhaite utiliser 4 stages par couche (type de terrain : herbe, terre, roche etc). Le premier stage est celui de mon alphamap, le deuxième la normal map, le troisième la texture et le quatrième la texture de détail pour réhausser le niveau graphique, pour l'instant, sans envisager la gestion des Pixel/vertex shader. Voici une partie du code :
Evidemment, je ne vous chache pas que ça ne donne pas le résultat escompté... j'en suis proche mais ce n'est pas ça. La superposition des couches grâce à mes alphamaps occupent toute la map pour chaque couche (ex : la couche d'herbe affichée en premier sera entièrement recouverte par la deuxième couche et ainsi de suite jusqu'à la dernière).
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 //texture stage : 0 : alpha map ///////////////////// this.app.device.TextureState[0].ColorOperation = TextureOperation.SelectArg1; this.app.device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor; this.app.device.TextureState[0].AlphaOperation = TextureOperation.SelectArg1; this.app.device.TextureState[0].AlphaArgument1 = TextureArgument.TextureColor; this.app.device.TextureState[0].ResultArgument = TextureArgument.Current; //texture stage : 1 : normal map ///////////////////// this.app.device.TextureState[1].ColorOperation = TextureOperation.Modulate; this.app.device.TextureState[1].ColorArgument1 = TextureArgument.TextureColor; this.app.device.TextureState[1].ColorArgument2 = TextureArgument.Current; this.app.device.TextureState[1].AlphaOperation = TextureOperation.Disable; this.app.device.TextureState[1].ResultArgument = TextureArgument.Current; //texture stage : 2 : texture ///////////////////// this.app.device.TextureState[2].ColorOperation = TextureOperation.DotProduct3; this.app.device.TextureState[2].ColorArgument1 = TextureArgument.TFactor; this.app.device.TextureState[2].ColorArgument2 = TextureArgument.Current; this.app.device.TextureState[2].AlphaOperation = TextureOperation.Disable; this.app.device.TextureState[2].ResultArgument = TextureArgument.Current; //texture stage : 3 : texture ///////////////////// this.app.device.TextureState[3].ColorOperation = TextureOperation.Modulate; this.app.device.TextureState[3].ColorArgument1 = TextureArgument.Current; this.app.device.TextureState[3].ColorArgument2 = TextureArgument.TextureColor; this.app.device.TextureState[3].AlphaOperation = TextureOperation.Disable; this.app.device.TextureState[3].ResultArgument = TextureArgument.Current;
Auriez-vous une idée de ce qui cloche et est ce bien réalisable sans les pixel/vertex shaders ? merci
Partager