Next Previous Contents

4. Using the Shell Laboratory

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.

4.1 The Main Window

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.

4.2 The Main Menu

Shortcuts (accelerators) exist for some of these menu entries, see the menu entries for more information.

4.3 The 3D-View

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.

NURBS

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

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

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...

Key and Mouse bindings

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!

4.4 The Generation Curve Editor

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:

The GCE Menu

The menu items should be self explanatory.

Key and Mouse Bindings

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)

Inserting and Deleting Points

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.

Fetching the Curve from Normal-Mode

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.

4.5 The Texture Editor

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:

The TE Menu

The menu items should be self explanatory.

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

Generating a texture

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:

  1. At first, set the desired size of the texture. If you plan to map the generated texture onto a shape in the Shell Laboratory, you should stick to sizes that are powers of two (64, 128, 256 etc.), as OpenGL demands this. GLU does scale the texture to the next power of two, but this might not deliver best results. This scaling does not affect the size of any exported textures. Note, that some OpenGL implementations impose even more constraints (a maximum texture size of 256x256 for instance). Also note, that some texture type specific parameters may need to be adjusted, if you select a different height than the default height of 128.
  2. Now select the type of the texture, with the "Select type:" listbox. Selecting a type will fill the next two sections of adjustable parameters with default values.
  3. You may alter the type specific settings now. Set colors and adjust parameters of the texture generator, more information about these settings can be found in the next section: Parameters of the texture generator.
  4. Choose an image operation now. The default (Overwrite) simply destroys the old texture.
  5. Now you can generate the texture, using the "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.
  6. The generated texture can be mapped onto a shell now. Simply press "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!

Parameters of the Texture Generator

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:

Image Operations

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.

Macro Recorder

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.

Sundial Tutorial

This section shows how the texture for the Sundial shell on the ShellyLib Home Page was created.

  1. Load the "Sundial.shy" ShellyLib data file from the shy directory.
  2. Open the texture editor.
  3. Set the texture width to 1024.
  4. Choose the "IrregularStripes" texture, generate it.
  5. Now we want to add the perpendicular white stripes to the texture. Choose the "Stripes3" texture.
  6. Set the the start value to 0.0, start color to black (0, 0, 0). Set the end value to 0.5 and the end color to a middle gray (128, 128, 128). This makes the stripes a bit broader(start - end values) and limits the generated color values to 128. For sharper white perpendicular stripes experiment with higher end values. Use "Ctrl+z" to undo the last change to the generated texture, if you are unsatisfied with the result!
  7. Set "KP" from 20 to 30 ("Set parameter:/Misc"). This increases the number of stripes.
  8. Switch to image operation "Brighten", change the strength of the effect to about 80 percent.
  9. Generate again. The brown stripes should now be interrupted by white perpendicular ones.


Next Previous Contents