From 61cf91f92dbd02055eb09deb9ec454ae0c8112e8 Mon Sep 17 00:00:00 2001 From: Tonton Th Date: Sun, 15 Dec 2024 17:53:42 +0100 Subject: [PATCH] first running version --- .gitignore | 5 +++ Makefile | 16 +++++++++ WS/README.md | 3 ++ contexte.inc | 34 +++++++++++++++++++ datas/README.md | 4 +++ elements.inc | 87 +++++++++++++++++++++++++++++++++++++++++++++++++ essai.pov | 22 +++++++++++++ fonctions.sh | 25 ++++++++++++++ mkloop.sh | 47 ++++++++++++++++++++++++++ scene.pov | 35 ++++++++++++++++++++ 10 files changed, 278 insertions(+) create mode 100644 Makefile create mode 100644 contexte.inc create mode 100644 datas/README.md create mode 100644 elements.inc create mode 100644 essai.pov create mode 100644 fonctions.sh create mode 100755 mkloop.sh create mode 100644 scene.pov diff --git a/.gitignore b/.gitignore index 2f4572d..04f0240 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ frames/* +datas/*.xcf +WS/timing + +*.png +*.gif diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d44b505 --- /dev/null +++ b/Makefile @@ -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$@ + + diff --git a/WS/README.md b/WS/README.md index e69de29..a8ce2f9 100644 --- a/WS/README.md +++ b/WS/README.md @@ -0,0 +1,3 @@ + + +workspace diff --git a/contexte.inc b/contexte.inc new file mode 100644 index 0000000..9422466 --- /dev/null +++ b/contexte.inc @@ -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> } diff --git a/datas/README.md b/datas/README.md new file mode 100644 index 0000000..e5ce029 --- /dev/null +++ b/datas/README.md @@ -0,0 +1,4 @@ + + +statics datas, like height-fields files... + diff --git a/elements.inc b/elements.inc new file mode 100644 index 0000000..cec4b30 --- /dev/null +++ b/elements.inc @@ -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 + } + cylinder { -0.11*y, , 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>, } + } + 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> +} diff --git a/essai.pov b/essai.pov new file mode 100644 index 0000000..1c02acd --- /dev/null +++ b/essai.pov @@ -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 + } diff --git a/fonctions.sh b/fonctions.sh new file mode 100644 index 0000000..565fce1 --- /dev/null +++ b/fonctions.sh @@ -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 +} + diff --git a/mkloop.sh b/mkloop.sh new file mode 100755 index 0000000..be65b1c --- /dev/null +++ b/mkloop.sh @@ -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 + diff --git a/scene.pov b/scene.pov new file mode 100644 index 0000000..adf3523 --- /dev/null +++ b/scene.pov @@ -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 + look_at Lat + focal_point Lat + aperture 0.06 + blur_samples 33 + angle 70 + } + +light_source { , + rgb <0.47, 0.65, 0.49> }