Changes to allow the correct reflectance inside ATM (code commented right now).

This commit is contained in:
Jonathas Costa
2017-05-30 14:23:06 -04:00
parent 2854435458
commit 96e9067eed
5 changed files with 14 additions and 7 deletions
@@ -510,7 +510,7 @@ vec3 groundColor(const vec3 x, const float t, const vec3 v, const vec3 s, const
vec3 groundRadiance = reflectance.rgb * (muSun * transmittanceL0 + irradianceReflected)
* sunRadiance / M_PI;
// Yellowish specular reflection from sun on oceans and rivers
// Specular reflection from sun on oceans and rivers
if (reflectance.w > 0.0) {
vec3 h = normalize(s - v);
// Fresnell Schlick's approximation
@@ -521,7 +521,7 @@ vec3 groundColor(const vec3 x, const float t, const vec3 v, const vec3 s, const
// (After adding the sunRadiance and the attenuation of the Sun through atmosphere)
groundRadiance += reflectance.w * max(waterBrdf, 0.0) * transmittanceL0 * sunRadiance;
}
// Finally, we attenuate the surface Radiance from the the point x0 to the camera location.
reflectedRadiance = attenuationXtoX0 * groundRadiance;
@@ -36,8 +36,8 @@ Fragment getFragment() {
// TODO: Change the color for the new deferred system (JCC)
frag.gColor = frag.color;
// Normal is written in Camera Rig (OS Eye) Space
//frag.gNormalReflectance = vec4(ellipsoidNormalCameraSpace, 1.0); // adding 1.0 to reflectance by now
frag.gNormalReflectance = vec4(fs_normal, 1.0); // adding 1.0 to reflectance by now
//frag.gNormalReflectance = vec4(ellipsoidNormalCameraSpace, 1.0);
frag.gNormalReflectance = vec4(fs_normal, 1.0);//reflectance); // adding 1.0 to reflectance by now
frag.gPosition = vec4(positionCameraSpace, 1.0); // in Camera Rig Space
frag.depth = fs_position.w;
@@ -37,7 +37,7 @@ Fragment getFragment() {
// TODO: Change the color for the new deferred system (JCC)
frag.gColor = frag.color;
// Normal is written in Camera Rig (OS Eye) Space
frag.gNormalReflectance = vec4(ellipsoidNormalCameraSpace, 1.0); // adding 1.0 to reflectance by now
frag.gNormalReflectance = vec4(ellipsoidNormalCameraSpace, 1.0);//reflectance);
//frag.gNormalReflectance = vec4(fs_normal, 1.0); // adding 1.0 to reflectance by now
frag.gPosition = vec4(positionCameraSpace, 1.0); // in Camera Rig Space
@@ -352,7 +352,8 @@ vec4 calculateWater(
const Layer WaterMasks[NUMLAYERS_WATERMASK],
const vec3 ellipsoidNormalCameraSpace,
const vec3 lightDirectionCameraSpace,
const vec3 positionCameraSpace) {
const vec3 positionCameraSpace){//,
//out float reflectance) {
vec4 waterColor = vec4(0,0,0,0);
@@ -382,8 +383,12 @@ vec4 calculateWater(
vec3 specularTotal = specularColor * cosineFactor * specularIntensity * waterColor.a;
//reflectance = waterColor.a;
//return blendOver(currentColor, waterColor);
return currentColor + vec4(specularTotal, 1);
//return currentColor;
}
#endif // TEXTURETILEMAPPING_HGLSL
@@ -75,6 +75,7 @@ in vec2 fs_uv;
in vec3 ellipsoidNormalCameraSpace;
in vec3 positionCameraSpace;
float reflectance;
// levelInterpolationParameter is used to interpolate between a tile and its parent tiles
// The value increases with the distance from the vertex (or fragment) to the camera
@@ -155,7 +156,8 @@ vec4 getTileFragColor(){
WaterMasks,
normalize(ellipsoidNormalCameraSpace),
lightDirectionCameraSpace, // Should already be normalized
positionCameraSpace);
positionCameraSpace);//,
// reflectance);
#endif // USE_WATERMASK