Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-01 14:14:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-01 14:41:07 +0300
commitc47d669f247d4762cfeede867c43c638e40c14c3 (patch)
tree734299c81811955ebb56f211bd010a39f42dc6ef /intern/cycles/kernel/closure
parent177a0ca131794a15d775577e4fa25c1d9e695d13 (diff)
Cleanup: comments (long lines) in cycles
Diffstat (limited to 'intern/cycles/kernel/closure')
-rw-r--r--intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h19
-rw-r--r--intern/cycles/kernel/closure/bsdf_hair.h4
-rw-r--r--intern/cycles/kernel/closure/bsdf_hair_principled.h3
-rw-r--r--intern/cycles/kernel/closure/bsdf_microfacet_multi.h18
-rw-r--r--intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h23
-rw-r--r--intern/cycles/kernel/closure/bsdf_util.h2
-rw-r--r--intern/cycles/kernel/closure/bssrdf.h6
7 files changed, 40 insertions, 35 deletions
diff --git a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
index b3b1c37748d..6495ae743ab 100644
--- a/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
+++ b/intern/cycles/kernel/closure/bsdf_ashikhmin_shirley.h
@@ -85,15 +85,11 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(const ShaderCl
float HdotI = fmaxf(fabsf(dot(H, I)), 1e-6f);
float HdotN = fmaxf(dot(H, N), 1e-6f);
- float pump =
- 1.0f /
- fmaxf(
- 1e-6f,
- (HdotI *
- fmaxf(
- NdotO,
- NdotI))); /* pump from original paper (first derivative disc., but cancels the HdotI in the pdf nicely) */
- /*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */ /* pump from d-brdf paper */
+ /* pump from original paper
+ * (first derivative disc., but cancels the HdotI in the pdf nicely) */
+ float pump = 1.0f / fmaxf(1e-6f, (HdotI * fmaxf(NdotO, NdotI)));
+ /* pump from d-brdf paper */
+ /*float pump = 1.0f / fmaxf(1e-4f, ((NdotO + NdotI) * (NdotO*NdotI))); */
float n_x = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_x);
float n_y = bsdf_ashikhmin_shirley_roughness_to_exponent(bsdf->alpha_y);
@@ -105,9 +101,8 @@ ccl_device_forceinline float3 bsdf_ashikhmin_shirley_eval_reflect(const ShaderCl
float norm = (n_x + 1.0f) / (8.0f * M_PI_F);
out = NdotO * norm * lobe * pump;
- *pdf =
- norm * lobe /
- HdotI; /* this is p_h / 4(H.I) (conversion from 'wh measure' to 'wi measure', eq. 8 in paper) */
+ /* this is p_h / 4(H.I) (conversion from 'wh measure' to 'wi measure', eq. 8 in paper). */
+ *pdf = norm * lobe / HdotI;
}
else {
/* anisotropic */
diff --git a/intern/cycles/kernel/closure/bsdf_hair.h b/intern/cycles/kernel/closure/bsdf_hair.h
index 6b2a9a97d30..4b6f5b3b439 100644
--- a/intern/cycles/kernel/closure/bsdf_hair.h
+++ b/intern/cycles/kernel/closure/bsdf_hair.h
@@ -224,7 +224,7 @@ ccl_device int bsdf_hair_reflection_sample(const ShaderClosure *sc,
fast_sincosf(phi, &sinphi, &cosphi);
*omega_in = (cosphi * costheta_i) * locy - (sinphi * costheta_i) * locx + (sintheta_i)*Tg;
- //differentials - TODO: find a better approximation for the reflective bounce
+ // differentials - TODO: find a better approximation for the reflective bounce
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = 2 * dot(locy, dIdx) * locy - dIdx;
*domega_in_dy = 2 * dot(locy, dIdy) * locy - dIdy;
@@ -285,7 +285,7 @@ ccl_device int bsdf_hair_transmission_sample(const ShaderClosure *sc,
fast_sincosf(phi, &sinphi, &cosphi);
*omega_in = (cosphi * costheta_i) * locy - (sinphi * costheta_i) * locx + (sintheta_i)*Tg;
- //differentials - TODO: find a better approximation for the transmission bounce
+ // differentials - TODO: find a better approximation for the transmission bounce
#ifdef __RAY_DIFFERENTIALS__
*domega_in_dx = 2 * dot(locy, dIdx) * locy - dIdx;
*domega_in_dy = 2 * dot(locy, dIdy) * locy - dIdy;
diff --git a/intern/cycles/kernel/closure/bsdf_hair_principled.h b/intern/cycles/kernel/closure/bsdf_hair_principled.h
index a4bba2fbf6c..4db5a6cc830 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_principled.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_principled.h
@@ -60,7 +60,8 @@ ccl_device_inline float cos_from_sin(const float s)
return safe_sqrtf(1.0f - s * s);
}
-/* Gives the change in direction in the normal plane for the given angles and p-th-order scattering. */
+/* Gives the change in direction in the normal plane for the given angles and p-th-order
+ * scattering. */
ccl_device_inline float delta_phi(int p, float gamma_o, float gamma_t)
{
return 2.0f * p * gamma_t - 2.0f * gamma_o + p * M_PI_F;
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
index 2cc1a9c5299..07be33ee6b5 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi.h
@@ -16,7 +16,8 @@
CCL_NAMESPACE_BEGIN
-/* Most of the code is based on the supplemental implementations from https://eheitzresearch.wordpress.com/240-2/. */
+/* Most of the code is based on the supplemental implementations from
+ * https://eheitzresearch.wordpress.com/240-2/. */
/* === GGX Microfacet distribution functions === */
@@ -80,7 +81,8 @@ ccl_device_forceinline float2 mf_sampleP22_11(const float cosI,
return make_float2(slopeX, -slopeY);
}
-/* Visible normal sampling for the GGX distribution (based on page 7 of the supplemental implementation). */
+/* Visible normal sampling for the GGX distribution
+ * (based on page 7 of the supplemental implementation). */
ccl_device_forceinline float3 mf_sample_vndf(const float3 wi,
const float2 alpha,
const float randx,
@@ -134,7 +136,8 @@ ccl_device_forceinline float3 mf_eval_phase_glossy(const float3 w,
return make_float3(phase, phase, phase);
}
-/* Phase function for dielectric transmissive materials, including both reflection and refraction according to the dielectric fresnel term. */
+/* Phase function for dielectric transmissive materials, including both reflection and refraction
+ * according to the dielectric fresnel term. */
ccl_device_forceinline float3 mf_sample_phase_glass(
const float3 wi, const float eta, const float3 wm, const float randV, bool *outside)
{
@@ -227,7 +230,8 @@ ccl_device_forceinline float mf_G1(const float3 w, const float C1, const float l
return powf(C1, lambda);
}
-/* Sampling from the visible height distribution (based on page 17 of the supplemental implementation). */
+/* Sampling from the visible height distribution (based on page 17 of the supplemental
+ * implementation). */
ccl_device_forceinline bool mf_sample_height(
const float3 w, float *h, float *C1, float *G1, float *lambda, const float U)
{
@@ -254,7 +258,8 @@ ccl_device_forceinline bool mf_sample_height(
}
/* === PDF approximations for the different phase functions. ===
- * As explained in bsdf_microfacet_multi_impl.h, using approximations with MIS still produces an unbiased result. */
+ * As explained in bsdf_microfacet_multi_impl.h, using approximations with MIS still produces an
+ * unbiased result. */
/* Approximation for the albedo of the single-scattering GGX distribution,
* the missing energy is then approximated as a diffuse reflection for the PDF. */
@@ -342,7 +347,8 @@ ccl_device_forceinline float mf_glass_pdf(const float3 wi,
}
}
-/* === Actual random walk implementations, one version of mf_eval and mf_sample per phase function. === */
+/* === Actual random walk implementations === */
+/* One version of mf_eval and mf_sample per phase function. */
#define MF_NAME_JOIN(x, y) x##_##y
#define MF_NAME_EVAL(x, y) MF_NAME_JOIN(x, y)
diff --git a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
index 79247ee8057..04d9b22d7d2 100644
--- a/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
+++ b/intern/cycles/kernel/closure/bsdf_microfacet_multi_impl.h
@@ -16,14 +16,14 @@
/* Evaluate the BSDF from wi to wo.
* Evaluation is split into the analytical single-scattering BSDF and the multi-scattering BSDF,
- * which is evaluated stochastically through a random walk. At each bounce (except for the first one),
- * the amount of reflection from here towards wo is evaluated before bouncing again.
+ * which is evaluated stochastically through a random walk. At each bounce (except for the first
+ * one), the amount of reflection from here towards wo is evaluated before bouncing again.
*
- * Because of the random walk, the evaluation is not deterministic, but its expected value is equal to
- * the correct BSDF, which is enough for Monte-Carlo rendering. The PDF also can't be determined
- * analytically, so the single-scattering PDF plus a diffuse term to account for the multi-scattered
- * energy is used. In combination with MIS, that is enough to produce an unbiased result, although
- * the balance heuristic isn't necessarily optimal anymore.
+ * Because of the random walk, the evaluation is not deterministic, but its expected value is equal
+ * to the correct BSDF, which is enough for Monte-Carlo rendering. The PDF also can't be determined
+ * analytically, so the single-scattering PDF plus a diffuse term to account for the
+ * multi-scattered energy is used. In combination with MIS, that is enough to produce an unbiased
+ * result, although the balance heuristic isn't necessarily optimal anymore.
*/
ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)(float3 wi,
float3 wo,
@@ -36,7 +36,8 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)(float3 wi,
bool use_fresnel,
const float3 cspec0)
{
- /* Evaluating for a shallower incoming direction produces less noise, and the properties of the BSDF guarantee reciprocity. */
+ /* Evaluating for a shallower incoming direction produces less noise, and the properties of the
+ * BSDF guarantee reciprocity. */
bool swapped = false;
#ifdef MF_MULTI_GLASS
if (wi.z * wo.z < 0.0f) {
@@ -180,9 +181,9 @@ ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_eval)(float3 wi,
return eval;
}
-/* Perform a random walk on the microsurface starting from wi, returning the direction in which the walk
- * escaped the surface in wo. The function returns the throughput between wi and wo.
- * Without reflection losses due to coloring or fresnel absorption in conductors, the sampling is optimal.
+/* Perform a random walk on the microsurface starting from wi, returning the direction in which the
+ * walk escaped the surface in wo. The function returns the throughput between wi and wo. Without
+ * reflection losses due to coloring or fresnel absorption in conductors, the sampling is optimal.
*/
ccl_device_forceinline float3 MF_FUNCTION_FULL_NAME(mf_sample)(float3 wi,
float3 *wo,
diff --git a/intern/cycles/kernel/closure/bsdf_util.h b/intern/cycles/kernel/closure/bsdf_util.h
index a9a27edd7de..3bce47caedb 100644
--- a/intern/cycles/kernel/closure/bsdf_util.h
+++ b/intern/cycles/kernel/closure/bsdf_util.h
@@ -155,7 +155,7 @@ interpolate_fresnel_color(float3 L, float3 H, float ior, float F0, float3 cspec0
/* Calculate the fresnel interpolation factor
* The value from fresnel_dielectric_cos(...) has to be normalized because
* the cspec0 keeps the F0 color
- */
+ */
float F0_norm = 1.0f / (1.0f - F0);
float FH = (fresnel_dielectric_cos(dot(L, H), ior) - F0) * F0_norm;
diff --git a/intern/cycles/kernel/closure/bssrdf.h b/intern/cycles/kernel/closure/bssrdf.h
index 57804eca269..a7d9f90b443 100644
--- a/intern/cycles/kernel/closure/bssrdf.h
+++ b/intern/cycles/kernel/closure/bssrdf.h
@@ -450,7 +450,8 @@ ccl_device void bssrdf_sample(const ShaderClosure *sc, float xi, float *r, float
else if (bssrdf->type == CLOSURE_BSSRDF_GAUSSIAN_ID) {
bssrdf_gaussian_sample(radius, xi, r, h);
}
- else { /*if(bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID || bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
+ else { /* if (bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID ||
+ * bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID) */
bssrdf_burley_sample(radius, xi, r, h);
}
}
@@ -466,7 +467,8 @@ ccl_device float bssrdf_channel_pdf(const Bssrdf *bssrdf, float radius, float r)
else if (bssrdf->type == CLOSURE_BSSRDF_GAUSSIAN_ID) {
return bssrdf_gaussian_pdf(radius, r);
}
- else { /*if(bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID || bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
+ else { /* if (bssrdf->type == CLOSURE_BSSRDF_BURLEY_ID ||
+ * bssrdf->type == CLOSURE_BSSRDF_PRINCIPLED_ID)*/
return bssrdf_burley_pdf(radius, r);
}
}