more enginiering

This commit is contained in:
tth 2022-04-05 05:46:51 +02:00
parent 15cb51c6bc
commit 0d79c3d7c7
5 changed files with 81 additions and 24 deletions

View File

@ -1,2 +1,4 @@
*.inc *.inc
*.err *.err
*.dat
*.log

View File

@ -13,21 +13,42 @@ fi
./voxelize > WS/voxels.dat ./voxelize > WS/voxels.dat
./vox2inc.awk < WS/voxels.dat > WS/voxels.inc ./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 do
dst=$(printf "frames/voxel/%05d.png" $idx) 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} \ povray -ishowvoxels.pov -K$idx ${POVOPT} \
-O${dst} 2> WS/toto.err -O${TMPNG} 2> WS/toto.err
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then
echo "ERROR ERROR ERROR ERROR" echo "ERROR ERROR ERROR ERROR"
tail -20 WS/toto.err tail -15 WS/toto.err
exit 1 sleep 20
#exit 1
fi 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 'Parse Time' WS/toto.err
grep 'Trace Time' WS/toto.err grep 'Trace Time' WS/toto.err
done done
./encode.sh frames/voxel/ foo.mp4 ./encode.sh frames/voxel/ voxel-1.mp4

View File

@ -7,7 +7,7 @@
#version 3.7; #version 3.7;
global_settings { global_settings {
ambient_light rgb <0.12, 0.04, 0.04> ambient_light rgb <0.04, 0.04, 0.04>
assumed_gamma 1.0 assumed_gamma 1.0
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
@ -17,32 +17,50 @@ global_settings {
#declare VOXEL = object #declare VOXEL = object
{ {
// sphere { 0, 1.18 } // sphere { 0, 1.18 }
#local D = 0.880; #local D = 1.38;
box { <-D, -D, -D>, <D, D, D> } box { <-D, -D, -D>, <D, D, D> }
} }
#include "WS/voxels.inc" #include "WS/voxels.inc"
object { object {
Voxels pigment { color White } Voxels
texture {
pigment { color White }
finish { phong 0.8 specular 0.8}
}
translate <-Bary_X, -Bary_Y, -Bary_Z> translate <-Bary_X, -Bary_Y, -Bary_Z>
rotate <40, 0, 29> rotate <clock*2, 0, clock*1.414>
} }
//---------------------------------------------------------------- //----------------------------------------------------------------
light_source { <-12, 45, -25> color Gray90 } // light_source { <-12, 45, -25> color Gray70 }
light_source { < 52, -5, 25> color Gray90 } 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 NormClock = (clock/360);
#declare XCAM = ECAM * sin(radians(clock));
#declare YCAM = -20; #declare ECAM = 88 - 23*NormClock;
#declare ZCAM = ECAM * cos(radians(clock)); #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 { camera {
location <XCAM, YCAM, ZCAM> location <XCAM, YCAM, ZCAM>
// look_at <Bary_X, Bary_Y, Bary_Z> // look_at <Bary_X, Bary_Y, Bary_Z>
look_at <0, 0, 0> look_at <0, 0, 0>
right x*image_width/image_height right x*image_width/image_height
angle 64 angle ACAM
} }
//---------------------------------------------------------------- //----------------------------------------------------------------

View File

@ -9,7 +9,7 @@ BEGIN {
print "union {" print "union {"
} }
$4 > 120 { $4 > 145 {
count = $4 count = $4
value = $5 value = $5
if (count > maxcount) if (count > maxcount)

View File

@ -10,7 +10,7 @@ program voxelize
integer, parameter :: DIM = 100 integer, parameter :: DIM = 100
integer, dimension(:,:,:), allocatable :: cube integer, dimension(:,:,:), allocatable :: cube
type(t_point3d), dimension(:), allocatable :: points type(t_point3d), dimension(:), allocatable :: points
integer :: errcode, foo, maxi integer :: errcode, foo
integer :: ix, iy, iz integer :: ix, iy, iz
double precision, dimension(4) :: coefs double precision, dimension(4) :: coefs
double precision :: dval double precision :: dval
@ -23,14 +23,14 @@ program voxelize
STOP " : NO ENOUGH MEMORY FOR CUBE" STOP " : NO ENOUGH MEMORY FOR CUBE"
endif endif
nbr_points = 3500000 nbr_points = 3100000
allocate(points(nbr_points), stat=errcode) allocate(points(nbr_points), stat=errcode)
if (0 .NE. errcode) then if (0 .NE. errcode) then
STOP " : NO ENOUGH MEMORY FOR POINTS" STOP " : NO ENOUGH MEMORY FOR POINTS"
endif endif
coefs(1) = 2.24 ; coefs(2) = 0.43 coefs(1) = 2.23 ; coefs(2) = 0.42
coefs(3) = -0.65 ; coefs(4) = -2.43 coefs(3) = -0.64 ; coefs(4) = -2.42
call compute_pickover(points, coefs) call compute_pickover(points, coefs)
call clear_cube(cube) call clear_cube(cube)
@ -46,7 +46,6 @@ program voxelize
enddo enddo
dval = DBLE(MAXVAL(cube)) dval = DBLE(MAXVAL(cube))
write(0, *) "--- cube maximum = ", dval write(0, *) "--- cube maximum = ", dval
do foo=1, nbr_points do foo=1, nbr_points
@ -78,7 +77,6 @@ subroutine fcoor2icoor(in, out)
end subroutine end subroutine
!----------------------------------------------------- !-----------------------------------------------------
subroutine clear_cube(cube) subroutine clear_cube(cube)
type(integer), dimension(:,:,:), intent(out) :: cube type(integer), dimension(:,:,:), intent(out) :: cube
@ -92,6 +90,24 @@ subroutine clear_cube(cube)
enddo enddo
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 subroutine
!----------------------------------------------------- !-----------------------------------------------------
end program voxelize end program voxelize