Cycles: disable scaling up of ray differentials after diffuse/glossy bounce, this

isn't working well for OSL texture filtering and wasn't very helpful to begin
with, a better solution should be possible.
This commit is contained in:
Brecht Van Lommel
2012-12-12 14:43:07 +00:00
parent 96cad133f7
commit 5616c7a058
7 changed files with 2 additions and 63 deletions

View File

@@ -134,8 +134,6 @@ __device int bsdf_ashikhmin_velvet_sample(const ShaderClosure *sc, float3 Ng, fl
// TODO: find a better approximation for the retroreflective bounce
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
*domega_in_dx *= 125.0f;
*domega_in_dy *= 125.0f;
#endif
}
else

View File

@@ -74,8 +74,6 @@ __device int bsdf_diffuse_sample(const ShaderClosure *sc, float3 Ng, float3 I, f
// TODO: find a better approximation for the diffuse bounce
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
*domega_in_dx *= 125.0f;
*domega_in_dy *= 125.0f;
#endif
}
else
@@ -126,10 +124,8 @@ __device int bsdf_translucent_sample(const ShaderClosure *sc, float3 Ng, float3
*eval = make_float3(*pdf, *pdf, *pdf);
#ifdef __RAY_DIFFERENTIALS__
// TODO: find a better approximation for the diffuse bounce
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
*domega_in_dx *= -125.0f;
*domega_in_dy *= -125.0f;
*domega_in_dx = -((2 * dot(N, dIdx)) * N - dIdx);
*domega_in_dy = -((2 * dot(N, dIdy)) * N - dIdy);
#endif
}
else {

View File

@@ -199,12 +199,6 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
// Since there is some blur to this reflection, make the
// derivatives a bit bigger. In theory this varies with the
// roughness but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10.0f;
*domega_in_dy *= 10.0f;
#endif
}
}
@@ -251,14 +245,6 @@ __device int bsdf_microfacet_ggx_sample(const ShaderClosure *sc, float3 Ng, floa
// eq. 38 and eq. 17
*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
*eval = make_float3(out, out, out);
#ifdef __RAY_DIFFERENTIALS__
// Since there is some blur to this refraction, make the
// derivatives a bit bigger. In theory this varies with the
// roughness but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10.0f;
*domega_in_dy *= 10.0f;
#endif
}
}
}
@@ -430,12 +416,6 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng,
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = (2 * dot(m, dIdx)) * m - dIdx;
*domega_in_dy = (2 * dot(m, dIdy)) * m - dIdy;
// Since there is some blur to this reflection, make the
// derivatives a bit bigger. In theory this varies with the
// roughness but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10.0f;
*domega_in_dy *= 10.0f;
#endif
}
}
@@ -486,14 +466,6 @@ __device int bsdf_microfacet_beckmann_sample(const ShaderClosure *sc, float3 Ng,
// eq. 38 and eq. 17
*pdf = pm * (m_eta * m_eta) * fabsf(cosHI) / Ht2;
*eval = make_float3(out, out, out);
#ifdef __RAY_DIFFERENTIALS__
// Since there is some blur to this refraction, make the
// derivatives a bit bigger. In theory this varies with the
// roughness but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10.0f;
*domega_in_dy *= 10.0f;
#endif
}
}
}

View File

@@ -81,8 +81,6 @@ __device int bsdf_oren_nayar_sample(const ShaderClosure *sc, float3 Ng, float3 I
// TODO: find a better approximation for the bounce
*domega_in_dx = (2.0f * dot(sc->N, dIdx)) * sc->N - dIdx;
*domega_in_dy = (2.0f * dot(sc->N, dIdy)) * sc->N - dIdy;
*domega_in_dx *= 125.0f;
*domega_in_dy *= 125.0f;
#endif
}
else {

View File

@@ -119,15 +119,6 @@ __device int bsdf_phong_ramp_sample(const ShaderClosure *sc, const float3 colors
*pdf = (m_exponent + 1) * common;
float out = cosNI * (m_exponent + 2) * common;
*eval = bsdf_phong_ramp_get_color(sc, colors, cosp) * out;
#ifdef __RAY_DIFFERENTIALS__
// Since there is some blur to this reflection, make the
// derivatives a bit bigger. In theory this varies with the
// exponent but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10;
*domega_in_dy *= 10;
#endif
}
}
}

View File

@@ -182,12 +182,6 @@ __device int bsdf_ward_sample(const ShaderClosure *sc, float3 Ng, float3 I, floa
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
// Since there is some blur to this reflection, make the
// derivatives a bit bigger. In theory this varies with the
// roughness but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10.0f;
*domega_in_dy *= 10.0f;
#endif
}
}

View File

@@ -108,14 +108,6 @@ __device int bsdf_westin_backscatter_sample(const ShaderClosure *sc, float3 Ng,
*pdf = 0.5f * M_1_PI_F * powf(cosTheta, m_invroughness);
*pdf = (m_invroughness + 1) * (*pdf);
*eval = make_float3(*pdf, *pdf, *pdf);
#ifdef __RAY_DIFFERENTIALS__
// Since there is some blur to this reflection, make the
// derivatives a bit bigger. In theory this varies with the
// exponent but the exact relationship is complex and
// requires more ops than are practical.
*domega_in_dx *= 10.0f;
*domega_in_dy *= 10.0f;
#endif
}
}
}
@@ -176,8 +168,6 @@ __device int bsdf_westin_sheen_sample(const ShaderClosure *sc, float3 Ng, float3
// TODO: find a better approximation for the diffuse bounce
*domega_in_dx = (2 * dot(N, dIdx)) * N - dIdx;
*domega_in_dy = (2 * dot(N, dIdy)) * N - dIdy;
*domega_in_dx *= 125.0f;
*domega_in_dy *= 125.0f;
#endif
}
else {