FAQ  •  Login

Visualization Related

<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Thu Mar 11, 2010 9:32 am

Visualization Related

Post questions related to visualization of your simulations here.


ME 751
Visualization Guide V1
By: Hammad M


#######NOTE: This Guide is for Windows ONLY#######

--------------------------------------------------------------
Version History
--------------------------------------------------------------
Version 1: Still a little rough around the edges, things have likely been overlooked and some steps still need clarification
Todo: Add info on material usage
Version 1.01 Updated Camera to have Z up rather than Y up
Todo: Add a user configurable way to change camera axis

--------------------------------------------------------------
Table of Contents
--------------------------------------------------------------
1: Software Needed
A)Blender
B)Python 2.6
C)Blender Ogre XML Exporter
D)XML to MESH Converter
E)DirectX End-User Runtime
F)SimulationEnvironment
G)VirtualDub
H)Xvid/Divx Codec


2: Installation
A)Blender
B)Python 2.6
C)Blender Ogre XML Exporter
D)XML to MESH Converter
E)DirectX End-User Runtime
F)SimulationEnvironment
G)VirtualDub
H)Xvid/Divx Codec


3: Software Usage
A)Save Data
B)Create 3D Model
C)Import Model
D)Export Model
E)Create Config
F)Editing Materials
G)Loading Simulation Data
H)Rendering Simulation Data
I)Create Video From Data


4: Other Notes
A) Place Holder


--------------------------------------------------------------
1: Software Needed
--------------------------------------------------------------

A)Blender: Free, Open Source 3D Modeling Program
Link: http://www.blender.org/download/get-blender/
It is recommended that the installer is used


B)Python 2.6: Scripting Language needed by Converters
Link: http://www.python.org/download/
Download Link: http://www.python.org/ftp/python/2.6.4/python-2.6.4.msi


C)Blender Ogre XML Exporter: Converts Geometry to XML
Link: http://www.ogre3d.org/wiki/index.php/Blender_Exporter
Download Link: http://www.xullum.net/lefthand/download ... Export.zip


D)XML to MESH Converter: (Part of Ogre Command Line Tools) Converts XML to .Mesh
Link: http://www.ogre3d.org/download/tools
Download Link: https://sourceforge.net/projects/ogre/f ... i/download

E)DirectX End-User Runtime: Provides DLL's needed by the visualization program
Link: http://www.microsoft.com/downloads/deta ... laylang=en

F)SimulationEnvironment: Program used to visualize simulation
Download Link: http://sbel.wisc.edu/Courses/ME751/2010 ... elease.zip

G)VirtualDub: Video Conversion and editing Tool
Link: http://virtualdub.sourceforge.net/
Download Link: http://prdownloads.sourceforge.net/virt ... p?download

H)Xvid/Divx Codec: Efficient Codec to compress video
Link: http://www.koepi.info/xvid.html



--------------------------------------------------------------
2: Installation
--------------------------------------------------------------
A)Blender:
Run Executable
Install to Program files directory
Select the:"Use the installation directory (ie. location chosen to install blender.exe)." Option
Finish Installation

B)Python 2.6:
Run python-2.6.4.msi
Preferably install to C:\Python26\
Use default settings for all options

C)Blender Ogre XML Exporter:
Extract Zip
Go to the blender directory located in the program files folder
Copy files from zip to Blender\.blender\scripts folder
There should be two folders: ogrehelp and ogrepkg along with a file called ogremeshesexporter.py
Copy/Cut all three

D)XML to MESH Converter:
Install to C:\OgreCommandLineTools\

E)DirectX End-User Runtime:
Run Executable until completion.
No Special Settings Needed

F)SimulationEnvironment:
Extract Release.zip to a folder
Location not important but must be known

G)VirtualDub
Extract to folder
Location not important but must be known

H)Xvid/Divx Codec:
Install Codec
No Special Settings Needed



--------------------------------------------------------------
3 Software Usage
--------------------------------------------------------------
A)Save Data

