commit eab67bee2003dd48b6a3cbd703f805bb236169b9
parent 3ffe644f26ee23694d0da8f920d532fe82c051d6
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Mon, 24 Sep 2018 10:54:44 +0200
Fix the generation of the cloud grids
Diffstat:
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/htrdr_compute_radiance_sw.c b/src/htrdr_compute_radiance_sw.c
@@ -309,7 +309,7 @@ htrdr_compute_radiance_sw
CHK(RES_OK == ssf_phase_create
(&htrdr->lifo_allocators[ithread], &ssf_phase_rayleigh, &phase_rayleigh));
- SSF(lambertian_reflection_setup(bsdf, 0.02));
+ SSF(lambertian_reflection_setup(bsdf, 0.5));
/* Setup the phase function for this spectral band & quadrature point */
g = htrdr_sky_fetch_particle_phase_function_asymmetry_parameter
@@ -359,7 +359,7 @@ htrdr_compute_radiance_sw
S3D(scene_view_trace_ray(htrdr->s3d_scn_view, ray_pos, ray_dir, ray_range,
&s3d_hit_prev, &s3d_hit));
- /* Sample an optical thicknes */
+ /* Sample an optical thickness */
scattering_ctx.Ts = ssp_ran_exp(rng, 1);
/* Setup the remaining scattering context fields */
@@ -375,7 +375,6 @@ htrdr_compute_radiance_sw
/* No scattering and no surface reflection. Stop the radiative random walk */
if(S3D_HIT_NONE(&s3d_hit) && SVX_HIT_NONE(&svx_hit)) {
- w *= ksi;
break;
}
ASSERT(SVX_HIT_NONE(&svx_hit)
diff --git a/src/htrdr_sky.c b/src/htrdr_sky.c
@@ -71,7 +71,7 @@ struct build_tree_context {
struct htrdr_grid* grid;
};
-#define BUILD_TREE_CONTEXT_NULL__ { NULL, {0,0,0}, 0, 0, 0, {0,0}, NULL }
+#define BUILD_TREE_CONTEXT_NULL__ {NULL,{0,0,0},0,0,0,{SIZE_MAX,SIZE_MAX},NULL}
static const struct build_tree_context BUILD_TREE_CONTEXT_NULL =
BUILD_TREE_CONTEXT_NULL__;
@@ -803,6 +803,7 @@ setup_cloud_grid
struct str path;
struct str str;
struct build_tree_context ctx = BUILD_TREE_CONTEXT_NULL;
+ struct htgop_spectral_interval band;
size_t sizeof_cell;
size_t ncells;
uint64_t mcode;
@@ -868,6 +869,10 @@ setup_cloud_grid
ctx.tau_threshold = DBL_MAX; /* Unused for grid construction */
ctx.iband = iband;
+ HTGOP(get_sw_spectral_interval(sky->htgop, ctx.iband, &band));
+ ctx.quadrature_range[0] = 0;
+ ctx.quadrature_range[1] = band.quadrature_length - 1;
+
/* Compute the size of a SVX voxel */
ctx.vxsz[0] = sky->htcp_desc.upper[0] - sky->htcp_desc.lower[0];
ctx.vxsz[1] = sky->htcp_desc.upper[1] - sky->htcp_desc.lower[1];
@@ -1018,7 +1023,7 @@ setup_clouds
/* Setup the build context */
ctx.sky = sky;
ctx.dst_max = sz[2];
- ctx.tau_threshold = 0.1;
+ ctx.tau_threshold = 100;
ctx.vxsz[0] = sky->htcp_desc.upper[0] - sky->htcp_desc.lower[0];
ctx.vxsz[1] = sky->htcp_desc.upper[1] - sky->htcp_desc.lower[1];
ctx.vxsz[2] = sky->htcp_desc.upper[2] - sky->htcp_desc.lower[2];
@@ -1538,8 +1543,6 @@ htrdr_sky_fetch_raw_property
&& pos[1] <= cloud_desc->upper[1]
&& pos[2] <= cloud_desc->upper[2];
- in_clouds = 0; /* FIXME FIXME FIXME */
-
/* Is the position inside the atmosphere? */
in_atmosphere =
pos[2] >= atmosphere_desc->lower[2]
@@ -1764,8 +1767,6 @@ htrdr_sky_fetch_svx_property
&& pos[1] <= cloud->octree_desc.upper[1]
&& pos[2] <= cloud->octree_desc.upper[2];
- in_clouds = 0; /* FIXME FIXME FIXME */
-
ASSERT(atmosphere->bitree_desc.frame[0] = SVX_AXIS_Z);
in_atmosphere =
pos[2] >= atmosphere->bitree_desc.lower[2]
@@ -1925,13 +1926,13 @@ htrdr_sky_trace_ray
clouds = sky->clouds[i].octree;
atmosphere = sky->atmosphere[i][iquadrature_pt].bitree;
+ cloud_range[0] = DBL_MAX;
+ cloud_range[1] =-DBL_MAX;
+
/* Compute the ray range, intersecting the clouds AABB */
ray_intersect_aabb(org, dir, range, sky->htcp_desc.lower,
sky->htcp_desc.upper, cloud_range);
- cloud_range[0] = DBL_MAX;
- cloud_range[1] =-DBL_MAX;
-
/* Reset the hit */
*hit = SVX_HIT_NULL;