From 0d79c3d7c70d73b132a98dbe987918e37539ed0b Mon Sep 17 00:00:00 2001 From: tth Date: Tue, 5 Apr 2022 05:46:51 +0200 Subject: [PATCH] more enginiering --- Fraktalism/WS/.gitignore | 2 ++ Fraktalism/mkvoxvidz.sh | 33 ++++++++++++++++++++++++++------ Fraktalism/showvoxels.pov | 40 ++++++++++++++++++++++++++++----------- Fraktalism/vox2inc.awk | 2 +- Fraktalism/voxelize.f90 | 28 +++++++++++++++++++++------ 5 files changed, 81 insertions(+), 24 deletions(-) diff --git a/Fraktalism/WS/.gitignore b/Fraktalism/WS/.gitignore index 114e0a9..6f05766 100644 --- a/Fraktalism/WS/.gitignore +++ b/Fraktalism/WS/.gitignore @@ -1,2 +1,4 @@ *.inc *.err +*.dat +*.log diff --git a/Fraktalism/mkvoxvidz.sh b/Fraktalism/mkvoxvidz.sh index 85b2c14..0d80792 100755 --- a/Fraktalism/mkvoxvidz.sh +++ b/Fraktalism/mkvoxvidz.sh @@ -13,21 +13,42 @@ fi ./voxelize > WS/voxels.dat ./vox2inc.awk < WS/voxels.dat > WS/voxels.inc -for idx in $(seq 0 359) +TMPNG="/dev/shm/voxvidz.png" +NBIMG=360 +for idx in $( seq 0 $(( NBIMG - 1)) ) do dst=$(printf "frames/voxel/%05d.png" $idx) - echo "renderbox work on " $dst + delta=$( echo "scale=3 ; ${idx}/360" | bc -l) + echo "Renderbox work on " $dst " tu" $delta + povray -ishowvoxels.pov -K$idx ${POVOPT} \ - -O${dst} 2> WS/toto.err + -O${TMPNG} 2> WS/toto.err if [ $? -ne 0 ] ; then echo "ERROR ERROR ERROR ERROR" - tail -20 WS/toto.err - exit 1 + tail -15 WS/toto.err + sleep 20 + #exit 1 fi + + titre='>>> Voxelisation - tTh - avril 2022' + numbers=$(tail -1 WS/camvox.log | \ + awk '{printf ">>> %6.3f %6.3f %6.3f", $1, $2, $3}') + echo $numbers + + convert ${TMPNG} \ + -fill Cyan \ + -kerning 1 \ + -pointsize 16 \ + -font AvantGarde-Book \ + -gravity South-West \ + -annotate +20+32 "$titre" \ + -annotate +20+10 "$numbers" \ + $dst + grep 'Parse Time' WS/toto.err grep 'Trace Time' WS/toto.err done -./encode.sh frames/voxel/ foo.mp4 +./encode.sh frames/voxel/ voxel-1.mp4 diff --git a/Fraktalism/showvoxels.pov b/Fraktalism/showvoxels.pov index eb7bce7..241247c 100644 --- a/Fraktalism/showvoxels.pov +++ b/Fraktalism/showvoxels.pov @@ -7,7 +7,7 @@ #version 3.7; global_settings { - ambient_light rgb <0.12, 0.04, 0.04> + ambient_light rgb <0.04, 0.04, 0.04> assumed_gamma 1.0 } //---------------------------------------------------------------- @@ -17,32 +17,50 @@ global_settings { #declare VOXEL = object { // sphere { 0, 1.18 } -#local D = 0.880; +#local D = 1.38; box { <-D, -D, -D>, } } #include "WS/voxels.inc" object { - Voxels pigment { color White } + Voxels + texture { + pigment { color White } + finish { phong 0.8 specular 0.8} + } translate <-Bary_X, -Bary_Y, -Bary_Z> - rotate <40, 0, 29> + rotate } //---------------------------------------------------------------- -light_source { <-12, 45, -25> color Gray90 } -light_source { < 52, -5, 25> color Gray90 } +// light_source { <-12, 45, -25> color Gray70 } +light_source { <-52, 5, -38> color Yellow*0.55 } +light_source { < 59, 5, 48> color Gray20 } +light_source { < 3, -59, 8> color Red*0.75 } +light_source { < 8, 61, 3> color Green*0.85 } -#declare ECAM = 92; -#declare XCAM = ECAM * sin(radians(clock)); -#declare YCAM = -20; -#declare ZCAM = ECAM * cos(radians(clock)); +#declare NormClock = (clock/360); + +#declare ECAM = 88 - 23*NormClock; +#declare XCAM = ECAM * sin(radians(clock)); +#declare YCAM = -12; +#declare ZCAM = ECAM * cos(radians(clock)); +#declare ACAM = 65 + (27*NormClock); + +#if (0 = clock) + #fopen CL "WS/camvox.log" write +#else + #fopen CL "WS/camvox.log" append +#end +#write (CL, NormClock, " ", ECAM, " ", ACAM, "\n") +#fclose CL camera { location // look_at look_at <0, 0, 0> right x*image_width/image_height - angle 64 + angle ACAM } //---------------------------------------------------------------- diff --git a/Fraktalism/vox2inc.awk b/Fraktalism/vox2inc.awk index cdb1cfe..b04f654 100755 --- a/Fraktalism/vox2inc.awk +++ b/Fraktalism/vox2inc.awk @@ -9,7 +9,7 @@ BEGIN { print "union {" } -$4 > 120 { +$4 > 145 { count = $4 value = $5 if (count > maxcount) diff --git a/Fraktalism/voxelize.f90 b/Fraktalism/voxelize.f90 index a5cc863..2969926 100644 --- a/Fraktalism/voxelize.f90 +++ b/Fraktalism/voxelize.f90 @@ -10,7 +10,7 @@ program voxelize integer, parameter :: DIM = 100 integer, dimension(:,:,:), allocatable :: cube type(t_point3d), dimension(:), allocatable :: points - integer :: errcode, foo, maxi + integer :: errcode, foo integer :: ix, iy, iz double precision, dimension(4) :: coefs double precision :: dval @@ -23,14 +23,14 @@ program voxelize STOP " : NO ENOUGH MEMORY FOR CUBE" endif - nbr_points = 3500000 + nbr_points = 3100000 allocate(points(nbr_points), stat=errcode) if (0 .NE. errcode) then STOP " : NO ENOUGH MEMORY FOR POINTS" endif - coefs(1) = 2.24 ; coefs(2) = 0.43 - coefs(3) = -0.65 ; coefs(4) = -2.43 + coefs(1) = 2.23 ; coefs(2) = 0.42 + coefs(3) = -0.64 ; coefs(4) = -2.42 call compute_pickover(points, coefs) call clear_cube(cube) @@ -46,7 +46,6 @@ program voxelize enddo dval = DBLE(MAXVAL(cube)) - write(0, *) "--- cube maximum = ", dval do foo=1, nbr_points @@ -78,7 +77,6 @@ subroutine fcoor2icoor(in, out) end subroutine !----------------------------------------------------- - subroutine clear_cube(cube) type(integer), dimension(:,:,:), intent(out) :: cube @@ -92,6 +90,24 @@ subroutine clear_cube(cube) enddo enddo +end subroutine +!----------------------------------------------------- +subroutine spit_cube_as_union(fname, datas, notused) + character(*) :: fname + type(integer), dimension(:,:,:), intent(in) :: datas + integer :: notused + + integer :: fd, errcode, foo + + open (newunit=fd, file='WS/k-pick.txt', & + status='unknown', position='append', & + action='write', iostat=errcode) + if (0 .NE. errcode) then + STOP ' : SPITUNION : FAIL OPEN OUTPUT FILE' + endif + + close(fd) + end subroutine !----------------------------------------------------- end program voxelize