MAKE SURE YOU ARE USING THE
stable2 BRANCH. If you are using mercurial, cd to your astroblend directory and do:
hg update stable2
You should see the following in your astroblend folder:
README.md : the README file for bitbucket.org science/ : holds the main science library and its classes utils/ : contains changemtl.py which will change the headers of OBJ files if you move them from one computer to the next so that they are still pointing to the correct material files (MTL files), and Blender will thus still plot their colors correctly yt_files/ : contains several yt files used to generate typical OBJ files exampleScripts/ : some example scripts
Download and Modify Blender
Now you need to download Blender. The AstroBlend library is currently using version 2.72, which can be found here. An older version of AstroBlend used 2.69, which can also be forked if necessary, but no promises on how up to date it is! Versions up to 2.76b are being tested currently (see below for modifications in changing the OBJ exporter).
To use the full capabilities of the OBJ exporter from yt in AstroBlend, you'll want to modify a few lines in the Blender OBJ importer and exporter.
FOR VERSION 2.70-2.74: For the importer, on my Mac I modified the file "/Applications/Blender2.72/blender.app/Contents/Resources/2.72/scripts/addons/io_scene_obj/import_obj.py", in the function "create_materials" as follows:
# ... elif line_lower.startswith(b'tr'): # translucency context_material.translucency = float_func(line_split) elif line_lower.startswith(b'tf'): # rgb, filter color, blender has no support for this. pass elif line_lower.startswith(b'em'): # MODIFY: ADD THIS LINE context_material.emit = float_func(line_split) # MODIFY: THIS LINE TOO elif line_lower.startswith(b'illum'): illum = int(line_split) # ...
For the exporter, on my Mac I modified the file "/Applications/Blender2.72/blender.app/Contents/Resources/2.72/scripts/addons/io_scene_obj/export_obj.py", in the function "write_mtl" as follows:
# ... elif mat.specular_intensity == 0: fw('illum 1\n') # no specular. else: fw('illum 2\n') # light normal fw('em %.6f\n' % mat.emit) # MODIFY: ADD THIS else: # ...
FOR VERSION 2.76: For the importer, on my Mac I modified the file "/Applications/Blender2.76/blender.app/Contents/Resources/2.76/scripts/addons/io_scene_obj/import_obj.py", in the function "create_materials" as follows:
# ... elif line_id == b'tf': # rgb, filter color, blender has no support for this. pass elif line_id == b'em': # MODIFY: ADD THIS LINE context_material.emit = float_func(line_split) # MODIFY: THIS LINE TOO elif line_id == b'illum': illum = int(line_split) # ...
You will also need to comment out the following line:
# ... emit_value = sum(emit_colors) / 3.0 if emit_value > 1e-6: # We have to adapt it to diffuse color too... emit_value /= sum(context_material.diffuse_color) / 3.0 ########### COMMENT ME ######## context_material.emit = emit_value if not do_ambient: context_material.ambient = 0.0 # ...
For the exporter, you can use the method described in the section about the exporter for versions 2.72-2.74.
Or, for version 2.76 of Blender, you can download the import_obj.py file here.
Create AstroBlend Data Files
First, you probably want to have some data to manipulate. The tutorials will discuss how to access different data sets, but in general there are two ways to get data into AstroBlend.
(1) Read in data via a text file. This is currently what is done with SPH simulations. However, this can be memory intensive for very large data sets. Furthermore, for AMR codes, you would need some pre-formatting to have such data be useful visually.
(2) Use pre-fab isosurface files which for our purposes are stored as OBJ or Wavefront files. A few examples can be found in the Data Section. An easy example to use to start with might be the yt Galaxy Isodensity Contours.
AstroBlend support for codes is an ongoing process, please find your code below to see if its supported.
|Code/Format||yt Surface Support||AstroBlend Surface Support||SPH Support|
|Artio||N||NA - just loads||NA|
|Fits||N||NA - just loads||NA|
|GDF||N||NA - just loads||NA|
|MOAB||N||NA - partial loading||NA|
|SPH Text Files||N||N||Yes (see here)|
Almost there! Just two more things you should do:
(1) Start by looking at the first tutorial - Getting to Know Blender which will show you the basics of navigation.
(2) Then follow up this with checking out the second tutorial - Simple Rendering which will show you how to render an image and will talk a bit about camera positioning and moving objects around.
(3) If you want to use yt directly in Blender with AstroBlend check out the third tutorial - Calling yt Directly.