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

157 update viewport shaders to make certain texture maps optional specular etc #199

Merged
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
13 changes: 11 additions & 2 deletions Source/EditorAssets/Projects/DefaultProject/10041.ERS
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,15 @@ uniform float Gamma_;
const float PI = 3.14159265358979;

vec3 GetNormalFromMap(sampler2D Normal) {
vec3 TangentNormal = texture(Normal, Object.TexCoords).xyz * 2.0f - 1.0f;

// Ensure That Textures Are Present/Valid, If Not, Provide Fallback
vec3 SampledColor = texture(Normal, Object.TexCoords).xyz;
if (!HasNormals || (SampledColor == vec3(0.0f))) {
SampledColor = vec3(0.5f, 0.5f, 1.0f);
}

// Use Texture Data To Calculate Normal Data
vec3 TangentNormal = SampledColor * 2.0f - 1.0f;

vec3 Q1 = dFdx(Object.WorldPos);
vec3 Q2 = dFdy(Object.WorldPos);
Expand All @@ -144,7 +152,6 @@ vec3 GetNormalFromMap(sampler2D Normal) {
mat3 TBN = mat3(T,B,N);

return normalize(TBN * TangentNormal);

}


Expand Down Expand Up @@ -451,3 +458,5 @@ void main() {