Commit fac34c19 authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬
Browse files

Spell 'transparency' correctly

parent c72b8eaf
......@@ -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 -transperency=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 -transparency=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('-transperency','--transp_par')
parser.add_argument('-transparency','--transp_par')
parser.add_argument('-its','--its')
parser.add_argument('-tpc','--tpc')
parser.add_argument('-trd','--trd')
......
......@@ -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,transperency,alpha,emit,specular_alpha,fresnel_factor,fresnel):
def createMaterial(name,R,G,B,shadows,cast_shadows,transparency,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 = transperency
bpy.data.materials[name].use_transparency = transparency
bpy.data.materials[name].alpha = alpha
bpy.data.materials[name].emit = emit
bpy.data.materials[name].specular_alpha = specular_alpha
......
......@@ -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,transperency=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,transparency=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,transperency=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,transparency=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,transperency=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,transparency=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,transperency=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,transparency=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,transperency=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,transparency=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))
......
......@@ -34,7 +34,7 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
fi
OPTIONS=c:hdau:m:n:t:r:
LONGOPTS=camera:,resolution:,fps:,transperency:,duration:,maxparticles:,minparticles:,numberofevents:,minavgpz:,help,download,sample,url:,its,tpc,trd,emcal
LONGOPTS=camera:,resolution:,fps:,transparency:,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
TRANSPERENCY=1
TRANSPARENCY=1
MAX_PARTICLES=1000
MIN_PARTICLES=0
N_OF_EVENTS=10
......@@ -117,8 +117,8 @@ while true; do
FPS="$2"
shift 2
;;
--transperency)
TRANSPERENCY="$2"
--transparency)
TRANSPARENCY="$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.
--transperency VALUE
Set detector transperency as a number greater than zero,
where zero is full transperency and 1 is standard transperency
--transparency VALUE
Set detector transparency as a number greater than zero,
where zero is full transparency and 1 is standard transparency
-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 "Transperency Parameter: $TRANSPERENCY"
echo "Transparency Parameter: $TRANSPARENCY"
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} -transperency=${TRANSPERENCY} -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} -transparency=${TRANSPARENCY} -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} -transperency=${TRANSPERENCY} -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} -transparency=${TRANSPARENCY} -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."
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment