Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ALICE-open-data
ALICE Blender animation
Commits
fac34c19
Commit
fac34c19
authored
Apr 28, 2020
by
Breno Rilho Lemos
💬
Browse files
Spell 'transparency' correctly
parent
c72b8eaf
Changes
4
Hide whitespace changes
Inline
Side-by-side
animate/animate_particles.py
View file @
fac34c19
...
...
@@ -2,7 +2,7 @@
# animate_particles.py - Animate HEP events
#
# For console only rendering (example):
# $ blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -camera="BarrelCamera" -datafile="esd-detail.dat" -n_event=0 -simulated_t=0.02 -fps=24 -resolution=100 -transp
e
rency=1.2 -stamp_note="Texto no canto" -its=1 -tpc=0 -trd=1 -emcal=0
# $ blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -camera="BarrelCamera" -datafile="esd-detail.dat" -n_event=0 -simulated_t=0.02 -fps=24 -resolution=100 -transp
a
rency=1.2 -stamp_note="Texto no canto" -its=1 -tpc=0 -trd=1 -emcal=0
#
import
os
...
...
@@ -35,7 +35,7 @@ parser.add_argument('-fps','--fps')
parser
.
add_argument
(
'-resolution'
,
'--resolution_percent'
)
parser
.
add_argument
(
'-stamp_note'
,
'--stamp_note'
)
parser
.
add_argument
(
'-n_event'
,
'--n_event'
)
parser
.
add_argument
(
'-transp
e
rency'
,
'--transp_par'
)
parser
.
add_argument
(
'-transp
a
rency'
,
'--transp_par'
)
parser
.
add_argument
(
'-its'
,
'--its'
)
parser
.
add_argument
(
'-tpc'
,
'--tpc'
)
parser
.
add_argument
(
'-trd'
,
'--trd'
)
...
...
animate/blender_functions.py
View file @
fac34c19
...
...
@@ -11,12 +11,12 @@ def subtract(that,fromThat):
bpy
.
data
.
objects
[
that
.
name
].
select
=
True
bpy
.
ops
.
object
.
delete
()
def
createMaterial
(
name
,
R
,
G
,
B
,
shadows
,
cast_shadows
,
transp
e
rency
,
alpha
,
emit
,
specular_alpha
,
fresnel_factor
,
fresnel
):
def
createMaterial
(
name
,
R
,
G
,
B
,
shadows
,
cast_shadows
,
transp
a
rency
,
alpha
,
emit
,
specular_alpha
,
fresnel_factor
,
fresnel
):
bpy
.
data
.
materials
.
new
(
name
=
name
)
bpy
.
data
.
materials
[
name
].
diffuse_color
=
(
R
,
G
,
B
)
bpy
.
data
.
materials
[
name
].
use_shadows
=
shadows
bpy
.
data
.
materials
[
name
].
use_cast_shadows
=
cast_shadows
bpy
.
data
.
materials
[
name
].
use_transparency
=
transp
e
rency
bpy
.
data
.
materials
[
name
].
use_transparency
=
transp
a
rency
bpy
.
data
.
materials
[
name
].
alpha
=
alpha
bpy
.
data
.
materials
[
name
].
emit
=
emit
bpy
.
data
.
materials
[
name
].
specular_alpha
=
specular_alpha
...
...
animate/scene_functions.py
View file @
fac34c19
...
...
@@ -49,7 +49,7 @@ def addALICE_Geometry(bright_colors=True, transp_par=1.0, detectors=[1,1,1,1]):
# ADD ITS INNER BARREL
# Material
createMaterial
(
"innerITS"
,
R
=
rgb_v
[
2
],
G
=
0
,
B
=
rgb_v
[
2
],
shadows
=
False
,
cast_shadows
=
False
,
transp
e
rency
=
True
,
alpha
=
transp_par
*
0.7
,
emit
=
0
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
createMaterial
(
"innerITS"
,
R
=
rgb_v
[
2
],
G
=
0
,
B
=
rgb_v
[
2
],
shadows
=
False
,
cast_shadows
=
False
,
transp
a
rency
=
True
,
alpha
=
transp_par
*
0.7
,
emit
=
0
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
# Add Inner ITS
bpy
.
ops
.
mesh
.
primitive_cylinder_add
(
radius
=
0.0421
,
depth
=
0.271
,
view_align
=
False
,
enter_editmode
=
False
,
location
=
(
0
,
0
,
0
))
...
...
@@ -64,7 +64,7 @@ def addALICE_Geometry(bright_colors=True, transp_par=1.0, detectors=[1,1,1,1]):
# ADD ITS OUTER BARREL
# Material
createMaterial
(
"outerITS"
,
R
=
rgb_v
[
3
],
G
=
0
,
B
=
rgb_v
[
3
],
shadows
=
False
,
cast_shadows
=
False
,
transp
e
rency
=
True
,
alpha
=
transp_par
*
0.4
,
emit
=
0.8
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
createMaterial
(
"outerITS"
,
R
=
rgb_v
[
3
],
G
=
0
,
B
=
rgb_v
[
3
],
shadows
=
False
,
cast_shadows
=
False
,
transp
a
rency
=
True
,
alpha
=
transp_par
*
0.4
,
emit
=
0.8
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
# ADD ITS MIDDLE LAYERS
...
...
@@ -114,7 +114,7 @@ def addALICE_Geometry(bright_colors=True, transp_par=1.0, detectors=[1,1,1,1]):
if
detectors
[
1
]:
# Material
createMaterial
(
"tpc"
,
R
=
0
,
G
=
rgb_v
[
0
],
B
=
0
,
shadows
=
False
,
cast_shadows
=
False
,
transp
e
rency
=
True
,
alpha
=
transp_par
*
0.2
,
emit
=
0.3
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
createMaterial
(
"tpc"
,
R
=
0
,
G
=
rgb_v
[
0
],
B
=
0
,
shadows
=
False
,
cast_shadows
=
False
,
transp
a
rency
=
True
,
alpha
=
transp_par
*
0.2
,
emit
=
0.3
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
# Add TPC
bpy
.
ops
.
mesh
.
primitive_cylinder_add
(
radius
=
2.461
,
depth
=
5.1
,
view_align
=
False
,
enter_editmode
=
False
,
location
=
(
0
,
0
,
0
))
#bigger cylinder
...
...
@@ -129,7 +129,7 @@ def addALICE_Geometry(bright_colors=True, transp_par=1.0, detectors=[1,1,1,1]):
if
detectors
[
2
]:
# Material
createMaterial
(
"TRD"
,
R
=
rgb_v
[
3
],
G
=
0
,
B
=
rgb_v
[
3
],
shadows
=
False
,
cast_shadows
=
False
,
transp
e
rency
=
True
,
alpha
=
transp_par
*
0.15
,
emit
=
0.8
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
createMaterial
(
"TRD"
,
R
=
rgb_v
[
3
],
G
=
0
,
B
=
rgb_v
[
3
],
shadows
=
False
,
cast_shadows
=
False
,
transp
a
rency
=
True
,
alpha
=
transp_par
*
0.15
,
emit
=
0.8
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
# Add "hole" to subtract from the middle
bpy
.
ops
.
mesh
.
primitive_cylinder_add
(
radius
=
2.9
,
depth
=
6
,
vertices
=
18
,
view_align
=
False
,
enter_editmode
=
False
,
location
=
(
0
,
0
,
0
))
#smaller cylinder
...
...
@@ -184,7 +184,7 @@ def addALICE_Geometry(bright_colors=True, transp_par=1.0, detectors=[1,1,1,1]):
if
detectors
[
3
]:
# Material
createMaterial
(
"emcal"
,
R
=
rgb_v
[
1
],
G
=
rgb_v
[
1
],
B
=
0
,
shadows
=
False
,
cast_shadows
=
False
,
transp
e
rency
=
True
,
alpha
=
transp_par
*
0.05
,
emit
=
1.5
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
createMaterial
(
"emcal"
,
R
=
rgb_v
[
1
],
G
=
rgb_v
[
1
],
B
=
0
,
shadows
=
False
,
cast_shadows
=
False
,
transp
a
rency
=
True
,
alpha
=
transp_par
*
0.05
,
emit
=
1.5
,
specular_alpha
=
0
,
fresnel_factor
=
5
,
fresnel
=
0.3
)
# Add cylinder for EMCal
bpy
.
ops
.
mesh
.
primitive_cylinder_add
(
radius
=
4.7
,
depth
=
5.1
,
vertices
=
19
,
view_align
=
False
,
enter_editmode
=
False
,
location
=
(
0
,
0
,
0
))
...
...
workflow_sketch.sh
View file @
fac34c19
...
...
@@ -34,7 +34,7 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
fi
OPTIONS
=
c:hdau:m:n:t:r:
LONGOPTS
=
camera:,resolution:,fps:,transp
e
rency:,duration:,maxparticles:,minparticles:,numberofevents:,minavgpz:,help,download,sample,url:,its,tpc,trd,emcal
LONGOPTS
=
camera:,resolution:,fps:,transp
a
rency:,duration:,maxparticles:,minparticles:,numberofevents:,minavgpz:,help,download,sample,url:,its,tpc,trd,emcal
# -regarding ! and PIPESTATUS see above
# -temporarily store output to be able to check for errors
...
...
@@ -56,7 +56,7 @@ CAMERA=Overview
DURATION
=
10
RESOLUTION
=
100
FPS
=
24
TRANSP
E
RENCY
=
1
TRANSP
A
RENCY
=
1
MAX_PARTICLES
=
1000
MIN_PARTICLES
=
0
N_OF_EVENTS
=
10
...
...
@@ -117,8 +117,8 @@ while true; do
FPS
=
"
$2
"
shift
2
;;
--transp
e
rency
)
TRANSP
E
RENCY
=
"
$2
"
--transp
a
rency
)
TRANSP
A
RENCY
=
"
$2
"
shift
2
;;
-c
|
--camera
)
...
...
@@ -187,20 +187,21 @@ Usage:
Set the animation resolution percentage.
--fps VALUE
Set number of frames per second in animation.
--transp
e
rency VALUE
Set detector transp
e
rency as a number greater than zero,
where zero is full transp
e
rency and 1 is standard transp
e
rency
--transp
a
rency VALUE
Set detector transp
a
rency as a number greater than zero,
where zero is full transp
a
rency and 1 is standard transp
a
rency
-c | --camera VALUE
Which camera to use for the animation, where VALUE
is a comma-separated list (without spaces)
Options: Barrel,Forward,Overview (defaults to Barrel)
-a | --sample
Creates a sample animation with Blender of Event x in ESD file {tal}.
Creates a sample Blender animation of Event 2 from URL
http://opendata.cern.ch/record/1102/files/assets/alice/2010/LHC10h/000139038/ESD/0001/AliESDs.root
--its
Removes ITS detector from animation
--tpc
Removes TPC detector from animation
--
-
trd
--trd
Removes TRD detector from animation
--emcal
Removes EMCal detector from animation
...
...
@@ -225,7 +226,7 @@ else
echo
"URL:
$URL
"
echo
"Download:
$DOWNLOAD
"
echo
"Sample:
$SAMPLE
"
echo
"Transp
e
rency Parameter:
$TRANSP
E
RENCY
"
echo
"Transp
a
rency Parameter:
$TRANSP
A
RENCY
"
echo
"Duration:
$DURATION
"
echo
"Resolution:
$RESOLUTION
"
echo
"FPS:
$FPS
"
...
...
@@ -297,7 +298,7 @@ if [ "$SAMPLE" = "true" ]; then
pushd
${
BLENDER_SCRIPT_DIR
}
for
type
in
$CAMERA
;
do
echo
"Preparing sample animation with
$type
in Blender"
blender
-noaudio
--background
-P
animate_particles.py
--
-radius
=
0.05
-duration
=
${
DURATION
}
-camera
=
${
type
}
-datafile
=
"d-esd-detail.dat"
-simulated_t
=
0.03
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
-transp
e
rency
=
${
TRANSP
E
RENCY
}
-stamp_note
=
"opendata.cern.ch_record_1102_alice_2010_LHC10h_000139038_ESD_0001_2"
-its
=
${
ITS
}
-tpc
=
${
TPC
}
-trd
=
${
TRD
}
-emcal
=
${
EMCAL
}
blender
-noaudio
--background
-P
animate_particles.py
--
-radius
=
0.05
-duration
=
${
DURATION
}
-camera
=
${
type
}
-datafile
=
"d-esd-detail.dat"
-simulated_t
=
0.03
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
-transp
a
rency
=
${
TRANSP
A
RENCY
}
-stamp_note
=
"opendata.cern.ch_record_1102_alice_2010_LHC10h_000139038_ESD_0001_2"
-its
=
${
ITS
}
-tpc
=
${
TPC
}
-trd
=
${
TRD
}
-emcal
=
${
EMCAL
}
done
popd
BLENDER_OUTPUT
=
.
...
...
@@ -395,7 +396,7 @@ elif [ "$SAMPLE" = "false" ]; then
for
type
in
$CAMERA
;
do
echo
"Processing
${
EVENT_UNIQUE_ID
}
with
$type
in Blender"
blender
-noaudio
--background
-P
animate_particles.py
--
-radius
=
0.05
-duration
=
${
DURATION
}
-camera
=
${
type
}
-datafile
=
"
${
LOCAL_FILE_WITH_DATA
}
"
-n_event
=
${
EVENT_ID
}
-simulated_t
=
0.03
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
-transp
e
rency
=
${
TRANSP
E
RENCY
}
-stamp_note
=
"
${
EVENT_UNIQUE_ID
}
"
-its
=
${
ITS
}
-tpc
=
${
TPC
}
-trd
=
${
TRD
}
-emcal
=
${
EMCAL
}
blender
-noaudio
--background
-P
animate_particles.py
--
-radius
=
0.05
-duration
=
${
DURATION
}
-camera
=
${
type
}
-datafile
=
"
${
LOCAL_FILE_WITH_DATA
}
"
-n_event
=
${
EVENT_ID
}
-simulated_t
=
0.03
-fps
=
${
FPS
}
-resolution
=
${
RESOLUTION
}
-transp
a
rency
=
${
TRANSP
A
RENCY
}
-stamp_note
=
"
${
EVENT_UNIQUE_ID
}
"
-its
=
${
ITS
}
-tpc
=
${
TPC
}
-trd
=
${
TRD
}
-emcal
=
${
EMCAL
}
# Move generated file to final location
mv
/tmp/blender/
*
${
BLENDER_OUTPUT
}
echo
"
${
type
}
for event
${
EVENT_UNIQUE_ID
}
done."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment