Personal tools
You are here: Home cmgui Wiki FAQ
Views

FAQ

last edited 1 month ago by dcowan

Here is a repository of previously answered questions.


Which executable.

Question. What CMISS front end executable should I run?

Answer. If you are not at the Bioengineering Institute and want to use CMISS for Academic Research then you can download CMISS.
If you are in the institute then you will may choose to use these same download executables as they will not change on you. Alternatively to take advantage of the latest features you may want to run an up to date executable. For this purpose the cmgui executables in ${CMISS_ROOT}/bin/ are updated whenever they pass all the examples. They are separated into architecture dependent directories. If you follow the instructions in the /cm/wiki/CmNewUserNotes then you will be set up to use these executables.
Linux ${CMISS_ROOT}/bin/i686-linux/cmgui
IRIX ${CMISS_ROOT}/bin/mips-irix/cmgui
AIX ${CMISS_ROOT}/bin/rs6000-aix/cmgui

GTK User Interface Components.

Question. How do I add some User Interface components to my scripts?

Answer. Using Perl/GTK you can add User Interface components to your Cmiss scripts. A module designed to work like the Gtk module is kept in ${CMISS_ROOT}/cmiss_perl, CmGtk.pm
It allows you to write routines such as the following... button.com

use CmGtk;

CmGtk->init();

{
my($window,$button);

#Unforunately the Cmiss interpreter will not let you lay out the following command on multiple lines.
$window = new Gtk::Widget("GtkWindow", type => -toplevel, title => "CmGtk Sample", allow_grow => 0, allow_shrink => 0, border_width => 10);

$create_window_button = new Gtk::Widget("Gtk::Button", label => "Create window", visible => 1);
$create_window_button->signal_connect( "clicked", \&gfx_create_window );

$destroy_window_button = new Gtk::Widget("Gtk::Button", label => "Destroy Window", visible => 1);
$destroy_window_button->signal_connect( "clicked", \&gfx_destroy_window, $create_window_button );

my $box = new Gtk::VBox();
$box->spacing( 15 );
$box->add( $create_window_button );
$box->add( $destroy_window_button );

$window->add( $box );
$window->border_width( 15 );

$window->show_all();
}

sub gfx_create_window {
my( $button ) = @_;

gfx cre win 1;
$button->set_sensitive(0);
}

sub gfx_destroy_window {
my( $button, $create_window_button ) = @_;

gfx des win 1;
$create_window_button->set_sensitive(1);
}

#Making the Destroy Button have sensible sensitivity is an exercise
#which I will leave to the student. :-)

CmGtk->main();

High quality printing.

Question. How do I get high quality output from Cmiss.

