3D visualisation of trajectories with Unity
Update
Check this repository: 3D visualization of trajectories and geometries of crowd simulation software (Optimized for JuPedSim and 3D Geometries)
Some related history
Someone sent me a link to a nice project called SumoVizUnity:
a Unity3D
project for visualization of pedestrian simulations.
Although it seems the project is not actively developed1, however it is still very easy to use and has some nice features like:
- coloring pedestrians with respect to density or speed.
- drawing a measurement line to measure (on the fly) the flow.
- drawing an instantaneous Fundamental Diagram (\(\rho, v\)).
- show the trajectories of pedestrians.
- live plots of different statistics e.g. (\(N, t\))-curve or (\(v, t\))-curve.
Here is a nice demo on Vimeo (German speaker but whatever).
Well now, would it not be great to use this fantastic project to visualize simulations created by JuPedSim
?
SumoVizUnity
needs two different file:
- a geometry file (called
geometry.txt
) - and a trajectory file called
b090_combined.txt
.
the names are hard coded, but surely can be changed in the code. For the time being let’s just don’t care.
What we need is a parser to convert JuPedSim
’s files in SumoVisUnity
required formats, move the
produced files in the directory where SumoVisUnity
lives and fire it up:
# call the parser
python3 scripts/vizUnity_geometry.py jupedsim_geometry.xml jupedsim_trajectory.xml
# mv the files to SumoVisUnity directory
mv geometry.txt b090_combined.txt ~/SumoVizUnity
# run SumoVizUnity
./SumoViz\ Unity.app/Contents/MacOS/SumoViz\ Unity SumoViz\ Unity
That is it.
Control the visualization
I found these keystrokes helpful to control the scene:
esc
rotate the scene with the mousew
ands
zoom in and outa
andd
move left and rightq
ande
go up and down
Python script
Get the script from the jpscore
repository.
Enjoy!
Notes