big refactoring: step 1

This commit is contained in:
Tonton Th 2024-12-29 04:56:10 +01:00
parent adf59ceff6
commit 090981d84c
13 changed files with 150 additions and 63 deletions

View File

@ -1,12 +1,16 @@
POVOPT = +q9 +a0.02 -d POVOPT = +q9 +a0.02 -d
POVDEP = contexte.inc elements.inc datas/hf.png POVDEP = contexte.inc elements.inc \
globals.inc datas/hf.png
PNG: essai.png scene.png PNG: essai.png scene.png topview.png
topview.png: topview.pov Makefile $(POVDEP)
povray $(POVOPT) -K200 -W1280 -H1024 -i$< -o$@
essai.png: essai.pov Makefile $(POVDEP) essai.png: essai.pov Makefile $(POVDEP)
povray $(POVOPT) -W800 -H600 -i$< -o$@ povray $(POVOPT) -W800 -H600 -i$< -o$@

View File

@ -2,6 +2,43 @@
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024 * nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/ */
#declare Rng2 = seed(now*24*60*60);
#declare foo = rand(Rng2);
/* ------------------------------------------------------------ */
#declare Rhxba = 0.30;
#declare R2hxba = Rhxba * 0.48;
#declare HexaBalls = object
{
merge {
sphere { 0, Rhxba }
#local E = Rhxba * 1.260;
sphere { 0, R2hxba translate <-E, 0, 0> }
sphere { 0, R2hxba translate < E, 0, 0> }
sphere { 0, R2hxba translate < 0, -E, 0> }
sphere { 0, R2hxba translate < 0, E, 0> }
sphere { 0, R2hxba translate < 0, 0, -E> }
sphere { 0, R2hxba translate < 0, 0, E> }
}
}
object { HexaBalls
texture { Lightning1 scale 0.33 }
rotate <clock/3, clock/6, clock/9>
translate <3, 0.72, 5>
}
object { HexaBalls
texture { Lightning2 scale 0.33 }
rotate <-clock, clock*0.62, clock>
translate <5, 0.92, -4>
}
/* ------------------------------------------------------------ */
height_field { height_field {
png "datas/hf.png" png "datas/hf.png"
smooth smooth
@ -44,15 +81,15 @@ light_source {
#if (1) #if (1)
light_source { light_source {
<-5, 5.50, 8> <-5, 5.60, 8>
#if ( (clock > 290) & (clock<344) ) #if ( (clock > 290) & (clock<344) )
#local Couleur = rgb <0.20, 0.20, 0.80>; #local Couleur = rgb <0.20, 0.20, 0.90>;
#else #else
#local Couleur = rgb <0.80, 0.80, 0.70>; #local Couleur = rgb <0.80, 0.80, 0.70>;
#end #end
color Couleur color Couleur
spotlight spotlight
radius 8 radius 9
falloff 10 falloff 10
tightness 5 tightness 5
point_at <0, 0.95, -0.22> point_at <0, 0.95, -0.22>

View File

@ -35,11 +35,11 @@ union {
} }
// clignotement de la lumiere \o/ // clignotement de la lumiere \o/
#local kR = 0.083; #local kR = 0.083;
#local xR = (rand(R2)-0.5000) * kR; #local xR = (rand(Rng2)-0.5000) * kR;
#local yR = (rand(R2)-0.5000) * kR; #local yR = (rand(Rng2)-0.5000) * kR;
#local zR = (rand(R2)-0.5000) * kR; #local zR = (rand(Rng2)-0.5000) * kR;
#local Red = abs(sin(NormClock * 65.536)); #local Red = abs(sin(NormClock * 55.536));
#local Red = Red * rand(R2); #local Red = Red * rand(Rng2);
light_source { <xR, yR, xR>, rgb <Red, 0.03, 0.03> light_source { <xR, yR, xR>, rgb <Red, 0.03, 0.03>
fade_distance 0.99 fade_distance 0.99
fade_power 1.58 fade_power 1.58
@ -198,7 +198,7 @@ texture { T_Brass_1C }
{ {
union { union {
object { Tuyere } object { Tuyere }
object { Le_rotor rotate x*(clock*3) translate -0.08*x } object { Le_rotor rotate x*(clock*3.8) translate -0.06*x }
} }
} }
@ -225,5 +225,5 @@ union {
object { HexaCone_derives translate <0, 0, -0.67> } object { HexaCone_derives translate <0, 0, -0.67> }
object { Les_Reacteurs translate -0.18*y } object { Les_Reacteurs translate -0.18*y }
} }
rotate <-3, 0, -4> rotate < 3, 0, -4>
} }

View File

@ -2,4 +2,4 @@
source ./fonctions.sh source ./fonctions.sh
ff_encodage ff_encodage essai wip.mp4

View File

@ -1,17 +1,11 @@
/* /*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024 * nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/ */
#version 3.7; #version 3.7;
global_settings { #include "globals.inc"
assumed_gamma 1.0
ambient_light 0
max_trace_level 10
}
#declare R2 = seed(clock);
#declare foo = rand(R2);
#include "colors.inc" #include "colors.inc"
#include "metals.inc" #include "metals.inc"
@ -23,16 +17,21 @@ global_settings {
// ======================================================= // =======================================================
// =======================================================
object { HexaBalls
#local SC = 0.10 + abs(sin(NormClock * 3.14159));
texture { Lightning2 scale SC }
translate <0, 1, 0> }
// ======================================================= // =======================================================
object { Reacteur translate <0, 1, 0> } light_source { <-6, 7, -5>, rgb <0.81, 0.65, NormClock> }
light_source { <-6, 7, 5>, rgb <0.31, NormClock, 0.80> }
light_source { <-6, 7, -4>, rgb <0.81, 0.65, 0.40> } light_source { < 6, 7, 4>, rgb <1-NormClock, 0.28, 0.80> }
light_source { <-6, 7, 4>, rgb <0.31, 0.65, 0.80> }
camera { camera {
location <-0.91, 1.01, 0.20> location <-1.20, 1.81, 1.59>
look_at <0, 1.0, 0> look_at <0, 1.0, 0>
angle 32 angle 90
} }

View File

@ -3,14 +3,20 @@ set -eu
ff_encodage() ff_encodage()
{ {
SRCDIR="$1"
FILMNAME="$2"
ffmpeg -nostdin \ ffmpeg -nostdin \
-y -r 30 -f image2 -i frames/%05d.png \ -y -r 30 -f image2 -i frames/${SRCDIR}/%05d.png \
-metadata artist='--[ tTh ]--' \ -metadata artist='--[ tTh ]--' \
-metadata title='-- HexaCone --' \ -metadata title='-- HexaCone --' \
-c:v libx264 \ -c:v libx264 \
-pix_fmt yuv420p \ -pix_fmt yuv420p \
-tune film \ -tune film \
wip.mp4 $FILMNAME
echo "$SRCDIR encoded to $FILNAME" | tee -a WS/log
wc -c full.mp4 | tee -a WS/log
} }
mp_encodage() mp_encodage()

6
globals.inc Normal file
View File

@ -0,0 +1,6 @@
global_settings {
assumed_gamma 1.0
ambient_light rgb <0.18, 0.14, 0.17>
max_trace_level 10
}

37
linkfarmer.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
set -e ; set -u
source ./fonctions.sh
IDX=0
SPOOL="frames/Spool"
linkfarm ()
{
SRC="frames/$1"
echo "linkfarm $SRC" | tee -a WS/log
for src in "$SRC"/*
do
dstname=$(printf "%s/%05d.png" $SPOOL $IDX)
echo "$src -> $dstname"
# ln --force --symbolic $src $dstname
cp -f $src $dstname
IDX=$(( IDX + 1 ))
done
sync
}
linkfarm topview
linkfarm passage
linkfarm scene
linkfarm essai
ff_encodage Spool full.mp4

View File

@ -5,27 +5,28 @@ source fonctions.sh
set -e ; set -u set -e ; set -u
TYPE="mp4" TYPE="mp4"
SEQNAME="$1"
NBFRAMES=360 NBFRAMES=360
case $TYPE in case $TYPE in
"gif89a") DIMS="-W640 -H480" ;; "gif89a") DIMS="-W640 -H480" ;;
"mp4") DIMS="-W1024 -H768" ;; "mp4") DIMS="-W1024 -H768" ;;
esac esac
POVOPT="+q9 +a0.02 -d ${DIMS} -WT8" POVOPT="+q9 +a0.02 -d ${DIMS} -WT6"
echo $POVOPT ; echo ; sleep 2 echo $POVOPT ; echo ; sleep 2
TMPIMG=/dev/shm/tmpimg.png TMPIMG=/dev/shm/${SEQNAME}-tmp.png
for frame in $(seq 0 $((NBFRAMES-1))) for frame in $(seq 0 $((NBFRAMES-1)))
do do
img=$(printf "frames/%05d.png" $frame) img=$(printf "frames/%s/%05d.png" $SEQNAME $frame)
debut=$(date +%s) debut=$(date +%s)
set +e set +e
povray ${POVOPT} +K${frame} -iscene.pov -o${TMPIMG} povray ${POVOPT} +K${frame} -i${SEQNAME}.pov -o${TMPIMG}
err=$? err=$?
if [ $err != 0 ] ; then if [ $err != 0 ] ; then
echo "fail $frame" >> WS/log echo "$SEQNAME fail $frame" >> WS/log
sleep 4 sleep 4
continue continue
fi fi
@ -33,7 +34,7 @@ do
txt=$(printf "#%03d" $frame) txt=$(printf "#%03d" $frame)
echo $frame $img $txt echo $frame $img $txt
convert ${TMPIMG} \ convert ${TMPIMG} \
-pointsize 24 \ -pointsize 16 \
-fill orange \ -fill orange \
-gravity south \ -gravity south \
-annotate +0+0 "$txt" \ -annotate +0+0 "$txt" \
@ -49,7 +50,5 @@ echo
case $TYPE in case $TYPE in
"gif89a") convert -delay 8 -dither none \ "gif89a") convert -delay 8 -dither none \
-colors 102 frames/* foo.gif ;; -colors 102 frames/* foo.gif ;;
"mp4") ff_encodage ;; "mp4") ff_encodage $SEQNAME wip-${SEQNAME}.mp4 ;;
esac esac
ls -lh foo.gif

View File

@ -1,4 +1,5 @@
/* /*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024 * nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/ */
@ -17,17 +18,17 @@
// --------------------------------------- // ---------------------------------------
#declare PosX = 0; #declare PosX = 0;
#declare PosY = 1.40; #declare PosY = 1.20 + (NormClock*0.20);
#declare PosZ = (NormClock-0.5) * 7.54; #declare PosZ = (NormClock-0.5) * 8.44;
object { HexaCone translate <PosX, PosY, PosZ> } object { HexaCone translate <PosX, PosY, PosZ> }
camera { camera {
location <-2, 1.23, 9> location <-1.50, 1.23, 9>
look_at <PosX, 1.50, PosZ> look_at <PosX, 1.50, PosZ>
// focal_point <0, 1, 0> // focal_point <0, 1, 0>
// aperture 0.046 // aperture 0.046
// blur_samples 30 // blur_samples 30
angle 40 + (NormClock * 22) angle 36
} }

View File

@ -18,14 +18,13 @@ BEGIN { \
count[$1]++; \ count[$1]++; \
if (mini[$1] > $2) mini[$1] = $2; \ if (mini[$1] > $2) mini[$1] = $2; \
if (maxi[$1] < $2) maxi[$1] = $2; \ if (maxi[$1] < $2) maxi[$1] = $2; \
last[$1] = $2; \
} \ } \
END { \ END { \
for (foo=0; foo<nbrames; foo++) { \ for (foo=0; foo<nbrames; foo++) { \
if (count[foo] > 0) { \ if (count[foo] > 0) { \
mean = accu[foo] / count[foo]; \ mean = accu[foo] / count[foo]; \
printf "%4d %4f %4d %4d %4d\n", foo, mean, \ printf "%4d %4f %4d %4d\n", foo, mean, \
mini[foo], maxi[foo], last[foo]; \ mini[foo], maxi[foo]; \
} \ } \
} }
} \ } \
@ -40,8 +39,7 @@ gnuplot << __EOC__
set title "HexaCone : temps de tracé vs. numéro de séquence" set title "HexaCone : temps de tracé vs. numéro de séquence"
set xlabel "numéro de la trame" set xlabel "numéro de la trame"
set ylabel "temps en secondes" set ylabel "temps en secondes"
plot "/dev/shm/plot-timing.tmp" u 1:2 w l t "moyenne", \ plot "/dev/shm/plot-timing.tmp" u 1:4 w l t "maximum", \
"/dev/shm/plot-timing.tmp" u 1:3 w l t "minimum", \ "/dev/shm/plot-timing.tmp" u 1:3 w l t "minimum", \
"/dev/shm/plot-timing.tmp" u 1:4 w l t "maximum", \ "/dev/shm/plot-timing.tmp" u 1:2 w l t "moyenne",
"/dev/shm/plot-timing.tmp" u 1:5 w l t "dernier"
__EOC__ __EOC__

View File

@ -1,22 +1,16 @@
/* /*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024 * nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/ */
#version 3.7; #version 3.7;
global_settings { #include "globals.inc"
assumed_gamma 1.0
ambient_light rgb <0.04, 0.07, 0.04>
max_trace_level 10
}
#include "colors.inc" #include "colors.inc"
#include "metals.inc" #include "metals.inc"
#include "textures.inc" #include "textures.inc"
#declare R2 = seed(now*24*60*60);
#declare foo = rand(R2);
#declare NormClock = clock / 360.0; #declare NormClock = clock / 360.0;
#include "contexte.inc" #include "contexte.inc"
#include "elements.inc" #include "elements.inc"

View File

@ -1,4 +1,5 @@
/* /*
* H E X A C O N E
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024 * nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/ */
@ -16,7 +17,12 @@
light_source { <-16, 17, -24>, rgb <0.51, 0.65, 0.40> } light_source { <-16, 17, -24>, rgb <0.51, 0.65, 0.40> }
object { HexaCone rotate y*clock translate y*1.11 } #declare TrX = 2 * sqrt(NormClock);
#declare TrY = 1.11 + (5 * sqrt(NormClock));
#declare TrZ = 3 * sqrt(NormClock);
#declare TrH = <TrX, TrY, TrZ>;
object { HexaCone translate TrH }
camera { camera {
location <-3.60, 19.60-NormClock, 21.09> location <-3.60, 19.60-NormClock, 21.09>