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

Merge branch 'blender_options' into 'master'

Blender options

See merge request !5
parents 14f3cce1 0692fab5
......@@ -53,25 +53,45 @@ Here, there are two options from which you can choose:
- the first one is to download your ESD file and save it in the `alice-blender-animation` directory, which was cloned from the git repository. Make sure you save it on the same path as this `README.md` file and the `workflow_sketch.sh` script, not inside the "aliRoot" or "animate" directories. Also make sure the file is named `AliESDs.root`.
- the second one is to copy the URL for the ESD file (the address you would click to download it) and paste it on the command line when you run the script that generates the animation, according to the next section.
- the second one is to copy the URL for the ESD file (the address you would access to download it) and paste it on the command line when you run the script that generates the animation, according to the next section.
## Step 3 - Generating animation
Once you are all set, run the `workflow_sketch.sh` script through your terminal in the following way:
Once you are all set, all there is left to do is run the `workflow_sketch.sh` script through your terminal.
If you have already downloaded the ESD file, run it as follows:
```bash
./workflow_sketch.sh <DOWNLOAD> <URL>
./workflow_sketch.sh --maxparticles <MAXPARTICLES> --duration <DURATION> --resolution <RESOLUTION>
```
where `<DOWNLOAD>` is either "true" of "false", depending on whether you wish to download the ESD file or just go with the one you have already downloaded.
where `<MAXPARTICLES>` is the highest number of particles that you wish the events about to be animated have. It means events with more particles than that will not be animated. Keep in mind that it takes extra amount of time to generate animations with too many particles, say, 5000 or more.
`<DURATION>` is the time duration, in seconds, each animation will last.
If you type in "true", fill in the `<URL>` field with your ESD's URL, copied in the previous section. The code will then automatically download and run the analysis on the file.
Finally, `<RESOLUTION>` is the animation resolution percentage, ranging from 0 (you don't want it to be 0) to 100.
If you type in "false" - in which case you should have downloaded the ESD file yourself - just leave the `<URL>` field blank.
Here is a running example:
Have in mind that it may take a long time to generate all the animations.
```bash
./workflow_sketch.sh --maxparticles 2000 --duration 15 --resolution 100
```
If you have copied the ESD's URL in the previous section and wish to download it automatically, run the script as:
```bash
./workflow_sketch.sh --url <URL> --download --maxparticles <MAXPARTICLES> --duration <DURATION> --resolution <RESOLUTION>
```
where `<URL>` is the ESD's URL you have at hand, and all the other arguments are the same as above.
Here is a running example:
```bash
./workflow_sketch.sh --url http://opendata.cern.ch/record/1103/files/assets/alice/2010/LHC10h/000139173/ESD/0004/AliESDs.root --download --maxparticles 2000 --duration 15 --resolution 100
```
After running the script, your Blender animations should be ready! For each event inside the ESD file, there will be three animations saved in .mp4 format, each one corresponding to a different view of the event. They will be available inside the `output` directory. Enjoy!
After running the script, your Blender animations should be ready! Have in mind that it may take a long time to generate all the animations. For each event inside the ESD file - with fewer particles than you have specified -, there will be three animations saved in .mp4 format, each one corresponding to a different view of the event. They will be available inside the `output` directory. Enjoy!
# Default Animation
......@@ -79,7 +99,7 @@ After running the script, your Blender animations should be ready! For each even
For generating a default animation, simply run the script `workflow_sketch.sh` in your terminal as below:
```bash
./workflow_sketch.sh 0 0 true
./workflow_sketch.sh -a
```
After this, a single default animation should be ready. It will be available inside the `output` directory, in mp4 format. Enjoy!
......@@ -33,8 +33,8 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
exit 1
fi
OPTIONS=hdau:m:
LONGOPTS=maxparticles:,help,download,default,url:
OPTIONS=hdau:m:t:r:
LONGOPTS=resolution:,duration:,maxparticles:,help,download,default,url:
# -regarding ! and PIPESTATUS see above
# -temporarily store output to be able to check for errors
......@@ -52,6 +52,8 @@ eval set -- "$PARSED"
##############################
# Parse Parameters #
##############################
DURATION=10
RESOLUTION=100
MAX_PARTICLES=0
HELP=false
DOWNLOAD=false
......@@ -65,7 +67,7 @@ while true; do
shift
break
;;
-d|--download)
-d|--download)
DOWNLOAD=true
shift
;;
......@@ -81,6 +83,14 @@ while true; do
MAX_PARTICLES="$2"
shift 2
;;
-t|--duration)
DURATION="$2"
shift 2
;;
-r|--resolution)
RESOLUTION="$2"
shift 2
;;
--)
shift
break
......@@ -118,6 +128,10 @@ Usage:
See example below.
-m | --maxparticles VALUE
Get only events for which its number of particles is smaller than VALUE.
-t | --duration VALUE
Set the animation duration in seconds.
-r | --resolution VALUE
Set the animation resolution percentage.
-a | --default
Creates a default animation with blender.
......@@ -172,7 +186,7 @@ if [ "$DEFAULT" = "true" ]; then
# Phase 1: blender animate #
##############################
pushd ${BLENDER_SCRIPT_DIR}
blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=2 -camera="OverviewCamera" -datafile="d-esd-detail.dat" -simulated_t=0.02 -fps=5 -resolution=100 -stamp_note="Texto no canto"
blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=${DURATION} -camera="OverviewCamera" -datafile="d-esd-detail.dat" -simulated_t=0.03 -fps=24 -resolution=${RESOLUTION} -stamp_note="Default animation"
popd
BLENDER_OUTPUT=.
mkdir --verbose -p ${BLENDER_OUTPUT}
......@@ -245,7 +259,7 @@ elif [ "$DEFAULT" = "false" ]; then
for type in "BarrelCamera" "OverviewCamera" "ForwardCamera"; do
echo "Processing ${EVENT_UNIQUE_ID} with $type Camera in blender"
blender -noaudio --background -P animate_particles.py -- -radius=0.05 -duration=1 -camera=${type} -datafile="${LOCAL_FILE_WITH_DATA}" -n_event=${EVENT_ID} -simulated_t=0.01 -fps=5 -resolution=50 -stamp_note="${EVENT_UNIQUE_ID}"
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=24 -resolution=${RESOLUTION} -stamp_note="${EVENT_UNIQUE_ID}"
# Move generated file to final location
mv /tmp/blender/* ${BLENDER_OUTPUT}
echo "${type} for event ${EVENT_ID} done."
......@@ -257,7 +271,7 @@ elif [ "$DEFAULT" = "false" ]; then
popd
echo "EVENT ${EVENT_UNIQUE_ID} DONE with FILE $LOCAL_FILE_WITH_DATA."
else
echo "Too much particles (maximum accepted is $MAX_PARTICLES). Continue."
echo "Too many particles (maximum accepted is $MAX_PARTICLES). Continue."
rm $FILE_WITH_DATA
continue
fi
......
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