Save data from simulation in the following format:
One file per frame starting at zero and counting upwards
EX: pos0.dat  pos1.dat  pos2.dat .... pos100.dat ...
In that file every line represents a new object
This line MUST be comma separated
Format: Object#, x, y, z, e0, e1, e2, e3,
EX: 6, -33.775, 25, 0, 0.965926, 0, 0, -0.258819,

Example of a section for a data file:
.
.
.
6, -33.775, 25, 0, 0.965926, 0, 0, -0.258819,
7, -32.525, 27.1651, 39, 0.965926, 0, 0, -0.258819,
8, -32.525, 27.1651, -39, 0.965926, 0, 0, -0.258819,
9, 33.775, 50, 0, 0.965926, 0, 0, 0.258819,
10, 32.525, 52.1651, 20, 0.965926, 0, 0, 0.258819,
11, 32.525, 52.1651, -20, 0.965926, 0, 0, 0.258819,
12, 6.31997, 1.13221, -6.45168, -0.568687, -0.664366, 0.0585035, -0.481461,
13, 11.1139, 0.293416, 28.3748, -0.690514, 0.270539, 0.299719, -0.600149,
14, 11.3625, 0.337758, -22.1708, -0.560761, -0.0249694, -0.818113, 0.124928,
.
.
.

Take all of the data files and compress them into a zip file called data.zip
Replace the data.zip file located in the resources folder

B)Create 3D Model

Create a 3D geometry in your favorite modeling software
The recommended export format is .obj as Blender can readily import it
For other formats look in Blenders file-> import menu for the complete list of supported formats
Some specialty formats may have plugins for blender, look online for these

C)Import Model
Import model into Blender from File->import menu.


D)Export Model
Export model from the File-> export menu, select the "Ogre Meshes" Exporter
You should see the name(s) of the object(s) being exported
Click on the "OgreXMLConverter" Button
Then click on preferences
Click on "Manual" Button under OgreXMLConverter Location:
Click on Select and go to C:\OgreCommandLineTools\ and then click on "OgreXmlConverter.exe"
Finish By clicking the "select converter" Button
Click ok to exit the preferences screen and select the desired path under "Export Meshes"
Click Export to finish

This will create a .XML, .Material, and a .Mesh file at the specified location
copy the .Mesh file into models.zip

Note that this is a basic guide and it does not cover materials
--This might be added later

E)Create Config

First line: data file prefix and suffix
Second Line: Number of frames
Third Line: Number of objects followed by the number of lines that define the objects
Following lines:
Number of objects/copies to make of that object
Name of Mesh
Scaling: Sx Sy Sz
Material Name

Example Config File:

pos .dat
1500
103 4
1 Cube.mesh 40 .5 80 Material1
1 Cube.mesh .5 5 80 Material1
1 Cube.mesh .5 5 80 Material1
100 Cube.mesh .5 .5 .5 Material2

F)Editing Materials
--Place Holder

G)Loading Simulation Data
Run the executable and the data should begin to load

H)Rendering Simulation Data
Click the render button, the UI should disappear
The program will begin to write frames to the renders folder
Rendering will be complete when the UI re-appears
Hit escape to close the program

I)Create Video From Data
Open Up VirtualDub
Open up the first image in the sequence, The rest should automatically be loaded
Under Video->Compression menu select the Xvid MPEG-4 codec
Save the video by going File->Save as AVI


--------------------------------------------------------------
3 Other Notes
--------------------------------------------------------------
A) Place Holder
Last edited by HammadM on Wed Mar 17, 2010 3:54 pm, edited 1 time in total.
<<

ME451Tyler

ME751 Student

Posts: 25

Joined: Tue Mar 02, 2010 10:19 pm

Unread post Wed Mar 17, 2010 8:43 am

Re: Visualization Related

When I export from blender, I get 2 files pend.mesh.xml and Scene.material.  I tried renaming pend.mesh.xml --> pend.mesh and using that but it error when it loads the mesh.

