Fixing the material names

This commit is contained in:
samcake 2016-02-16 09:33:24 -08:00
parent 0ad7bacf02
commit 71863a1550
25 changed files with 93 additions and 93 deletions

View file

@ -15,7 +15,7 @@
<@include DeferredBufferWrite.slh@>
// the diffuse texture
// the albedo texture
uniform sampler2D originalTexture;
// the interpolated normal

View file

@ -16,7 +16,7 @@
out vec4 _color;
void main(void) {
// pass along the diffuse color
// pass along the color
_color = colorToLinearRGBA(inColor);
TransformCamera cam = getTransformCamera();

View file

@ -12,8 +12,8 @@
<@def DEFERRED_BUFFER_SLH@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the normal texture
uniform sampler2D normalMap;
@ -83,7 +83,7 @@ DeferredFragment unpackDeferredFragment(DeferredTransform deferredTransform, vec
DeferredFragment frag;
frag.depthVal = texture(depthMap, texcoord).r;
frag.normalVal = texture(normalMap, texcoord);
frag.diffuseVal = texture(diffuseMap, texcoord);
frag.diffuseVal = texture(albedoMap, texcoord);
frag.specularVal = texture(specularMap, texcoord);
frag.obscurance = texture(obscuranceMap, texcoord).x;

View file

@ -43,32 +43,32 @@ float evalOpaqueFinalAlpha(float alpha, float mapAlpha) {
const vec3 DEFAULT_SPECULAR = vec3(0.1);
const float DEFAULT_SHININESS = 10;
void packDeferredFragment(vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess) {
void packDeferredFragment(vec3 normal, float alpha, vec3 albedo, vec3 specular, float shininess) {
if (alpha != 1.0) {
discard;
}
_fragColor0 = vec4(diffuse.rgb, 1.0); // Opaque
_fragColor0 = vec4(albedo.rgb, 1.0); // Opaque
_fragColor1 = vec4(bestFitNormal(normal), 1.0);
_fragColor2 = vec4(specular, shininess / 128.0);
}
void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess, vec3 emissive) {
void packDeferredFragmentLightmap(vec3 normal, float alpha, vec3 albedo, vec3 specular, float shininess, vec3 emissive) {
if (alpha != 1.0) {
discard;
}
_fragColor0 = vec4(diffuse.rgb, 0.5);
_fragColor0 = vec4(albedo.rgb, 0.5);
_fragColor1 = vec4(bestFitNormal(normal), 0.5);
_fragColor2 = vec4(emissive, shininess / 128.0);
}
void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 diffuse, vec3 specular, float shininess) {
void packDeferredFragmentTranslucent(vec3 normal, float alpha, vec3 albedo, vec3 specular, float shininess) {
if (alpha <= 0.0) {
discard;
}
_fragColor0 = vec4(diffuse.rgb, alpha);
_fragColor0 = vec4(albedo.rgb, alpha);
// _fragColor1 = vec4(normal, 0.0) * 0.5 + vec4(0.5, 0.5, 0.5, 1.0);
// _fragColor2 = vec4(specular, shininess / 128.0);
}

View file

@ -70,7 +70,7 @@ uniform SphericalHarmonics ambientSphere;
<@include model/Light.slh@>
<@func declareEvalAmbientGlobalColor()@>
vec3 evalAmbientGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss) {
vec3 evalAmbientGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, vec3 specular, float gloss) {
// Need the light now
Light light = getLight();
@ -79,11 +79,11 @@ vec3 evalAmbientGlobalColor(mat4 invViewMat, float shadowAttenuation, float obsc
vec4 fragEyeVector = invViewMat * vec4(-position, 0.0);
vec3 fragEyeDir = normalize(fragEyeVector.xyz);
vec3 color = diffuse.rgb * getLightColor(light) * obscurance * getLightAmbientIntensity(light);
vec3 color = albedo * getLightColor(light) * obscurance * getLightAmbientIntensity(light);
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
color += vec3(diffuse * shading.w + shading.rgb) * min(shadowAttenuation, obscurance) * getLightColor(light) * getLightIntensity(light);
color += vec3(albedo * shading.w + shading.rgb) * min(shadowAttenuation, obscurance) * getLightColor(light) * getLightIntensity(light);
return color;
}
@ -93,7 +93,7 @@ vec3 evalAmbientGlobalColor(mat4 invViewMat, float shadowAttenuation, float obsc
<$declareSphericalHarmonics()$>
vec3 evalAmbientSphereGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss) {
vec3 evalAmbientSphereGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, vec3 specular, float gloss) {
// Need the light now
Light light = getLight();
@ -102,11 +102,11 @@ vec3 evalAmbientSphereGlobalColor(mat4 invViewMat, float shadowAttenuation, floa
vec3 fragEyeDir = normalize(fragEyeVector.xyz);
vec3 ambientNormal = fragNormal.xyz;
vec3 color = diffuse.rgb * evalSphericalLight(ambientSphere, ambientNormal).xyz * obscurance * getLightAmbientIntensity(light);
vec3 color = albedo * evalSphericalLight(ambientSphere, ambientNormal).xyz * obscurance * getLightAmbientIntensity(light);
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
color += vec3(diffuse * shading.w + shading.rgb) * min(shadowAttenuation, obscurance) * getLightColor(light) * getLightIntensity(light);
color += vec3(albedo * shading.w + shading.rgb) * min(shadowAttenuation, obscurance) * getLightColor(light) * getLightIntensity(light);
return color;
}
@ -117,7 +117,7 @@ vec3 evalAmbientSphereGlobalColor(mat4 invViewMat, float shadowAttenuation, floa
<$declareSkyboxMap()$>
<$declareSphericalHarmonics()$>
vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss) {
vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 position, vec3 normal, vec3 albedo, vec3 specular, float gloss) {
// Need the light now
Light light = getLight();
@ -125,18 +125,18 @@ vec3 evalSkyboxGlobalColor(mat4 invViewMat, float shadowAttenuation, float obscu
vec4 fragEyeVector = invViewMat * vec4(-position, 0.0);
vec3 fragEyeDir = normalize(fragEyeVector.xyz);
vec3 color = diffuse.rgb * evalSphericalLight(ambientSphere, fragNormal).xyz * obscurance * getLightAmbientIntensity(light);
vec3 color = albedo * evalSphericalLight(ambientSphere, fragNormal).xyz * obscurance * getLightAmbientIntensity(light);
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
color += vec3(diffuse * shading.w + shading.rgb) * min(shadowAttenuation, obscurance) * getLightColor(light) * getLightIntensity(light);
color += vec3(albedo * shading.w + shading.rgb) * min(shadowAttenuation, obscurance) * getLightColor(light) * getLightIntensity(light);
return color;
}
<@endfunc@>
<@func declareEvalLightmappedColor()@>
vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 normal, vec3 diffuse, vec3 lightmap) {
vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, float obscurance, vec3 normal, vec3 albedo, vec3 lightmap) {
Light light = getLight();
@ -156,7 +156,7 @@ vec3 evalLightmappedColor(mat4 invViewMat, float shadowAttenuation, float obscur
// ambient is a tiny percentage of the lightmap and only when in the shadow
vec3 ambientLight = (1 - lightAttenuation) * lightmap * getLightAmbientIntensity(light);
return obscurance * diffuse * (ambientLight + diffuseLight);
return obscurance * albedo * (ambientLight + diffuseLight);
}
<@endfunc@>

View file

@ -50,7 +50,7 @@ public:
// update global lighting
void setAmbientLightMode(int preset);
void setGlobalLight(const glm::vec3& direction, const glm::vec3& diffuse, float intensity, float ambientIntensity);
void setGlobalLight(const glm::vec3& direction, const glm::vec3& color, float intensity, float ambientIntensity);
void setGlobalSkybox(const model::SkyboxPointer& skybox);
const LightStage& getLightStage() { return _lightStage; }

View file

@ -1846,7 +1846,7 @@ inline bool operator==(const SimpleProgramKey& a, const SimpleProgramKey& b) {
void GeometryCache::bindSimpleProgram(gpu::Batch& batch, bool textured, bool culled, bool emissive, bool depthBiased) {
batch.setPipeline(getSimplePipeline(textured, culled, emissive, depthBiased));
// If not textured, set a default diffuse map
// If not textured, set a default albedo map
if (!textured) {
batch.setResourceTexture(render::ShapePipeline::Slot::ALBEDO_MAP,
DependencyManager::get<TextureCache>()->getWhiteTexture());

View file

@ -16,7 +16,7 @@
out vec4 _color;
void main(void) {
// pass along the diffuse color
// pass along the color
_color = colorToLinearRGBA(inColor.rgba);
TransformCamera cam = getTransformCamera();

View file

@ -16,7 +16,7 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
uniform sampler2D albedoMap;
in vec4 _position;
in vec3 _normal;
@ -25,15 +25,15 @@ in vec2 _texCoord0;
void main(void) {
// Fetch diffuse map
vec4 diffuse = texture(diffuseMap, _texCoord0);
// Fetch albedo map
vec4 albedo = texture(albedoMap, _texCoord0);
Material mat = getMaterial();
packDeferredFragment(
normalize(_normal.xyz),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
getMaterialSpecular(mat),
getMaterialShininess(mat));
}

View file

@ -15,7 +15,7 @@
<@include DeferredBufferWrite.slh@>
<@include model/Material.slh@>
uniform sampler2D diffuseMap;
uniform sampler2D albedoMap;
in vec2 _texCoord0;
in vec3 _normal;
@ -23,7 +23,7 @@ in vec3 _color;
in float _alpha;
void main(void) {
vec4 texel = texture(diffuseMap, _texCoord0);
vec4 texel = texture(albedoMap, _texCoord0);
Material mat = getMaterial();
vec3 fragColor = getMaterialAlbedo(mat) * texel.rgb * _color;

View file

@ -16,8 +16,8 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the emissive map texture and parameters
uniform sampler2D emissiveMap;
@ -30,15 +30,15 @@ in vec3 _normal;
in vec3 _color;
void main(void) {
vec4 diffuse = texture(diffuseMap, _texCoord0);
vec4 albedo = texture(albedoMap, _texCoord0);
vec4 emissive = texture(emissiveMap, _texCoord1);
Material mat = getMaterial();
packDeferredFragmentLightmap(
normalize(_normal),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
getMaterialSpecular(mat),
getMaterialShininess(mat),
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));

View file

@ -28,7 +28,7 @@ out vec3 _normal;
out vec3 _color;
void main(void) {
// pass along the diffuse color in linear space
// pass along the color in linear space
_color = colorToLinearRGB(inColor.xyz);
// and the texture coordinates

View file

@ -16,8 +16,8 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the normal map texture
uniform sampler2D normalMap;
@ -43,15 +43,15 @@ void main(void) {
normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z, 0.0);
// set the diffuse, normal, specular data
vec4 diffuse = texture(diffuseMap, _texCoord0);
vec4 albedo = texture(albedoMap, _texCoord0);
vec4 emissive = texture(emissiveMap, _texCoord1);
Material mat = getMaterial();
packDeferredFragmentLightmap(
normalize(viewNormal.xyz),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
getMaterialSpecular(mat),
getMaterialShininess(mat),
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));

View file

@ -29,7 +29,7 @@ out vec3 _tangent;
out vec3 _color;
void main(void) {
// pass along the diffuse color in linear space
// pass along the color in linear space
_color = colorToLinearRGB(inColor.xyz);
// and the texture coordinates

View file

@ -16,8 +16,8 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the emissive map texture and parameters
uniform sampler2D emissiveMap;
@ -45,8 +45,8 @@ void main(void) {
vec4 viewNormal = vec4(normalizedTangent * localNormal.x +
normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z, 0.0);
// set the diffuse, normal, specular data
vec4 diffuse = texture(diffuseMap, _texCoord0);
// set the albedo, normal, specular data
vec4 albedo = texture(albedoMap, _texCoord0);
vec3 specular = texture(specularMap, _texCoord0).rgb;
vec4 emissive = texture(emissiveMap, _texCoord1);
@ -54,8 +54,8 @@ void main(void) {
packDeferredFragmentLightmap(
normalize(viewNormal.xyz),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
specular, // no use of getMaterialSpecular(mat)
getMaterialShininess(mat),
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));

View file

@ -16,8 +16,8 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the emissive map texture and parameters
uniform sampler2D emissiveMap;
@ -33,8 +33,8 @@ in vec3 _normal;
in vec3 _color;
void main(void) {
// set the diffuse, normal, specular data
vec4 diffuse = texture(diffuseMap, _texCoord0);
// set the albedo, normal, specular data
vec4 albedo = texture(albedoMap, _texCoord0);
vec3 specular = texture(specularMap, _texCoord0).rgb;
vec4 emissive = texture(emissiveMap, _texCoord1);
@ -42,8 +42,8 @@ void main(void) {
packDeferredFragmentLightmap(
normalize(_normal),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
specular, // no use of getMaterialSpecular(mat)
getMaterialShininess(mat),
(vec3(emissiveParams.x) + emissiveParams.y * emissive.rgb));

View file

@ -16,8 +16,8 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the normal map texture
uniform sampler2D normalMap;
@ -37,14 +37,14 @@ void main(void) {
vec4 viewNormal = vec4(normalizedTangent * localNormal.x +
normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z, 0.0);
vec4 diffuse = texture(diffuseMap, _texCoord0.st);
vec4 albedo = texture(albedoMap, _texCoord0.st);
Material mat = getMaterial();
packDeferredFragment(
normalize(viewNormal.xyz),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
getMaterialSpecular(mat),
getMaterialShininess(mat));
}

View file

@ -28,7 +28,7 @@ out vec3 _tangent;
out vec3 _color;
void main(void) {
// pass along the diffuse color
// pass along the color
_color = colorToLinearRGB(inColor.xyz);
// and the texture coordinates

View file

@ -16,8 +16,8 @@
<@include model/Material.slh@>
// the diffuse texture
uniform sampler2D diffuseMap;
// the albedo texture
uniform sampler2D albedoMap;
// the normal map texture
uniform sampler2D normalMap;
@ -40,16 +40,16 @@ void main(void) {
vec4 viewNormal = vec4(normalizedTangent * localNormal.x +
normalizedBitangent * localNormal.y + normalizedNormal * localNormal.z, 0.0);
// set the diffuse, normal, specular data
vec4 diffuse = texture(diffuseMap, _texCoord0);
// set the albedo, normal, specular data
vec4 albedo = texture(albedoMap, _texCoord0);
vec3 specular = texture(specularMap, _texCoord0).rgb;
Material mat = getMaterial();
packDeferredFragment(
normalize(viewNormal.xyz),
evalOpaqueFinalAlpha(getMaterialOpacity(mat), diffuse.a),
getMaterialAlbedo(mat) * diffuse.rgb * _color,
evalOpaqueFinalAlpha(getMaterialOpacity(mat), albedo.a),
getMaterialAlbedo(mat) * albedo.rgb * _color,
specular, //getMaterialSpecular(mat),
getMaterialShininess(mat));
}

View file

@ -20,7 +20,7 @@
<@include gpu/Transform.slh@>
<$declareStandardCameraTransform()$>
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss, float opacity) {
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 albedo, vec3 specular, float gloss, float opacity) {
// Need the light now
Light light = getLight();
@ -31,11 +31,11 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d
vec3 fragEyeDir;
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
vec3 color = opacity * diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light);
vec3 color = opacity * albedo * getLightColor(light) * getLightAmbientIntensity(light);
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
color += vec3(diffuse * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light);
color += vec3(albedo * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light);
return vec4(color, opacity);
}
@ -56,7 +56,7 @@ void main(void) {
Material mat = getMaterial();
vec3 fragPosition = _position.xyz;
vec3 fragNormal = normalize(_normal);
vec3 fragDiffuse = getMaterialAlbedo(mat) * albedo.rgb * _color;
vec3 fragAlbedo = getMaterialAlbedo(mat) * albedo.rgb * _color;
vec3 fragSpecular = getMaterialSpecular(mat);
float fragGloss = getMaterialShininess(mat) / 128;
float fragOpacity = getMaterialOpacity(mat) * albedo.a * _alpha;
@ -64,7 +64,7 @@ void main(void) {
_fragColor = evalGlobalColor(1.0,
fragPosition,
fragNormal,
fragDiffuse,
fragAlbedo,
fragSpecular,
fragGloss,
fragOpacity);

View file

@ -17,7 +17,7 @@
<@include gpu/Transform.slh@>
<$declareStandardCameraTransform()$>
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss, float opacity) {
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 albedo, vec3 specular, float gloss, float opacity) {
// Need the light now
Light light = getLight();
@ -28,11 +28,11 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d
vec3 fragEyeDir;
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
vec3 color = opacity * diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light);
vec3 color = opacity * albedo * getLightColor(light) * getLightAmbientIntensity(light);
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
color += vec3(diffuse * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light);
color += vec3(albedo * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light);
return vec4(color, opacity);
}
@ -48,14 +48,14 @@ in float _alpha;
out vec4 _fragColor;
void main(void) {
vec4 diffuse = texture(originalTexture, _texCoord0);
vec4 albedo = texture(originalTexture, _texCoord0);
vec3 fragPosition = _position.xyz;
vec3 fragNormal = normalize(_normal);
vec3 fragDiffuse = diffuse.rgb * _color;
vec3 fragAlbedo = albedo.rgb * _color;
vec3 fragSpecular = vec3(0.1);
float fragGloss = 10.0 / 128.0;
float fragOpacity = diffuse.a;
float fragOpacity = albedo.a;
if (fragOpacity <= 0.1) {
discard;
@ -64,7 +64,7 @@ void main(void) {
vec4 color = evalGlobalColor(1.0,
fragPosition,
fragNormal,
fragDiffuse,
fragAlbedo,
fragSpecular,
fragGloss,
fragOpacity);

View file

@ -20,12 +20,12 @@ in vec3 _color;
out vec4 _fragColor;
void main(void) {
vec4 diffuse = texture(originalTexture, _texCoord0);
vec4 albedo = texture(originalTexture, _texCoord0);
if (diffuse.a <= 0.1) {
if (albedo.a <= 0.1) {
discard;
}
vec4 color = vec4(diffuse.rgb * _color, diffuse.a);
vec4 color = vec4(albedo.rgb * _color, albedo.a);
// Apply standard tone mapping
_fragColor = vec4(pow(color.xyz, vec3(1.0 / 2.2)), color.w);

View file

@ -18,7 +18,7 @@
<@include gpu/Transform.slh@>
<$declareStandardCameraTransform()$>
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 diffuse, vec3 specular, float gloss, float opacity) {
vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 albedo, vec3 specular, float gloss, float opacity) {
// Need the light now
Light light = getLight();
@ -29,11 +29,11 @@ vec4 evalGlobalColor(float shadowAttenuation, vec3 position, vec3 normal, vec3 d
vec3 fragEyeDir;
<$transformEyeToWorldDir(cam, fragEyeVectorView, fragEyeDir)$>
vec3 color = opacity * diffuse.rgb * getLightColor(light) * getLightAmbientIntensity(light);
vec3 color = opacity * albedo * getLightColor(light) * getLightAmbientIntensity(light);
vec4 shading = evalFragShading(fragNormal, -getLightDirection(light), fragEyeDir, specular, gloss);
color += vec3(diffuse * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light);
color += vec3(albedo * shading.w * opacity + shading.rgb) * shadowAttenuation * getLightColor(light) * getLightIntensity(light);
return vec4(color, opacity);
}
@ -49,19 +49,19 @@ in float _alpha;
out vec4 _fragColor;
void main(void) {
vec4 diffuse = texture(originalTexture, _texCoord0);
vec4 albedo = texture(originalTexture, _texCoord0);
vec3 fragPosition = _position.xyz;
vec3 fragNormal = normalize(_normal);
vec3 fragDiffuse = diffuse.rgb * _color;
vec3 fragAlbedo = albedo.rgb * _color;
vec3 fragSpecular = vec3(0.1);
float fragGloss = 10.0 / 128.0;
float fragOpacity = diffuse.a * _alpha;
float fragOpacity = albedo.a * _alpha;
vec4 color = evalGlobalColor(1.0,
fragPosition,
fragNormal,
fragDiffuse,
fragAlbedo,
fragSpecular,
fragGloss,
fragOpacity);

View file

@ -21,7 +21,7 @@ in float _alpha;
out vec4 _fragColor;
void main(void) {
vec4 diffuse = texture(originalTexture, _texCoord0);
vec4 albedo = texture(originalTexture, _texCoord0);
_fragColor = vec4(diffuse.rgb * _color, diffuse.a * _alpha);
_fragColor = vec4(albedo.rgb * _color, albedo.a * _alpha);
}

View file

@ -32,7 +32,7 @@ void main(void) {
skinPositionNormal(inSkinClusterIndex, inSkinClusterWeight, inPosition, inNormal.xyz, position, interpolatedNormal);
// pass along the diffuse color
// pass along the color
_color = colorToLinearRGB(inColor.rgb);
// and the texture coordinates