Skip to content

Commit

Permalink
refactor: shader name
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhhkrx committed Jul 19, 2024
1 parent 5e56686 commit 6186627
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion packages/custom-material/src/advanced-shader/eye/Eye.gs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Shader "/eyes/Eye.gs" {
material_ScleraNormalStrength("Sclera NormalStrength", Range(0, 5, 0.01)) = 1;
material_ScleraTexture("Sclera Texture", Texture2D);
material_ScleraNormal("Sclera NormalTexture", Texture2D);
material_Scleramask("Sclera Mask", Texture2D);
material_ScleraMask("Sclera Mask", Texture2D);


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ vec4 material_IrisColor;
#endif

#ifdef MATERIAL_HAS_SCLERA_MASK
sampler2D material_Scleramask;
sampler2D material_ScleraMask;
#endif

#ifdef MATERIAL_HAS_IRIS_TEXTURE
Expand Down Expand Up @@ -66,9 +66,9 @@ vec3 calculateEyeColor(Varyings varyings, mat3 tbn)
// Get Mask
float heighttexture = 0.0;
#ifdef MATERIAL_HAS_SCLERA_MASK
vec3 irismasktex = (texture2D(material_Scleramask, irisSizeUV)).rgb;
float uvmask = 1.0 - (texture2D(material_Scleramask, varyings.uv )).b;
heighttexture = 1.0 - (texture2D(material_Scleramask, parallaxUV)).b;
vec3 irismasktex = (texture2D(material_ScleraMask, irisSizeUV)).rgb;
float uvmask = 1.0 - (texture2D(material_ScleraMask, varyings.uv )).b;
heighttexture = 1.0 - (texture2D(material_ScleraMask, parallaxUV)).b;
#else
vec3 irismasktex = vec3(1.0);
float uvmask = 1.0;
Expand Down Expand Up @@ -112,7 +112,7 @@ vec3 calculateEyeNormal(Varyings varyings, mat3 tbn, bool isFrontFacing)
vec2 irisSizeUV = (varyings.uv * material_IrisSize) - ((material_IrisSize-1.0)/2.0);

#ifdef MATERIAL_HAS_SCLERA_MASK
vec3 irismasktex = (texture2D(material_Scleramask, irisSizeUV)).rgb;
vec3 irismasktex = (texture2D(material_ScleraMask, irisSizeUV)).rgb;
#else
vec3 irismasktex = vec3(1.0);
#endif
Expand Down
8 changes: 4 additions & 4 deletions packages/custom-material/src/advanced-shader/hair/Hair.gs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Shader "hair/hair.gs" {
Header("HairAnisotropy") {
material_HairFirstWidth("HairFirstWidth", Range(0, 15, 0.01)) = 1;
material_HairSecondWidth("HairSecondWidth", Range(0, 15, 0.01)) = 1;
material_HairsFirststrength("HairsFirstrength", Range(0, 5, 0.01)) = 1;
material_HairsSecondstrength("HairsSecondstrength", Range(0, 5, 0.01)) = 1;
material_HairFirstOffest("HairFirstOffest", Range(-1, 5, 0.01)) = 1;
material_HairSecondOffest("HairSecondOffest", Range(-1, 5, 0.01)) = 1;
material_HairFirstStrength("HairsFirstrength", Range(0, 5, 0.01)) = 1;
material_HairSecondStrength("HairsSecondstrength", Range(0, 5, 0.01)) = 1;
material_HairFirstOffset("HairFirstOffest", Range(-1, 5, 0.01)) = 1;
material_HairSecondOffset("HairSecondOffest", Range(-1, 5, 0.01)) = 1;
material_HairFirstColor("HairFirstColor", Color) = (1,1,1,1);
material_HairSecondColor("HairSecondColor", Color) = (1,1,1,1);
material_HairAnisotropyTexture("HairAnisotropyTexture", Texture2D);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
float material_HairFirstWidth;
float material_HairSecondWidth;
float material_HairsFirststrength;
float material_HairsSecondstrength;
float material_HairFirstOffest;
float material_HairSecondOffest;
float material_HairFirstStrength;
float material_HairSecondStrength;
float material_HairFirstOffset;
float material_HairSecondOffset;
vec4 material_HairFirstColor;
vec4 material_HairSecondColor;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ void specularLobe_hair(Varyings varyings, SurfaceData surfaceData, BRDFData brdf
float shift = 1.0;
#endif

vec3 shiftTangent1 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairFirstOffest);
vec3 shiftTangent2 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairSecondOffest);
vec3 shiftTangent1 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairFirstOffset);
vec3 shiftTangent2 = shiftTangent(worldbitangentDir, surfaceData.normal, shift + material_HairSecondOffset);

vec3 firstcol = material_HairFirstColor.rgb;
vec3 firstSpecular = firstcol * anisotropySpecular(surfaceData, incidentDirection, material_HairFirstWidth*15.0, material_HairsFirststrength, shiftTangent1);
vec3 firstSpecular = firstcol * anisotropySpecular(surfaceData, incidentDirection, material_HairFirstWidth*15.0, material_HairFirstStrength, shiftTangent1);

vec3 secondcol = material_HairSecondColor.rgb;
vec3 secondSpecular = secondcol * anisotropySpecular(surfaceData, incidentDirection, material_HairSecondWidth*15.0, material_HairsSecondstrength, shiftTangent2);
vec3 secondSpecular = secondcol * anisotropySpecular(surfaceData, incidentDirection, material_HairSecondWidth*15.0, material_HairSecondStrength, shiftTangent2);

vec3 hairSpecular = clamp(firstSpecular + secondSpecular, 0.0, 1.0);

Expand Down

0 comments on commit 6186627

Please sign in to comment.