Answer. There are a number of things you can do to improve image quality from the gfx print command. Most of them make rendering slower, but hey, this is *final* output!

  1. Turn on anti-aliasing (much slower)
    This sets the number of times the image is oversampled to improve line/edge rendering.  This greatly reduces the pixellated appearance of the displayed graphics. Valid values are 2, 4 and 8, with 8 the best and slowest:
    gfx modify window 1 set antialias 8;
    (To turn it off use gfx modify window 1 set on_antialias.)
    • Note: Anti-aliasing is now supported in hardware on most modern graphics cards - setting your system OpenGL settings to use anti-aliasing will mean the CMGUI graphics window will be anti-aliased by default, and you will not need to use this command.
  2. Bring lines in front of surfaces
    If your image consists of coloured surfaces with lines drawn to mark out element boundaries you will notice that the lines become randomly dashed as the lines and surfaces struggle to be "in front". To ensure the lines are clearly visible,
    enter:
    gfx modify window 1 set perturb_lines;
    NOTE: if you don't need this on then LEAVE IT OFF as it causes other negative artifacts between adjacent surfaces.
    (Turn it off with gfx modify window 1 set normal_lines)
  3. Use a nicer or larger graphics font
    Create a different font with
    gfx create font ...;
    and use that in your graphics.
  4. Make lines thicker
    Up to you. 1 Pixel lines on a large image may look a bit spindly. Enter:
    gfx set line_width 2;
    This doubles their width. You'll have to drag in the graphics window to see the result.
  5. Use the best quality glyphs (slower)
    Choose sphere_hires over sphere, cylinder hires over cylinder12 etc. That's if you are using them.
  6. Print larger (much slower)
    Cmgui will now print up to an arbitrary dimension offscreen by compositing tiles of the lower resolution back together. Increasing the size gets much slower very quickly as each tile becomes spread out over a much larger block of memory and therefore is not cached so well.
    gfx print window 1 width 2048 height 2048 file cmgui_image.sgi
    I recommend sgi image files as a non lossy compressed image format.
  7. Use different transparency rendering
    OpenGL relies on a single depth buffer to ensure correct 3D representation from any direction.  This does not work well when a scene includes any transparent surface.  The transparent surface will still completely occlude any surface that is subsequently drawn after it, including fragments of itself resulting in strange bands.  Cmgui includes several different modes to help improve the problems that can occur.
    Firstly you may improve the situation just by ensuring you draw your graphics from the inside out, so try different ordering in the scene editor.
    gfx modify window 1 set slow_transparency;  #Renders all solid surfaces first in the normal way and then renders all transparent surfaces without a depth test.  All surfaces will now be shown but can still be blended incorrectly.
    gfx modify window 1 set layered_transparency 1000; #Divides space between near and far clippling planes into slices and renders from the back.  This is very slow and has artefacts between the layer boundaries.
    gfx modify window 1 set order_independent_transparency 5;  #Correctly renders up to 5 layers however only currently works with NVIDIA graphics cards as it relies on a number of extensions.
  8. Wait...
    It could take a minute or more depending on the image you are rendering... work out how long it takes to render the window at a certain size with antialiasing on, and scale it by the size you give in step 6.
    You should be pleased with the result!

Quick transform key.

Question. Is there a quick key from getting from node or data select mode to transform mode?

Answer. Yes. The control key toggles you quickly into transform mode.

gfx movie commands.

Question. How come the gfx movie commands don't work on my machine?

Answer. The gfx movie commands provide an interface to an sgi movie library only available on IRIX 32bit. To make movies on Linux, AIX or 64 bit IRIX you should write a sequence of frames and compile them externally.

See the Linux movie making instructions for more information.

Windows version.

Question. Is there are windows version of cmiss and can I use it?

Answer. Yes there is a windows version. The windows version uses wx widgets to describe the interface and the majority of common user interface components have now been implemented.  You can download the windows version from the cmiss release centre.  (See the link at the bottom of the navigation bar on the elft.

To execute these executables you may need to put cmiss/lib into your path or run from within that directory so that windows can find the dlls". On windows 2000 the path is well hidden in control_panel->system->advanced->system_variables.

Movie making under Linux

Question. Can I make movies using Linux?

Answer. Yes.
You need to consider what codec you want to target. The old Cinepak and Indeo codecs supported on the SGI machines are widely supported by built in libraries on Windows, however the results are poor and the file size large. Instead you may want to try mpeg2 (same as a DVD) or DIVX derivatives. However, while windows media and quicktime players will support these formats they are not included with the executable, instead the player tries to find a codec when you first play the movie. Also sometimes it helps to try different (incorrect) file extensions as this seems to change the way the windows players determines what codecs to try.
To make a MPEG2 movie on Linux using mjpegtools you need at least two programs, jpeg2yuv and mpeg2enc. As the input must be jpegs (and in cmgui you cannot change the jpeg quality on export yet) we generally write sgi image files and then convert them to jpeg using a little script, sgi2jpg.pl which uses convert from imagemagick. The maximum dimensions that you can use are about 720x576 so you need to be smaller than this. Then these are run through mjpegtools, something like

jpeg2yuv -f 25 -I p -b 1 -j images/pressure_anti_%d.jpg | mpeg2enc -f 3 -b 3800 -a 1 -o test3.m2v
To make this work with Windows media player on windows 2000 we changed the file extension to .qt

For the DIVX type derivatives you need some other tools like transcode which supports a large number of file converters. With the divx4linux libraries and divx I can make an DIVX AVI using transcode. Firstly you need a file containing the list of frames.

find images/ ! -type d -name "*.jpg" > list		
Transcode cannot detect the size of your images, so if they are 640x640 then you need to specify this on a command like this...
transcode -i list -x imlist,null -g 640x640 -o pressure_anti.avi -y divx4 -w 1618

Apply transformations to nodes

Question. I have used the transformation controls to shift my mesh but the nodes haven't actually moved, how do I update the nodes?

Answer. The transformation controls only shift the objects graphically. So I have added a quick hack that allows you to apply the same transform to the nodes. Unfortunately it will not work correctly if you have rotated derivatives. The command to apply the transformation you have made to element group "bob" is

gfx edit graphics name bob scene default apply_transformation

Choosing your OpenGL implementation

Question. How do I know what OpenGL implementation I am using? and how do I change it?

Answer. When you are running cmgui you can find out information on the OpenGL you are using from the command

gfx list window NAME
This will list the OpenGL version, the vendor driver and some information about the visual.
If you are using an NVIDIA graphics card then this should be an NVIDIA driver if you want to get the maximum performance from your graphics card.
If you experience problems with the accelerated drivers, and then you may get better results from using the software Mesa3D OpenGL implementation.
On some systems the Mesa3D is integrated with your X server to give accelerated 3D.

To control what driver you are using you simply need to ensure that the dynamic library you want is first in your library load path.
On linux this library is libGL.so. To see which library is currently being loaded run

ldd cmgui
in a shell. This lists all the dynamic libraries and where they are being resolved on your system. With the standard Mesa3D implemenentation supplied with XFree86 this will probably be in /usr/X11R6/lib, with the accelerated NVIDIA drivers this will be in /usr/lib.

To change the library you can set an environment variable.
On linux this is LD_LIBRARY_PATH. On bioeng systems you can use an up to date Mesa3D build by setting

for csh type shells
setenv LD_LIBRARY_PATH /hpc/cmiss/mesa/lib/i686-linux/
or for bash type shells
export LD_LIBRARY_PATH=/hpc/cmiss/mesa/lib/i686-linux/

On irix this is LD_LIBRARYN32_PATH for n32 and LD_LIBRARY64_PATH for 64 (although if the corresponding variable is not set it also uses LD_LIBRARY_PATH). On bioeng systems you can use an up to date Mesa3D build by setting
for csh type shells
setenv LD_LIBRARYN32_PATH /hpc/cmiss/mesa/lib/mips-n32-irix/
or for bash type shells
export LD_LIBRARYN32_PATH=/hpc/cmiss/mesa/lib/mips-n32-irix/

On aix this is LIBPATH. On hpc you can use an up to date Mesa3D build by setting
for csh type shells
setenv LIBPATH /hpc/cmiss/mesa/lib/rs6000-32-aix/
or for bash type shells
export LIBPATH=/hpc/cmiss/mesa/lib/rs6000-32-aix/
This Mesa3D implementation may be particularly useful from hpc1 when you are experiencing problems with your graphics.
On OSX (Darwin) this is DYLD_LIBRARY_PATH.
for csh type shells
setenv DYLD_LIBRARY_PATH /hpc/cmiss/mesa/lib/ppc-32-darwin/
or for bash type shells
export DYLD_LIBRARY_PATH=/hpc/cmiss/mesa/lib/ppc-32-darwin/

Transparent textures

Question. My texture image has transparancy (an alpha channel), why is it opaque when viewed in cmgui?

Answer. Textures are applied in either decal or modulate mode.

When in decal mode,
the texture works like a sticker, and the alpha tells you how much to merge with the surface underneath.

When in modulate mode,
the texture adjusts the properties of the material and so changes the alpha of the underneath surface.

Contributing to this site

Please add to the wiki any relevant information that you think might be useful to other users of this website. For example, you might like to contribute your experiences, questions and answers.

You are encouraged to contribute to this site regardless of your level of experience. Contributions are welcomed from new and regular visitors.

If you ask a question and receive an answer from a developer you should record it in the wiki. This information is extremely useful and can help other users overcome the same problem.

See how to add and edit pages for more information.