"Mesh: Loading pend.mesh

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information."

Any thoughts?

Also, I can get it to import if I use Cube.mesh but the object doesn't look right.  It has no depth.  I can see the motion, sort of.

When I run the Simulation Environment I get a prompt from Ogre asking if I want to use either "OpenGL Rendering Subsystem" or "Direct3D 9 Rendering Subsystem"   Which should I use?

Also, can you comment on how the scaling terms work in the conf.txt?

my conf.txt looks like this when it runs with the cube:

  pos .dat
  1000
  1 1
  1   Cube.mesh 1 1 1 Material1

(I am only running 1000 steps while getting it to run)

Lastly, how do you change camera position?  I think I figured out that rotate is "hold right mouse button and move the mouse"
Last edited by ME451Tyler on Wed Mar 17, 2010 8:46 am, edited 1 time in total.
<<

ME451Tyler

ME751 Student

Posts: 25

Joined: Tue Mar 02, 2010 10:19 pm

Unread post Wed Mar 17, 2010 9:05 am

Re: Visualization Related

Makarand clued me in that WASD are used to move. 

After playing around with it, it looks like the best visual results for the scalars come from 4, .25, .1  (The dimensions of the part...)

I can't seem to rotate to the plane I want to view.  Its like I can only rotate in 2D.  So the object is always rotating in and out of the screen.  (about X)  Any thoughts?
Last edited by ME451Tyler on Wed Mar 17, 2010 9:06 am, edited 1 time in total.
<<

ME751Chris

ME751 Student

Posts: 55

Joined: Tue Mar 02, 2010 10:15 pm

Unread post Wed Mar 17, 2010 11:47 am

Re: Visualization Related

ME751Chris wrote:my python installation ended early with a code 2350 which I guess from the error which said I didn't have enough disk space...even though I have 178GB free.  any ideas?

Who knew restarting your computer was so powerful!
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Wed Mar 17, 2010 12:55 pm

Re: Visualization Related

ME751Chris wrote:
ME751Chris wrote:my python installation ended early with a code 2350 which I guess from the error which said I didn't have enough disk space...even though I have 178GB free.  any ideas?

Who knew restarting your computer was so powerful!


Bill Gates did.
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Wed Mar 17, 2010 3:53 pm

Re: Visualization Related

I updated the zip with a new executable, the problem was that Dan defined the problem with the Z axis up, I had ogre create a camera with Y up, it should look fine now (camera is Z up).
<<

ME751Chris

ME751 Student

Posts: 55

Joined: Tue Mar 02, 2010 10:15 pm

Unread post Wed Mar 17, 2010 4:49 pm

Re: Visualization Related

HammadM wrote:I updated the zip with a new executable, the problem was that Dan defined the problem with the Z axis up, I had ogre create a camera with Y up, it should look fine now (camera is Z up).


I redownloaded the Blender Resources zip folder, is that the one that has the new camera angle? If so, I still can't make it look good, even using AWSD keys and the right mouse button.  Is there any other control feature to maneuver the camera?  Where is the new zip folder we need re-download?
<<

ME451Tyler

ME751 Student

Posts: 25

Joined: Tue Mar 02, 2010 10:19 pm

Unread post Wed Mar 17, 2010 4:52 pm

Re: Visualization Related

ME751Chris wrote:
HammadM wrote:I updated the zip with a new executable, the problem was that Dan defined the problem with the Z axis up, I had ogre create a camera with Y up, it should look fine now (camera is Z up).


I redownloaded the Blender Resources zip folder, is that the one that has the new camera angle? If so, I still can't make it look good, even using AWSD keys and the right mouse button.  Is there any other control feature to maneuver the camera?  Where is the new zip folder we need re-download?


F)SimulationEnvironment: Program used to visualize simulation
http://sbel.wisc.edu/Courses/ME751/2010 ... elease.zip
     
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Wed Mar 17, 2010 5:18 pm

