[Bf-blender-cvs] [e5a748c] cycles_disney_brdf: Removed code that isn't in use anymore

Pascal Schoen noreply at git.blender.org
Fri Oct 21 09:27:45 CEST 2016


Commit: e5a748ced17c8f59e5e73309096adeea3ba95e04
Author: Pascal Schoen
Date:   Fri Oct 21 08:51:20 2016 +0200
Branches: cycles_disney_brdf
https://developer.blender.org/rBe5a748ced17c8f59e5e73309096adeea3ba95e04

Removed code that isn't in use anymore

===================================================================

M	intern/cycles/kernel/closure/bsdf_util.h
M	intern/cycles/render/nodes.cpp
M	intern/cycles/render/nodes.h

===================================================================

diff --git a/intern/cycles/kernel/closure/bsdf_util.h b/intern/cycles/kernel/closure/bsdf_util.h
index 397d642..66c3ea1 100644
--- a/intern/cycles/kernel/closure/bsdf_util.h
+++ b/intern/cycles/kernel/closure/bsdf_util.h
@@ -148,98 +148,6 @@ ccl_device float smooth_step(float edge0, float edge1, float x)
 	return result;
 }
 
-ccl_device void importance_sample_ggx_slopes(
-	const float cos_theta_i, const float sin_theta_i,
-	float randu, float randv, float *slope_x, float *slope_y,
-	float *G1i)
-{
-	/* special case (normal incidence) */
-	if (cos_theta_i >= 0.99999f) {
-		const float r = sqrtf(randu / (1.0f - randu));
-		const float phi = M_2PI_F * randv;
-		*slope_x = r * cosf(phi);
-		*slope_y = r * sinf(phi);
-		*G1i = 1.0f;
-
-		return;
-	}
-
-	/* precomputations */
-	const float tan_theta_i = sin_theta_i / cos_theta_i;
-	const float G1_inv = 0.5f * (1.0f + safe_sqrtf(1.0f + tan_theta_i*tan_theta_i));
-
-	*G1i = 1.0f / G1_inv;
-
-	/* sample slope_x */
-	const float A = 2.0f*randu*G1_inv - 1.0f;
-	const float AA = A*A;
-	const float tmp = 1.0f / (AA - 1.0f);
-	const float B = tan_theta_i;
-	const float BB = B*B;
-	const float D = safe_sqrtf(BB*(tmp*tmp) - (AA - BB)*tmp);
-	const float slope_x_1 = B*tmp - D;
-	const float slope_x_2 = B*tmp + D;
-	*slope_x = (A < 0.0f || slope_x_2*tan_theta_i > 1.0f) ? slope_x_1 : slope_x_2;
-
-	/* sample slope_y */
-	float S;
-
-	if (randv > 0.5f) {
-		S = 1.0f;
-		randv = 2.0f*(randv - 0.5f);
-	}
-	else {
-		S = -1.0f;
-		randv = 2.0f*(0.5f - randv);
-	}
-
-	const float z = (randv*(randv*(randv*0.27385f - 0.73369f) + 0.46341f)) / (randv*(randv*(randv*0.093073f + 0.309420f) - 1.000000f) + 0.597999f);
-	*slope_y = S * z * safe_sqrtf(1.0f + (*slope_x)*(*slope_x));
-}
-
-ccl_device float3 importance_sample_microfacet_stretched(
-	const float3 omega_i, const float alpha_x, const float alpha_y,
-	const float randu, const float randv,
-	bool beckmann, float *G1i)
-{
-	/* 1. stretch omega_i */
-	float3 omega_i_ = make_float3(alpha_x * omega_i.x, alpha_y * omega_i.y, omega_i.z);
-	omega_i_ = normalize(omega_i_);
-
-	/* get polar coordinates of omega_i_ */
-	float costheta_ = 1.0f;
-	float sintheta_ = 0.0f;
-	float cosphi_ = 1.0f;
-	float sinphi_ = 0.0f;
-
-	if (omega_i_.z < 0.99999f) {
-		costheta_ = omega_i_.z;
-		sintheta_ = safe_sqrtf(1.0f - costheta_*costheta_);
-
-		float invlen = 1.0f / sintheta_;
-		cosphi_ = omega_i_.x * invlen;
-		sinphi_ = omega_i_.y * invlen;
-	}
-
-	/* 2. sample P22_{omega_i}(x_slope, y_slope, 1, 1) */
-	float slope_x, slope_y;
-
-	importance_sample_ggx_slopes(costheta_, sintheta_,
-		randu, randv, &slope_x, &slope_y, G1i);
-
-	/* 3. rotate */
-	float tmp = cosphi_*slope_x - sinphi_*slope_y;
-	slope_y = sinphi_*slope_x + cosphi_*slope_y;
-	slope_x = tmp;
-
-	/* 4. unstretch */
-	slope_x = alpha_x * slope_x;
-	slope_y = alpha_y * slope_y;
-
-	/* 5. compute normal */
-	return normalize(make_float3(-slope_x, -slope_y, 1.0f));
-}
-
 CCL_NAMESPACE_END
 
 #endif /* __BSDF_UTIL_H__ */
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index 2d89f60..fb8fd22 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -2323,29 +2323,6 @@ void DisneyBsdfNode::compile(SVMCompiler& compiler, ShaderInput *p_metallic, Sha
 		__float_as_int(ss_default.x), __float_as_int(ss_default.y), __float_as_int(ss_default.z));
 }
 
-void DisneyBsdfNode::simplify_settings(Scene *scene)
-{
-#if 0
-	if (distribution_orig == NBUILTIN_CLOSURES) {
-		distribution_orig = distribution;
-	}
-	Integrator *integrator = scene->integrator;
-	if (integrator->filter_glossy == 0.0f) {
-		/* Fallback to Sharp closure for Roughness close to 0.
-		* Note: Keep the epsilon in sync with kernel!
-		*/
-		ShaderInput *roughness_input = input("Roughness");
-		if (!roughness_input->link && roughness <= 1e-4f) {
-			distribution = CLOSURE_BSDF_SHARP_GLASS_ID;
-		}
-	}
-	else {
-		/* Rollback to original distribution when filter glossy is used. */
-		distribution = distribution_orig;
-	}
-#endif
-}
-
 bool DisneyBsdfNode::has_integrator_dependency()
 {
 	ShaderInput *roughness_input = input("Roughness");
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index a466ba0..b071900 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -390,7 +390,6 @@ public:
 	}
 
 	ClosureType get_closure_type() { return closure; }
-	void simplify_settings(Scene *scene);
 	bool has_integrator_dependency();
 };




More information about the Bf-blender-cvs mailing list