éclairage shader fragment bgfx
yann459
Messages postés
17
Date d'inscription
Statut
Membre
Dernière intervention
-
Bonjour,
Je voudrais ajouter de l'éclairage dans mon shader et ca ne fonctionne pas sur des directions données.
Shader fragment BGFX :
vec4 dcolor = texture2D(s_texColor, v_texcoord0);
vec3 albedo=dcolor.rgb;
vec3 gDirectionalLight_Color=vec3(1.0,1.0,1.0);
vec4 AmbiantColor = vec4(gDirectionalLight_Color, 1.0f) *
0.9;
float DiffuseFactor0 = dot(normalize(v_normal.xyz), u_viewDir.xyz);
float DiffuseFactor1= dot(normalize(v_normal.xyz), -u_viewDir.xyz);
float DiffuseFactor=max(DiffuseFactor0,DiffuseFactor1); //pour prendre tous les directions de la caméra
vec4 DiffuseColor;
if (DiffuseFactor > 0) {
//if (true) {
DiffuseColor = vec4(gDirectionalLight_Color, 1.0f) *
0.9 *
DiffuseFactor;
}
else {
DiffuseColor = vec4(0, 0, 0, 0);
}
albedo=albedo*AmbiantColor+DiffuseColor;
dcolor=vec4(albedo,dcolor[3]);
gl_FragColor=dcolor;
Pouvez-vous me corriger le shader merci ?
Merci
A voir également:
- éclairage shader fragment bgfx
- Eclairage ecran pc - Guide
- Éclairage nocturne windows 10 ne fonctionne pas - Forum Windows 10
- A d3d11-compatible gpu (feature level 11.0 shader model 5.0) is required to run the engine - Forum Jeux PC
- Bgfx : shader lighting - Forum Programmation
- Retro eclairage tv philips - Forum Téléviseurs