From dbb4526785c59e50ce5fd3cf5e716dace2e6f413 Mon Sep 17 00:00:00 2001 From: gforney Date: Tue, 20 Jan 2026 22:35:36 -0500 Subject: [PATCH 1/3] smokeview source: output hrrpuv alpha in center of mesh when pp_OPACITY_DEBUG is set --- Source/smokeview/IOsmoke.c | 7 +++++++ Source/smokeview/options.h | 1 + 2 files changed, 8 insertions(+) diff --git a/Source/smokeview/IOsmoke.c b/Source/smokeview/IOsmoke.c index 4e34f396a5..e8617f984f 100644 --- a/Source/smokeview/IOsmoke.c +++ b/Source/smokeview/IOsmoke.c @@ -2722,6 +2722,13 @@ void DrawSmokeFrame(void){ } if(smoke3di->smokeframe_loaded!=NULL&&smoke3di->smokeframe_loaded[smoke3di->ismoke3d_time]==0)continue; } +#ifdef pp_OPACITY_DEBUG + char alabel[256]; + float *xyz; + sprintf(alabel, "%i\n", smoke3di->fire_alpha); + xyz = smokemesh->boxmiddle_smv; + Output3Text(foregroundcolor, xyz[0], xyz[1], xyz[2], alabel); +#endif #ifdef pp_GPU if(usegpu_local == 1) { DrawSmoke3DGPU(smoke3di); diff --git a/Source/smokeview/options.h b/Source/smokeview/options.h index 8f603e6a40..24f0053da8 100644 --- a/Source/smokeview/options.h +++ b/Source/smokeview/options.h @@ -13,6 +13,7 @@ //#define pp_SHOW_UPDATE // show what is being updated in the UpdateShowScene routine //#define pp_TERRAIN_HIDE // hide terrain when hiding internal blockages +//#define pp_OPACITY_DEBUG // output hrrpuv opacity in center of each mesh //*** options: windows From fb83194b8d05a1a614ad7fe5d249b4c1c2c6d07c Mon Sep 17 00:00:00 2001 From: gforney Date: Wed, 21 Jan 2026 10:41:47 -0500 Subject: [PATCH 2/3] smokeview source: correct hrrpuv opacity computation - addresses smokeview issue 2537 --- Source/smokeview/IOsmoke.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Source/smokeview/IOsmoke.c b/Source/smokeview/IOsmoke.c index e8617f984f..4e57355840 100644 --- a/Source/smokeview/IOsmoke.c +++ b/Source/smokeview/IOsmoke.c @@ -1307,27 +1307,41 @@ void InitAlphas(unsigned char *smokealphanew, unsigned char *firealphanew, float if(use_smoke_density == 1){; for(i = 1; i < 255; i++){ float soot_density, soot_opacity; - int soot_alpha, fire_alpha; + int soot_alpha; soot_density = maxval*(float)i/255.0; soot_opacity = 254.0*(1.0 - exp(-new_extinct*new_dx*soot_density)); soot_alpha = CLAMP(soot_opacity+0.5, 0, 254); smokealphanew[i] = (unsigned char)soot_alpha; - fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); - firealphanew[i] = (unsigned char)fire_alpha; + if(use_opacity_depth==1){ + firealphanew[i] = (unsigned char)i; + } + else{ + int fire_alpha; + + fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); + firealphanew[i] = (unsigned char)fire_alpha; + } } } else{ for(i = 1; i<255; i++){ float soot_density, soot_opacity; - int soot_alpha, fire_alpha; + int soot_alpha; soot_density = -log(1.0-(float)i/254.0)/(base_extinct*base_dx); soot_opacity = 254.0*(1.0-exp(-new_extinct*new_dx*soot_density))+0.5; soot_alpha = CLAMP(soot_opacity+0.5, 0, 254); smokealphanew[i] = (unsigned char)soot_alpha; - fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); - firealphanew[i] = (unsigned char)fire_alpha; + if(use_opacity_depth == 1){ + firealphanew[i] = (unsigned char)i; + } + else{ + int fire_alpha; + + fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); + firealphanew[i] = (unsigned char)fire_alpha; + } } } } From 0694cc6fae678cded758fdb23d2c9d2d3f288b96 Mon Sep 17 00:00:00 2001 From: gforney Date: Wed, 21 Jan 2026 10:51:12 -0500 Subject: [PATCH 3/3] smokeview source: simplify InitAlphas routine --- Source/smokeview/IOsmoke.c | 49 +++++++++++++------------------------- 1 file changed, 16 insertions(+), 33 deletions(-) diff --git a/Source/smokeview/IOsmoke.c b/Source/smokeview/IOsmoke.c index 4e57355840..47fa248a17 100644 --- a/Source/smokeview/IOsmoke.c +++ b/Source/smokeview/IOsmoke.c @@ -1304,44 +1304,27 @@ void InitAlphas(unsigned char *smokealphanew, unsigned char *firealphanew, float return; } if(smoke3d_frame_inc != 1)new_dx *= (float)smoke3d_frame_inc; - if(use_smoke_density == 1){; - for(i = 1; i < 255; i++){ - float soot_density, soot_opacity; - int soot_alpha; + for(i = 1; i < 255; i++){ + float soot_density, soot_opacity; + int soot_alpha; + if(use_smoke_density == 1){; soot_density = maxval*(float)i/255.0; - soot_opacity = 254.0*(1.0 - exp(-new_extinct*new_dx*soot_density)); - soot_alpha = CLAMP(soot_opacity+0.5, 0, 254); - smokealphanew[i] = (unsigned char)soot_alpha; - if(use_opacity_depth==1){ - firealphanew[i] = (unsigned char)i; - } - else{ - int fire_alpha; - - fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); - firealphanew[i] = (unsigned char)fire_alpha; - } } - } - else{ - for(i = 1; i<255; i++){ - float soot_density, soot_opacity; - int soot_alpha; - + else{ soot_density = -log(1.0-(float)i/254.0)/(base_extinct*base_dx); - soot_opacity = 254.0*(1.0-exp(-new_extinct*new_dx*soot_density))+0.5; - soot_alpha = CLAMP(soot_opacity+0.5, 0, 254); - smokealphanew[i] = (unsigned char)soot_alpha; - if(use_opacity_depth == 1){ - firealphanew[i] = (unsigned char)i; - } - else{ - int fire_alpha; + } + soot_opacity = 254.0*(1.0 - exp(-new_extinct*new_dx*soot_density)); + soot_alpha = CLAMP(soot_opacity+0.5, 0, 254); + smokealphanew[i] = (unsigned char)soot_alpha; + if(use_opacity_depth==1){ + firealphanew[i] = (unsigned char)i; + } + else{ + int fire_alpha; - fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); - firealphanew[i] = (unsigned char)fire_alpha; - } + fire_alpha = CLAMP(emission_factor*soot_opacity+0.5, 0, 254); + firealphanew[i] = (unsigned char)fire_alpha; } } }