Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapter 1.4 digital human shader #326

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ void PBRFragment(Varyings varyings) {
surfaceData.normal =calculateEyeNormal(varyings.uv, tbn, gl_FrontFacing);
surfaceData.f0 = 0.04;


// Can modify surfaceData here
initBRDFData(surfaceData, brdfData);

vec4 color = vec4(0, 0, 0, surfaceData.opacity);
vec3 totalDiffuseColor = vec3(0, 0, 0);
vec3 totalSpecularColor = vec3(0, 0, 0);

// Get shadow attenuation
float shadowAttenuation = 1.0;
Expand All @@ -102,10 +102,13 @@ void PBRFragment(Varyings varyings) {
#endif

// Evaluate direct lighting
evaluateDirectRadiance(varyings, surfaceData, brdfData, shadowAttenuation, color.rgb);
evaluateDirectRadiance(varyings, surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor);

// IBL
evaluateIBL(varyings, surfaceData, brdfData, color.rgb);
evaluateIBL(varyings, surfaceData, brdfData, totalDiffuseColor, totalSpecularColor);

// Final color
vec4 color = vec4(totalDiffuseColor + totalSpecularColor, surfaceData.opacity);

// Emissive
color.rgb += surfaceData.emissiveColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ void PBRFragment(Varyings varyings) {
// Can modify surfaceData here
initBRDFData(surfaceData, brdfData);

vec4 color = vec4(0, 0, 0, surfaceData.opacity);

vec3 totalDiffuseColor = vec3(0, 0, 0);
vec3 totalSpecularColor = vec3(0, 0, 0);

// Get shadow attenuation
float shadowAttenuation = 1.0;
Expand All @@ -86,10 +88,13 @@ void PBRFragment(Varyings varyings) {
#endif

// Evaluate direct lighting
evaluateDirectRadiance(varyings, surfaceData, brdfData, shadowAttenuation, color.rgb);
evaluateDirectRadiance(varyings, surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor);

// IBL
evaluateIBL(varyings, surfaceData, brdfData, color.rgb);
evaluateIBL(varyings, surfaceData, brdfData, totalDiffuseColor, totalSpecularColor);

// Final color
vec4 color = vec4(totalDiffuseColor + totalSpecularColor, surfaceData.opacity);

// Emissive
color.rgb += surfaceData.emissiveColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ void PBRFragment(Varyings varyings) {
// Can modify surfaceData here
initBRDFData(surfaceData, brdfData);

vec4 color = vec4(0, 0, 0, surfaceData.opacity);

vec3 totalDiffuseColor = vec3(0, 0, 0);
vec3 totalSpecularColor = vec3(0, 0, 0);
// Get shadow attenuation
float shadowAttenuation = 1.0;
#if defined(SCENE_DIRECT_LIGHT_COUNT) && defined(NEED_CALCULATE_SHADOWS)
Expand All @@ -86,10 +86,13 @@ void PBRFragment(Varyings varyings) {
#endif

// Evaluate direct lighting
evaluateDirectRadiance(varyings, surfaceData, brdfData, shadowAttenuation, color.rgb);
evaluateDirectRadiance(varyings, surfaceData, brdfData, shadowAttenuation, totalDiffuseColor, totalSpecularColor);

// IBL
evaluateIBL(varyings, surfaceData, brdfData, color.rgb);
evaluateIBL(varyings, surfaceData, brdfData, totalDiffuseColor, totalSpecularColor);

// Final color
vec4 color = vec4(totalDiffuseColor + totalSpecularColor, surfaceData.opacity);

// Emissive
color.rgb += surfaceData.emissiveColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "ReflectionLobe.glsl"
#include "./SSSFunction.glsl"

void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 color) {
void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdfData, vec3 incidentDirection, vec3 lightColor, inout vec3 totalDiffuseColor, inout vec3 totalSpecularColor) {

vec3 diffuseColor = vec3(0);
vec3 specularColor = vec3(0);
Expand All @@ -31,7 +31,9 @@ void surfaceShadingSSS(Varyings varyings, SurfaceData surfaceData, BRDFData brdf
if(surfaceData.dotNV > EPSILON){
specularLobe(varyings, surfaceData, brdfData, incidentDirection, attenuationIrradiance, specularColor);
}
color += diffuseColor + specularColor;

totalDiffuseColor += diffuseColor;
totalSpecularColor += specularColor;
}

#include "LightDirectPBR.glsl"

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading