Personal tools
You are here: Home / cmgui / Wiki / FAQ
Log in

Forgot your password?


<p> Here is a repository of previously answered questions. </p> <ul><li>

<a href="#which_executable">Which executable to use?</a>
<a href="#gtk_user_interface_components">GTK User Interface Components</a>
<a href="#high_quality_printing">High quality printing</a>
<a href="#quick_transform_key">Quick transform key</a>
<a href="#gfx_movie_commands">GFX movie commands</a>
<a href="#windows_version">Windows version</a>
<a href="#movie_making_under_linux">Movie making under Linux</a>
<a href="#applying_transformation">Apply transformations to nodes</a>

</li> <li>

<a href="#choosing_openGL">Choosing your OpenGL implementation</a>

</li> <li>

<a href="#texture_transparency">Texture transparency</a>

</li> </ul>

<hr> <p> <a name="which_executable"></a> </p><h2>Which executable.</h2>

<p><a name="which_executable"></a><b>Question.</b> What CMISS front end executable should I run?</p>

<p><a name="which_executable"></a><b>Answer.</b> If you are not at the Bioengineering Institute and want to use CMISS for Academic Research then you can <a href="/ReleaseCenter">download CMISS</a>. <br>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 <a href="/cm/wiki/CmNewUserNotes">/cm/wiki/CmNewUserNotes</a> then you will be set up to use these executables.

<br>Linux ${CMISS_ROOT}/bin/i686-linux/cmgui <br>IRIX ${CMISS_ROOT}/bin/mips-irix/cmgui <br>AIX ${CMISS_ROOT}/bin/rs6000-aix/cmgui </p>

<p> <a name="gtk_user_interface_components"></a> </p><h2>GTK User Interface Components.</h2>

<p><b>Question.</b> How do I add some User Interface components to my scripts?</p>

<p><b>Answer.</b> 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,

<br>It allows you to write routines such as the following... <a href=""></a> </p>