Re: Visualization Related

Hamid ended up using MATLAB to generate the movie.  you don't have to use Ogre, i only need a movie to show the motion of the pendulum based on your simulation results.  I like movies, just get me something to watch.
<<

ME751Anne

ME751 Student

Posts: 28

Joined: Tue Mar 02, 2010 10:14 pm

Unread post Wed Mar 17, 2010 7:42 pm

Re: Visualization Related

I used OpenSim.
<<

ME751Chris

ME751 Student

Posts: 55

Joined: Tue Mar 02, 2010 10:15 pm

Unread post Wed Mar 17, 2010 10:39 pm

Re: Visualization Related

0.001 second time steps is a bit much.  why do we choose that for the computation?  i still have problems with my 'camera' angle, the speed doesn't change anything in the simulation environment, and when i specify frame rate under video in videodub, the writing of the data file still chooses its own fps.  Any ideas?
<<

HammadM

Supreme Overlord
Supreme Overlord

Posts: 37

Joined: Wed Sep 03, 2008 12:23 pm

Unread post Thu Mar 18, 2010 2:56 am

Re: Visualization Related

speed only changes if it is paused
if you specify the frame rate in Virtualdub (default is 10 I think) it should work.
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Thu Mar 18, 2010 6:47 am

Re: Visualization Related

ME751Chris wrote:0.001 second time steps is a bit much.  why do we choose that for the computation?  i still have problems with my 'camera' angle, the speed doesn't change anything in the simulation environment, and when i specify frame rate under video in videodub, the writing of the data file still chooses its own fps.  Any ideas?


i must admit that 0.001 second is ridiculous.  I chose it.
<<

ME751Arman

ME751 Student

Posts: 7

Joined: Tue Mar 02, 2010 10:19 pm

Unread post Thu Mar 18, 2010 9:17 am

Re: Visualization Related

As someone who is working with these stuffs for the first time, It is difficult to figure out where is "models.zip" supposed to be when the guide mentions it for the 1st time in "copy the .Mesh file into models.zip". Or where should "Config" be or what extension should it have when it is mentioned for the first time at "E) Create Config." Or in which program and where should the executable be found  when the guide mentions "Run the executable and the data should begin to load", or ...................

one possible way is that to spend hours and do all possible ways and look into all folders among the bunch of programs we installed, which does not seem reasonable. A more comprehensive guide (Or maybe a 10min movie of the essential steps) can help a lot.
<<

Dan Negrut

Global Moderator
Global Moderator

Posts: 833

Joined: Wed Sep 03, 2008 12:24 pm

Unread post Fri Mar 19, 2010 6:45 am

Re: Visualization Related

ME751Arman wrote:As someone who is working with these stuffs for the first time, It is difficult to figure out where is "models.zip" supposed to be when the guide mentions it for the 1st time in "copy the .Mesh file into models.zip". Or where should "Config" be or what extension should it have when it is mentioned for the first time at "E) Create Config." Or in which program and where should the executable be found  when the guide mentions "Run the executable and the data should begin to load", or ...................

one possible way is that to spend hours and do all possible ways and look into all folders among the bunch of programs we installed, which does not seem reasonable. A more comprehensive guide (Or maybe a 10min movie of the essential steps) can help a lot.


Arman - it's very hard to put together a good guide.  Take what's been posted as a starting point, a good one in my opinion.  As you run into problems that you struggle with post a question on the forum and someone who has more experience with this process will answer.  There is no point in trying all the possibilities to figure our where to put your config file.  By posting the question you help yourself and help some other ME751 fellows who chances are will run into the same question sooner of later.  The forum will then end up as a useful repository of knowledge.  Also remember to pay your dues too: if you know the answer to a question posted on the forum take five minutes and provide an answer.  Someone will be grateful (at least me, if nobody else).
Dan
Next

Return to ME751 Spring 2010: Advanced Computational Multibody Dynamics

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software.