Bonjour,

Telle une bouteille jetée dans la mer, j'espère avoir une réponse mais j'en doute un peu.

Je suis entrain de refaire entièrement le client d'un assez vieux MMORPG sous Unity et tout se passe très bien jusqu'ici. Cependant il y a un shader que je n'arrive pas vraiment à refaire sous Unity et comme ce n'est pas vraiment ma spécialité, j'aimerai bien avoir un petit coup de main là-dessus. Surtout que je suis sûr que c'est juste un shader pour simuler de l'Emissive (grosso-modo), chose qui ne devait pas être courant à l'époque j'imagine.

J'ai bidouillé un peu un shader Emissive classique, avec les paramètres que je peux discerner dans le shader et disons que ça peut passer mais ça n'a pas vraiment le look original qu'il y avait dans le jeu :



Voici le rendu qu'il y a dans le client d'origine :

Nom : screen141.jpg
Affichages : 73
Taille : 543,8 Ko

On peut voir que c'est de l'Emissive, mais avec quelques élements en + et j'aimerai bien au moins essayer de recréer le même rendu. Voici le code :

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
 
vs.1.1
//---------------------------------------------------------------
// c0  = world-view matrix
// c4  = projection matrix
// c8  = light texture tm
// c12 = light diffuse
// c13 = light ambient
// c14 = light direction (or position)
// c15 = camera position (world)
// c16 = [1.0, .5, 0.0, 127.9961]
// c17 = C_ALPHA_FOG_START_END_FACTOR = [fog_start, fog_end, 1/(fog_end - fog_start), 0]
// ...
// c30-95 = bone matrix (max 22( 3x22 = 66) bone's modelview + world matrix)
//---------------------------------------------------------------
dcl_position      V_POSITION
dcl_normal        V_NORMAL
dcl_blendindices  V_BLENDINDICES
dcl_blendweight   V_BLENDWEIGHT
dcl_texcoord0     V_TEXCOORD0
 
//-------------------------------------------------
// Set 1
//-------------------------------------------------
mov a0.x, V_BLENDINDICES.x
m4x3 r4.xyz, V_POSITION, c[a0.x + C_BONESTART] // r4 = vertex transform
m3x3 r5.xyz, V_NORMAL, c[a0.x + C_BONESTART] // r5 = normal transform
 
//blend them
mul r4.xyz, r4.xyz, V_BLENDWEIGHT.xxxx
mul r5.xyz, r5.xyz, V_BLENDWEIGHT.xxxx
 
//-------------------------------------------------
// Set 2
//-------------------------------------------------
mov a0.x, V_BLENDINDICES.y
m4x3 r2.xyz, V_POSITION, c[a0.x + C_BONESTART]
m3x3 r3, V_NORMAL, c[a0.x + C_BONESTART]
 
//add them in
mad r4.xyz, r2.xyz, V_BLENDWEIGHT.yyyy, r4
mad r5.xyz, r3.xyz, V_BLENDWEIGHT.yyyy, r5
 
//-------------------------------------------------
// compute position (oPos)
//-------------------------------------------------
mov r4.w, C_ONE_HALF_ZERO_MAXPOWER.x
m4x4 oPos, r4, C_PROJECTION_TM // apply projection matrix
 
//-------------------------------------------------
// transform light vector to world space
//-------------------------------------------------
mov r7, C_LIGHT_DIRECTION
 
//-------------------------------------------------
// oD0 = ambient term
//-------------------------------------------------
dp3 r0, r5, r7       // N dot L in world space  
max r0.w, r0.w, C_ONE_HALF_ZERO_MAXPOWER.z  // clamp to [0..w]
add oD0, r0.wwww, C_ONE_HALF_ZERO_MAXPOWER.yyyy
 
//-------------------------------------------------
//tex coords
//-------------------------------------------------
mov oT0.xy, V_TEXCOORD0.xy       // color map
J'aimerai au moins le convertir en HLSL ou savoir comment le reproduire sous Shader Graph, peut importe, tant que je peux le reproduire ça me va.

Merci d'avance a ceux qui prendrons le temps de répondre à cette requête un peu spéciale !