1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0024872: Support of emission color in Phong shader and ray-tracing

Test cases for issue CR24872
This commit is contained in:
duv
2014-07-24 12:56:42 +04:00
committed by bugmaster
parent 7d7ddef39f
commit 0e330c8cf5
4 changed files with 28 additions and 2 deletions

View File

@@ -165,9 +165,11 @@ vec4 computeLighting (in vec3 theNormal,
vec4 aMaterialAmbient = gl_FrontFacing ? occFrontMaterial_Ambient() : occBackMaterial_Ambient();
vec4 aMaterialDiffuse = gl_FrontFacing ? occFrontMaterial_Diffuse() : occBackMaterial_Diffuse();
vec4 aMaterialSpecular = gl_FrontFacing ? occFrontMaterial_Specular() : occBackMaterial_Specular();
vec4 aMaterialEmission = gl_FrontFacing ? occFrontMaterial_Emission() : occBackMaterial_Emission();
return vec4 (Ambient, 1.0) * aMaterialAmbient
+ vec4 (Diffuse, 1.0) * aMaterialDiffuse
+ vec4 (Specular, 1.0) * aMaterialSpecular;
+ vec4 (Specular, 1.0) * aMaterialSpecular
+ aMaterialEmission;
}
//! Entry point to the Fragment Shader

View File

@@ -916,7 +916,9 @@ vec4 Radiance (in SRay theRay, in vec3 theInverse)
uRaytraceMaterialTexture, MATERIAL_SPEC (aTriIndex.w));
vec4 aOpacity = texelFetch (
uRaytraceMaterialTexture, MATERIAL_TRAN (aTriIndex.w));
vec3 aEmission = texelFetch (
uRaytraceMaterialTexture, MATERIAL_EMIS (aTriIndex.w)).rgb;
vec3 aNormal = SmoothNormal (aHit.UV, aTriIndex);
vec4 aInvTransf0 = texelFetch (uSceneTransformTexture, anObjectId * 4 + 0);
@@ -980,6 +982,8 @@ vec4 Radiance (in SRay theRay, in vec3 theInverse)
aResult.xyz += aWeight.xyz * uGlobalAmbient.xyz *
aAmbient * aOpacity.x * max (abs (dot (aNormal, theRay.Direct)), 0.5f);
aResult.xyz += aWeight.xyz * aOpacity.x * aEmission;
if (aOpacity.x != 1.0f)
{