first running version

This commit is contained in:
Tonton Th 2024-12-15 17:53:42 +01:00
parent b558550493
commit 61cf91f92d
10 changed files with 278 additions and 0 deletions

5
.gitignore vendored
View File

@ -1,3 +1,8 @@
frames/*
datas/*.xcf
WS/timing
*.png
*.gif

16
Makefile Normal file
View File

@ -0,0 +1,16 @@
POVOPT = +q9 +a -d -W1024 -H768
POVDEP = contexte.inc elements.inc datas/hf.png
PNG: essai.png scene.png
essai.png: essai.pov Makefile $(POVDEP)
povray $(POVOPT) -i$< -o$@
scene.png: scene.pov Makefile $(POVDEP)
povray $(POVOPT) +K166 -i$< -o$@

View File

@ -0,0 +1,3 @@
workspace

34
contexte.inc Normal file
View File

@ -0,0 +1,34 @@
/*
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
// plane { y, 0 pigment { color DarkGreen } }
height_field {
png "datas/hf.png"
smooth
texture {
pigment { DarkGreen }
finish { phong 0.333 }
}
translate <-.5, 0, -.5>
scale <18, 0.85, 18>
}
#if (0)
cylinder { 0, <1, 0, 0>, 0.008 pigment { color Red } }
cylinder { 0, <0, 0, 1>, 0.008 pigment { color Blue } }
#end
light_source {
<2, 2.50, 3> color White
spotlight
radius 12
falloff 20
tightness 10
point_at <0, 0.95, 0.22222222>
}
// light_source { <-6, 7, -4>, rgb <0.81, 0.65, 0.40> }

4
datas/README.md Normal file
View File

@ -0,0 +1,4 @@
statics datas, like height-fields files...

87
elements.inc Normal file
View File

@ -0,0 +1,87 @@
/*
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
#declare HexaCone_shape = object
{
#local RA = 0.125;
#local RB = 0.001;
union {
cone { 0, RA, <-1, 0, 0>, RB }
cone { 0, RA, < 1, 0, 0>, RB }
cone { 0, RA, < 0, 0, 1>, RB }
cone { 0, RA, < 0, 0, -1>, RB }
cone { 0, RA, < 0, 1, 0>, RB }
cone { 0, RA, < 0, -1, 0>, RB }
}
}
#declare HexaCone_body = object
{
union {
difference {
object { HexaCone_shape }
object { HexaCone_shape scale 0.99 }
sphere {0, 0.24 }
cylinder { <-1, 0, 0.55>, <1, 0, 0.55>,
RA*0.40 }
}
difference {
sphere {0, 0.20 }
sphere {0, 0.18 }
cylinder {-x, x, 0.10 }
cylinder {-y, y, 0.10 }
cylinder {-z, z, 0.10 }
}
light_source { 0, rgb <0.99, 0.05, 0.05> }
}
texture { New_Penny }
}
/*
*
*/
#declare HexaCone_radar = object
{
union {
#for (foo, 0, 360, 60)
#local RR = 0.16;
#local PX = RR * sin(radians(foo));
#local PZ = RR * cos(radians(foo));
sphere { 0, 0.008
scale <1, 1.37, 1>
translate <PX, 0, PZ>
}
cylinder { -0.11*y, <PX, 0, PZ>, 0.003 }
#end
}
texture { PinkAlabaster scale 8 }
}
#declare HexaCone_head = object
{
#local DTa = 0.278;
#local DTb = 0.030;
merge {
difference {
torus { DTa, DTb }
#local TB = 0.50;
box { <-TB, -TB, TB>, <TB, TB, 0> }
}
sphere { 0, DTb*1.55 translate -DTa*x }
sphere { 0, DTb*1.55 translate DTa*x }
}
texture { Orange_Glass }
}
#declare HexaCone = object
{
union {
object { HexaCone_body }
#local T = 0.55;
object { HexaCone_head translate <0, 0, T+DTa> }
object { HexaCone_radar translate <0, T+0.07, 0> }
}
rotate <-7, 0, -9>
}

22
essai.pov Normal file
View File

@ -0,0 +1,22 @@
/*
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
#version 3.7;
global_settings {
assumed_gamma 1.0
}
#include "colors.inc"
#include "textures.inc"
#include "elements.inc"
#include "contexte.inc"
object { HexaCone_radar translate y*0.6 }
camera {
location <-3, 2, 1>
look_at <0, 0.6, 0>
angle 10
}

25
fonctions.sh Normal file
View File

@ -0,0 +1,25 @@
set -eu
ff_encodage()
{
ffmpeg -nostdin \
-y -r 30 -f image2 -i frames/%05d.png \
-metadata artist='--[ tTh ]--' \
-metadata title='-- HexaCone --' \
-c:v libx264 \
-pix_fmt yuv420p \
-tune film \
wip.mp4
}
mp_encodage()
{
mencoder 'mf://frames/*.png' \
-mf \
fps=30 \
-ovc lavc \
-lavcopts vcodec=mpeg4 \
-o output.avi
}

47
mkloop.sh Executable file
View File

@ -0,0 +1,47 @@
#!/bin/bash
source fonctions.sh
set -e ; set -u
TYPE="gif89a"
NBFRAMES=180
case $TYPE in
"gif89a") DIMS="-W640 -H400" ;;
"mp4") DIMS="-W1280 -H1024" ;;
esac
POVOPT="+q9 +a -d ${DIMS}"
echo $POVOPT ; echo ; sleep 2
TMPIMG=/dev/shm/tmpimg.png
for frame in $(seq 0 $((NBFRAMES-1)))
do
img=$(printf "frames/%05d.png" $frame)
debut=$(date +%s)
povray ${POVOPT} +K${frame} -iscene.pov -o${TMPIMG}
txt=$(printf "#%03d" $frame)
echo $frame $img $txt
convert ${TMPIMG} \
-pointsize 14 \
-fill white \
-gravity south \
-annotate +0+0 "$txt" \
${img}
fin=$(date +%s)
echo
echo $frame $(( fin - debut )) | tee -a WS/timing
echo ; echo
done
echo
case $TYPE in
"gif89a") convert -delay 8 -dither none \
-colors 102 frames/* foo.gif ;;
esac
ls -lh foo.gif

35
scene.pov Normal file
View File

@ -0,0 +1,35 @@
/*
* nouveau projet Thu Dec 5 11:37:05 AM UTC 2024
*/
#version 3.7;
global_settings {
assumed_gamma 1.0
}
#include "colors.inc"
#include "textures.inc"
#include "elements.inc"
#include "contexte.inc"
object { HexaCone translate y*1.15 }
#declare CK = 56 + (clock * 2);
#declare Dcam = 1.95;
#declare CamX = Dcam * sin(radians(CK));
#declare CamZ = Dcam * 1.23 * cos(radians(CK));
#declare CamZ = CamZ - 0.9;
#declare Lat = <0.03, 1.08, 0.22>;
camera {
location <CamX, 1.20, CamZ>
look_at Lat
focal_point Lat
aperture 0.06
blur_samples 33
angle 70
}
light_source { <CamX*1.3, 1.35, 2+(CamZ*1.3)>,
rgb <0.47, 0.65, 0.49> }