Bonjour,
J'ai cherché sur la toile sans trouver un algo ou un bout de code pour une question qui me semblait simple à la base :
Comment fusionner (comme sous OpenGL) une image NormalMap à l'image originelle ?
Voici l’image originelle (pour test) :
Voici la NormalMap :
J'ai bien essayé ceci, comme pour une lightmap, mais le résultat ne me semble pas celui qui devrait être :
A votre avis, quel est la bonne méthode ?
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 var Ab, Bb, Cb: PRGBTriple; X, Y: integer; Begin fus.Picture.bitmap.Width := ori.Picture.Width; fus.Picture.bitmap.Height := ori.Picture.Height; fus.Picture.Bitmap.BeginUpdate; for Y := 0 to ori.Picture.Height - 1 do begin Ab := PRGBTriple(ori.Picture.Bitmap.RawImage.GetLineStart(Y)); Bb := PRGBTriple(map.Picture.Bitmap.RawImage.GetLineStart(Y)); Cb := PRGBTriple(fus.Picture.Bitmap.RawImage.GetLineStart(Y)); for X := 0 to ori.Picture.Width - 1 do begin Cb^.rgbtRed := Trunc(Ab^.rgbtRed * (Bb^.rgbtRed / 255)); Cb^.rgbtGreen := Trunc(Ab^.rgbtGreen * (Bb^.rgbtGreen / 255)); Cb^.rgbtBlue := Trunc(Ab^.rgbtBlue * (Bb^.rgbtBlue / 255)); Inc(Cb); Inc(Bb); Inc(Ab); End; End; fus.Picture.Bitmap.EndUpdate; fus.Invalidate;
Partager