<pre>use CmGtk;<br><br>CmGtk-&gt;init();<br><br>{<br> my($window,$button);<br><br> #Unforunately the Cmiss interpreter will not let you lay out the following command on multiple lines.<br> $window = new Gtk::Widget("GtkWindow", type =&gt; -toplevel, title =&gt; "CmGtk Sample", allow_grow =&gt; 0, allow_shrink =&gt; 0, border_width =&gt; 10);<br><br> $create_window_button = new Gtk::Widget("Gtk::Button", label =&gt; "Create window", visible =&gt; 1);<br> $create_window_button-&gt;signal_connect( "clicked", &amp;gfx_create_window );<br><br> $destroy_window_button = new Gtk::Widget("Gtk::Button", label =&gt; "Destroy Window", visible =&gt; 1);<br> $destroy_window_button-&gt;signal_connect( "clicked", &amp;gfx_destroy_window, $create_window_button );<br><br> my $box = new Gtk::VBox();<br> $box-&gt;spacing( 15 );<br> $box-&gt;add( $create_window_button );<br> $box-&gt;add( $destroy_window_button );<br><br> $window-&gt;add( $box );<br> $window-&gt;border_width( 15 );<br><br> $window-&gt;show_all();<br>}<br><br>sub gfx_create_window {<br> my( $button ) = @_;<br><br> gfx cre win 1;<br> $button-&gt;set_sensitive(0);<br>}<br><br>sub gfx_destroy_window {<br> my( $button, $create_window_button ) = @_;<br><br> gfx des win 1;<br> $create_window_button-&gt;set_sensitive(1);<br>}<br><br>#Making the Destroy Button have sensible sensitivity is an exercise<br>#which I will leave to the student. :-)<br><br>CmGtk-&gt;main();<br></pre>

<p> <a name="high_quality_printing"></a></p> <h2>High quality printing.</h2>

<p><b>Question.</b> How do I get high quality output from Cmiss. </p>

<p><b>Answer.</b> 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! Note that both the rendering time and quality can be improved by using a computer with a decent graphics card.<br></p>

<ol> <li><b>Turn on anti-aliasing (much slower)</b> <br>This sets the number of times the image is oversampled to improve line/edge rendering.&nbsp; This greatly reduces the pixellated appearance of the displayed graphics. Valid values are 2, 4 and 8, with 8 the best and slowest: <br>gfx modify window 1 set antialias 8; <br>(To turn it off use gfx modify window 1 set on_antialias.) <br><ul><li><b>Note:</b> 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.</li><li><b>Note:</b> If you wish to use anti-aliasing and offscreen rendering to print a large image you will need to use cmgui-motif.&nbsp; Unfortunately cmgui-wx does not yet support anti-aliasing for offscreen rendering.<br></li></ul></li><li><b>Bring lines in front of surfaces</b> <br>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, <br>enter: <br>gfx modify window 1 set perturb_lines;<br>NOTE: if you don't need this on then LEAVE IT OFF as it causes other negative artifacts between adjacent surfaces. <br>(Turn it off with gfx modify window 1 set normal_lines) </li><li><b>Only render exterior elements for volume meshes (faster)</b> <br>If you are using a volume mesh without transparency you may be spending unnecessary effort on calculating triangles for interior elements which will not be visible.&nbsp; Sometimes these interior elements can also produce artefacts. If rendering is taking too long or surface artefacts are visible try setting only the exterior elements to be visible.<br>This can be done by adding the word exterior to your commands that generate surfaces, eg: <br>gfx modify g_element heart surfaces exterior material heart; </li>

<li><b>Use a nicer or larger graphics font</b> <br>Create a different font with<br>gfx create font ...;<br>and use that in your graphics.<br></li>

<li><b>Make lines thicker</b> <br>Up to you. 1 Pixel lines on a large image may look a bit spindly. Enter: <br>gfx set line_width 2;<br>This doubles their width. You'll have to drag in the graphics window to see the result. </li>

<li><b>Use the best quality glyphs (slower)</b> <br>Choose sphere_hires over sphere, cylinder hires over cylinder12 etc. That's if you are using them. </li><li><b>User higher element discretisation (much slower)</b> <br>Increase your element discretisation which will result in surfaces being rendered with more triangles and lines being rendered with more line segments.&nbsp; eg: <br>gfx modify g_element heart general element_discretization "8*8*8" </li>

<li><b>Print larger (much slower)</b> <br>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.
<br>gfx print window 1 width 2048 height 2048 file cmgui_image.sgi <br>I recommend sgi image files as a non lossy compressed image format.</li><li><b>Use different transparency rendering (can be much slower)<br></b>OpenGL relies on a single depth buffer to ensure correct 3D representation from any direction.&nbsp; This does not work well when a scene includes any transparent surface.&nbsp; The transparent surface will still completely occlude any surface that is subsequently drawn after it, including fragments of itself resulting in strange bands.&nbsp; Cmgui includes several different modes to help improve the problems that can occur.<br>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.<br>gfx modify window 1 set slow_transparency;&nbsp; #Renders all solid surfaces first in the normal way and then renders all transparent surfaces without a depth test.&nbsp; All surfaces will now be shown but can still be blended incorrectly.<br>gfx modify window 1 set layered_transparency 1000; #Divides space between near and far clippling planes into slices and renders from the back.&nbsp; This is very slow and has artefacts between the layer boundaries.<br>gfx modify window 1 set order_independent_transparency 5;&nbsp; #Correctly renders up to 5 layers however only currently works with NVIDIA graphics cards as it relies on a number of extensions.</li><li><b>Use per pixel lighting<br></b>If your graphics card supports per pixel lighting you may get a big improvement over
the equivalent lighting with standard shading, even if using a lower element discretisation setting.&nbsp; Modify your material to use the per pixel lighting mode (you may need to modify the default light postion too):<br><pre>gfx modify material muscle per_pixel_mode;<br>gfx modify light default point position 0 100 -100;<br></pre></li><li><b>Wait...<br></b>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 8. <br>You should be pleased with the result! </li> </ol>

<p> <a name="quick_transform_key"></a> </p> <h2>Quick transform key.</h2>

<p><b>Question.</b> Is there a quick key from getting from node or data select mode to transform mode? </p>

<p><b>Answer.</b> Yes. The control key toggles you quickly into transform mode. </p>

<p> <a name="gfx_movie_commands"></a> </p> <h2>gfx movie commands.</h2>

<p><b>Question.</b> How come the gfx movie commands don't work on my machine? </p>

<p><b>Answer.</b> 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.


<p>See the <a href="#movie_making_under_linux">Linux movie making
instructions</a> for more information.


<a name="windows_version"></a> <h2>Windows version.</h2>

<p><b>Question.</b> Is there are windows version of cmiss and can I use it? </p> <p><b>Answer.</b> 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.&nbsp; You can download the windows version from the cmiss release centre.&nbsp; (See the link at the bottom of the navigation bar on the elft.<br></p><p>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-&gt;system-&gt;advanced-&gt;system_variables.

<br><br></p><a name="movie_making_under_linux"></a> <h2>Movie making under Linux</h2>

<p> <b>Question.</b> Can I make movies using Linux? </p>

<p><b>Answer.</b> Yes.
<br>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.
<br>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 <a href="">script,</a> 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
</p><pre>jpeg2yuv -f 25 -I p -b 1 -j images/pressure_anti_%d.jpg | mpeg2enc -f 3 -b 3800 -a 1 -o test3.m2v<br></pre>
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.
</p><pre>find images/ ! -type d -name "*.jpg" &gt; list <br></pre>
Transcode cannot detect the size of your images, so if they are 640x640

then you need to specify this on a command like this...

<pre>transcode -i list -x imlist,null -g 640x640 -o pressure_anti.avi -y divx4 -w 1618<br></pre>

<a name="applying_transformation"></a> <h2>Apply transformations to nodes</h2>

<p> <b>Question.</b> I have used the transformation controls to shift my

mesh but the nodes haven't actually moved, how do I update the nodes?

</p> <p> <b>Answer.</b> 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

</p> <pre>gfx edit graphics name bob scene default apply_transformation<br></pre>

<a name="choosing_openGL"></a> <h2>Choosing your OpenGL implementation</h2>

<p> <b>Question.</b> How do I know what OpenGL implementation I am using? and

how do I change it?

</p> <p> <b>Answer.</b> When you are running cmgui you can find out information on

the OpenGL you are using from the command

</p> <pre>gfx list window NAME<br></pre>

This will list the OpenGL version, the vendor driver and some information about the visual.
<br>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.
<br>If you experience problems with the accelerated drivers, and then you may get
better results from using the software Mesa3D OpenGL implementation.
<br>On some systems the Mesa3D is integrated with your X server to give
accelerated 3D.
<p>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.
<br>On linux this library is To see which library is currently
being loaded run


<pre>ldd cmgui<br></pre> 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.

<p>To change the library you can set an environment variable. <br>On linux this is LD_LIBRARY_PATH. On bioeng systems you can use an up to

date Mesa3D build by setting


<pre>for csh type shells<br>setenv LD_LIBRARY_PATH /hpc/cmiss/mesa/lib/i686-linux/<br>or for bash type shells<br>export LD_LIBRARY_PATH=/hpc/cmiss/mesa/lib/i686-linux/<br> </pre> <br>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

<pre>for csh type shells<br>setenv LD_LIBRARYN32_PATH /hpc/cmiss/mesa/lib/mips-n32-irix/<br>or for bash type shells<br>export LD_LIBRARYN32_PATH=/hpc/cmiss/mesa/lib/mips-n32-irix/<br> </pre>

<br>On aix this is LIBPATH. On hpc you can use an up to
date Mesa3D build by setting

<pre>for csh type shells<br>setenv LIBPATH /hpc/cmiss/mesa/lib/rs6000-32-aix/<br>or for bash type shells<br>export LIBPATH=/hpc/cmiss/mesa/lib/rs6000-32-aix/<br></pre> This Mesa3D implementation may be particularly useful from hpc1 when you are

experiencing problems with your graphics.

<br>On OSX (Darwin) this is DYLD_LIBRARY_PATH.

<pre>for csh type shells<br>setenv DYLD_LIBRARY_PATH /hpc/cmiss/mesa/lib/ppc-32-darwin/<br>or for bash type shells<br>export DYLD_LIBRARY_PATH=/hpc/cmiss/mesa/lib/ppc-32-darwin/<br></pre>

<a name="texture_transparency"></a> <h2>Transparent textures</h2>

<p> <b>Question.</b> My texture image has transparancy (an alpha channel), why is it opaque when viewed in cmgui? </p> <p> <b>Answer.</b> Textures are applied in either decal or modulate mode. <br> </p><p> When in decal mode,<br> the texture works like a sticker, and the alpha tells you how much to merge with the surface underneath. </p> <p> When in modulate mode,<br> the texture adjusts the properties of the material and so changes the alpha of the underneath surface. </p>