The "Shell Laboratory"
is a GUI for "libshelly"
.
It is mainly a Tcl/Tk script and some C-code to interface to
OpenGL (via Togl) and "libshelly"
.
The main goal of this GUI is to ease the process of parameterization through immediate display of the results.
Each parameter of the shell generator is represented as a line, containing
Since all those parameter-lines fit hardly on any screen, I put
them into a scroll-able canvas.
You might want to maximize the window size to your full
screen height.
You can cycle through the entries and sliders with <TAB>
and
<Shift+TAB>
.
Each change of a sliders value results in the following internal actions.
At first, a new shell is generated via "libshelly"
in the mode selected
in the "Preferences/SL-Mode"
sub menu. Then, the shell is displayed as
wireframe, shaded polygonal or smooth NURBS model in the second window called
"3D-View"
. If you enter a value for a parameter directly
in the associated entry, the update process starts when
the focus leaves the entry (the <TAB>
-key is pressed
or another entry is selected with the mouse).
The initial configuration of the sliders has been choosen to protect you
from potentially dangerous parameter values, that may crash the lab,
and to ensure greatest possible freedom in setting any parameter.
From time to time it may be necessary to reconfigure a slider, so that
other values than allowed by its initial configuration may be set.
Each slider may be configured using the associated "Cal."
button.
This will open a modal dialog, where you can change minimum
and maximum value and, important, the step-size or resolution of the slider.
Note, that you cannot set any other value than
x = min + (n * step-size), (x <= max)
with the slider.
File
New
: reset the lab Load
: loads a set of parameters Save
: saves a set of parametersImport
Texture (PPM)
: import an image file in the
PPM format to map on the shellTexture (TIFF)
: import an image file in the
TIFF format to map on the shellExport
Shell
: export the calculated shell as object
in various formats (see section
Output Formats for more information)
Scene
: export the calculated shell and all transformations
of the 3D-View in RIB formatTexture (PPM)
: export the current texture
as image file in the PPM formatTexture (TIFF)
: export the current texture
as image file in the TIFF format3D-View Image (PPM)
: export the rendered shell
as image file in the PPM format; Note, that the front buffer
will be used for this, make sure that no other window obscures/destroys
the content of this buffer. The resulting image files are usually
very large, because the ASCII version of PPM is used, convert them!3D-View Image (TIFF)
: export the rendered shell
as image file in the TIFF format; Note, that the front buffer
will be used for this, make sure that no other window obscures/destroys
the content of this buffer.Exit
: quits the applicationPreferences
: (Configuring miscellaneous things)
Mode
:
Wireframe
: switches to wireframe display (default)FlatShaded
: switches to a flat (constant) shaded representationNURBS
: switches to a NURBS rendered representationNURBS+Wire
: NURBS + control polygonProjection
:
Perspective
: Perspective projection (default)Orthographic
: Orthographic projectionColor
: Change color and material properties of the shell
Set Ambient Color
Set Diffuse Color
Set Specular Color
: color of the highlightsSet Shininess
: specularity (0 - 128)Set Background Color
Antialiasing
:
None
: disables antialiasing (default)4 Passes
: enables antialiasing using 4 rendering passes8 Passes
: enables antialiasing using 8 rendering passesDrawCoordsys
: switches display of the small coordinate system
on or off (default: on)AutoUpdate
: If this is enabled, every change of a parameter
results in an immediate update of the display.
Toggling the checkbox from "off"
to "on"
will not result in an
updated display. (default: on)Set NURBS Quality
: allows to change "GLU_SAMPLING_TOLERANCE"
SL-Mode
:
Normal
: (default)Nodule
: GenCurve
: see section
Calculation Modi for more information on these modesEditors
:
GenCurve-Editor
: opens the generation curve editorTexture-Editor
: opens the texture editorHelp
: (A small online help)
Shell Laboratory
: Just a pointer to the original docs.About Shell Laboratory
Shortcuts (accelerators) exist for some of these menu entries, see the menu entries for more information.
This window uses OpenGL to draw the shell.
The shell may be displayed as wireframe model or rendered using
constant shading or as a NURBS-surface.
You may configure this with the "Mode"
sub-menu in the
"Preferences"
menu.
You may rotate, zoom and move the shell (moving along z-axis only) with your mouse and keyboard. See the listing of key and mouse bindings to learn how to.
A coordinate system is drawn to help you to navigate. It might be
helpful to estimate the size of the object, as each axis is exactly
1 (whatever) long.
It can be switched off with the "DrawCoordsys"
check-button in the
"Preferences"
menu.
The view is updated every time you change the value of a parameter.
You may change this behavior with the "AutoUpdate"
check-button.
Note, that changing "AutoUpdate"
from off to on state does
not result in an updated display.
If you get annoyed by the perspective distortions that may occur
when viewing large objects, use the new orthographic projection mode
(submenu "Projection"
in the "Preferences"
menu).
If you are lost in space use <r>
to reset to the default
settings.
Some notes about the NURBS rendering mode. Be warned, that NURBS rendering may be a very lengthy process, especially if texturing is enabled. Under certain conditions it may last too long, even for the most patient. A simple rule to avoid long rendering times:
Do not render shells with NURBS that do not fit completely into the view.
Especially if you zoomed the view a lot, or if you have the impression that the viewer is inside or very near the shell (after a rotation or parameter change) do not activate NURBS!
Setting too small values for the "NURBS Quality"
(which is actually "GLU_SAMPLING_TOLERANCE"
) is dangerous too,
I recommend not to set values smaller than 10. However, I have to admit
that you need to set it to 5 to correctly render some
example .shy-files (namely, the rippled Cockle and Rapa).
Even though NURBS represent very smooth surfaces, occasional
cracks might be visible on the surfaces, dependig on the OpenGL
implementation.
The NURBS rendered with Mesa usually do not suffer from this problem.
On an SGI decreasing "NURBS Quality"
or sometimes simply
rotating the shell a bit helps.
The NURBS rendering speed of normal sized shells might not be enough for interactive displays on nowadays commodity workstations (Pentium class), thats why the representation is automatically switched from NURBS to flat shaded, while rotating and changing parameters with the sliders.
Antialiasing improves the rendering quality using a technique called viewing-volume-jittering: the scene is rendered multiple times with slightly different camera settings. All passes are accumulated to the resulting image. Note, that the rendering times do not increase linearly with the number of rendering passes because of the buffer operations (the accumulation process). This means, if you get 10 frames per second in wireframe rendering mode, you will not get a fourth (2 fps) with 4 pass antialiasing, this depends on the speed of the buffer operations. In practice, expect something near 0.75 frames per second in wireframe mode! You see that antialiasing is very slow and therefore it is switched off temporarily while rotating and changing parameters with the sliders.
Two levels of antialiasing are available. The 4 passes mode increases the quality considerably, while 8 passes give not much more quality (compared to the increased effort). Your mileage may vary, however.
You may toggle antialiasing directly with the <a>
hotkey in
the 3D-View.
Texturing can be enabled or disabled with the <t>
hotkey.
You may use imported textures or textures generated in the
"Shell Laboratory"
by the built-in texture generator.
Textures should be sized properly in order to be used with OpenGL. Use powers of two, otherwise the texture image will be scaled, which is something you might not want.
The "Shell Laboratory"
uses mipmaps and bilinear filtering
in order to achieve the highest possible texture mapped rendering
quality (depending on the OpenGL implementation). Some strange
blurry artifacts occurred lately using very large (2048x512)
textures, I am still investigating this...
Note, that the white highlight on the shell is not rendered correctly if texturing is enabled. This is a limitation of OpenGL, which can be circumvented by a multi pass rendering approach (like most limitations of OpenGL), but I guess antialiasing is multi pass enough and there are programs called "renderer" for a reason...
Here are all the key and mouse bindings:
<Mouse-Button-1>
(the left one) click and drag: rotate
around x- and y-axis
<Cursor-Left>
, <Cursor-Right>
: rotate around z-axis
<Cursor-Up>
, <Cursor-Down>
: move along z-axis
<Shift+Cursor-Up/Down/Left/Right>
: move view
<x/X/y/Y/z/Z>
: view along x (y z) axis
<+>
: zoom in
<->
: zoom out
<r>
: reset all transformations
<a>
: toggle antialiasing
<t>
: toggle texturing
Other useful keybindings are <w>
(switch to wireframe),
<f>
(switch to flat shading), <n>
(switch
to NURBS) and <c>
(switch to NURBS + control polygon).
Note, that these key and mouse bindings are available in the 3D-View window only!
The generation curve editor (GCE) offers a facility to easily create or modify
a generation curve, used in the GenCurve-mode of "libshelly"
.
Some basics:
"Update"
menu.)
"libshelly"
is in the
"GenCurve"
mode.
The GCE will ask you to enable this mode on startup,
in case you did not activate it by yourself.
The menu items should be self explanatory.
Window
Close
Update
No automatic Update
Update after move
Update while moving
Update now!
Curve
Move Point
Insert Point
Delete Point
Fetch from Normal-Mode
Help
Help
Some accelerators exist for the menu:
<Ctrl+w>
: close window
<Ctrl+m>
: move points
<Ctrl+i>
: insert points
<Ctrl+d>
: delete points
<Ctrl+f>
: fetch curve from Normal-Mode
<Ctrl+u>
: update generation curve of the main window
Key bindings for zooming and moving are:
<Mouse-Button-3>
: (the right one) click and drag: move the view
<Up,Down,Left,Right>
: move the view
<r>
: reset all moves
<+,Add>
: zoom into the view x2 (works upto a factor of 8)
<-,Sub>
: zoom out of the view x0.5 (works upto a factor of 0.125)
To insert a new point simply select the "Insert Point"
menu entry,
then click on a point of the generation curve. Do not release
the mouse button, but simply drag the new point to it's position.
Deleting points is even more simple, use the "Delete Point"
menu entry
and select the point to delete with your mouse. Note, that you cannot
delete any points if there are only two left.
If you just want to change some features of an ellipsoid generation
curve you may fetch one easily from the shell generator for editing
purposes.
The curve fetched using the "Fetch from Normal-Mode"
curve menu
entry is the first curve that would be generated in the Normal-Mode.
This means that certain transformations are applied to the original
centered ellipsoid generation curve before fetching!
You may preview the curve you will get, by setting the following
ShellyLib parameters "omin"
to 0 and "omax"
to 1 and by
switching the shell 3D display to wireframe.
If you want to start your work on the generating curve with the same shell as would be generated in the Normal-Mode, set temporarily the following parameters:
"beta"
to 90.0;
"phi"
,"my"
,"omega"
, "A"
to 0.0;
"a"
, "b"
, "scale"
to 1.0.
Now fetch the generating curve, and restore the original values. This does not give you exactly the same shell, but the changes should be minimal.
The texture editor (TE) offers a facility to easily create textures
to be mapped onto the shell shapes generated by "libshelly"
.
It utilizes the algorithms published in "The Algorithmic Beauty of Sea
Shells" by H. Meinhardt (see section
Addresses, Pointers, Literature
for a complete reference).
This section is not intended to explain these algorithms and their
parameters in depth. If you are interested read the book.
Some basics:
"Update"
menu.The menu items should be self explanatory.
Window
Close
Macro
Clear
Remove Step
Run
Record
Update
No automatic Update
Update after generate
Update now!
Help
Help
The following hot-keys are defined:
<Ctrl+w>
: close window
<Ctrl+u>
: update texture
<Ctrl+g>
,<g>
: generate texture
<Ctrl+s>
,<s>
: stop generator
<Ctrl+z>
: Undo
For your first experiments just select a texture type using the
"Select type:"
listbox and use the "Generate"
button.
Follow these steps to create a texture:
"Select type:"
listbox. Selecting a type will fill the next two sections of adjustable
parameters with default values."Generate"
button. If you find that the created texture does not come out right, you
might stop the generator with the "Stop!"
button. Note, that while
generating a texture, the GUI might respond a little slower than usual."Ctrl+u"
, then change to a Flat-shaded or
NURBS display. Texture mapping may reduce performance drastically
on software-only OpenGL implementations; switch to the wireframe
display before rotating or changing parameters!How does the texture generator work?
It simulates the distribution of substances (e.g. pigments) in the cells of a shell over it's lifetime. Several different effects may influence the distribution of substances like diffusion. All these different effects are put together in sets of equations. Each set of equations allows for the simulation of a specific type of shell pattern. There is no general set of equations available that could simulate all possible patterns of shells.
It is clearly beyond the scope of this documentation to explain all the equations and their parameters, as they are really complex. I can only point you to Meinhardt's book.
The texture generator implements many (not all!) equations from Meinhardt's book "The Algorithmic Beauty of Sea Shells". The parameter names were taken from the example implementation given in the book.
Some features of Meinhardt's software are not implemented in the
texture generator. It is not able to plot concentrations of different
substances, but just one (substance A). The type of the plot is always
a continuous mapping of the concentration of substance A
to color values. This mapping can be adjusted with the "Set Color:"
parameters.
They define an interval of concentration values (the two entries)
and the accompanying interval in color (the two colored buttons).
Two more things are important about this mapping: if the concentration
of substance A is smaller than the value in the first entry, the
resulting color is white; if the concentration is bigger than the
value in the second entry the resulting color will be that of
the second button.
Now on to the other parameters. You may select different
parameter sets with the pop-up-menu that comes up if you press the
"Set Parameter:"
menu button.
Up to seven substances (named A to G) may be used for the simulations.
That's why there are seven numbers in each
parameter list (except for the "Misc."
-section).
The first number in the list (if "Initial Concentration (A)"
is selected)
is the initial concentration of substance A, consequently.
The second number is the initial concentration of substance B and so on.
Do not confuse the names of substances (A to G) with the names of
parameters (A, B, C, D, G, R, S).
An important section of parameters is the "Misc."
-section.
The parameter names from this list (except for "RS"
) have been taken
from the example implementation by Meinhardt as well.
Some simulations depend on random numbers. You can set the
amount of randomness with the "KR"
parameter. The "RS"
parameter controls the initialization of the random number
generator. If "RS"
has a value other than zero, this
value will be used to initialize the random number generator.
This is done before each simulation run, this way the results of
random simulations become predictable.
If you set "RS"
to zero, the random number
generator will not be initialized at all. The resulting
pattern is not predictable anymore, and you may generate
different patterns just by pressing the "Generate"
button again and again.
For the other parameters, please consult the book.
Note, that not every set of equations uses all seven substances.
Nevertheless, you must have seven numbers in each parameter section
(except for the "Misc."
-section of course).
Here is a short survival-guide to help you to get certain things done:
"KP"
(might not work
for all texture types, as this actually controls the number of
iterations used to calculate a single column)"Height"
-value."wall"
-parameter
has a value higher than "0.0"
the texture generator will
smoothly fade generated textures to white on the texture position that
corresponds to the beginning of the aperture of the shell.
This way the interior of the shell is not textured at all.
If you change "wall"
to "0.0"
this will not happen."KR"
(randomness)
or the diffusion-constants, which should not be higher than "0.4"
to avoid numeric instabilities.Image operations may be used to combine generated images,
this boasts the number of possible patterns considerably.
You may choose between three effects, mix, add and sub; they should
be self explanatory, if not: simply try them out.
Press <Ctrl+z>
(single step undo) if you are not satisfied
with the results.
Use the associated entry to determine the strength of the effect.
The two source images should have the same dimensions, unless you want funny results.
Since ShellyLib2.3 there is a macro recorder integrated into the Texture Generator.
If recording is enabled, every completely generated texture creation
pass is recorded with all its parameters (including texture size
and image operation) as a macro step.
If the "Stop!"
button is used, no macro step will be recorded.
All macro steps or just the last macro step may be erased using
the menu entries "Clear"
and "Remove Step"
respectively.
Using undo (<Ctrl+z>
) will also remove the last macro step.
A recorded macro may of course also be run using "Run"
, all
recorded steps will be executed in the order of their recording.
Furthermore, a recorded macro will be saved to ShellyLib data files, written by the Shell Laboratory. If a loaded data file contains a texture macro, the Shell Laboratory will offer to run it immediately.
This section shows how the texture for the Sundial shell on the ShellyLib Home Page was created.
"Sundial.shy"
ShellyLib data file from the shy
directory."IrregularStripes"
texture, generate it."Stripes3"
texture."Ctrl+z"
to undo
the last change to the generated texture, if you are unsatisfied with
the result!"KP"
from 20 to 30 ("Set parameter:/Misc"
). This
increases the number of stripes."Brighten"
, change the
strength of the effect to about 80 percent.