//////////////////////////////////////////////////
/////  Fukui Renderer                        /////
/////  DAWN (Drawer for Academic WritiNgs)   /////
/////                                        /////
//////////////////////////////////////////////////

               Authors:
                 Satoshi   Tanaka    (Fukui University, JAPAN)
                 Minato    Kawaguti  (Fukui University, JAPAN)
                 Hiroshi   Hasui     (Fukui University, JAPAN)
                 Yoshitaka Kawabata  (Fukui University, JAPAN)
                 Takeshi   Konya     (Fukui University, JAPAN)
                 Tetsuji   Nishimura (Fukui University, JAPAN)
                 Masahiro  Noguchi   (Fukui University, JAPAN)
                 Kensuke   Ohtubo    (Fukui University, JAPAN)
                 Yasuhide  Sawada    (Fukui University, JAPAN)
                 Masayasu  Kawabata  (Fukui University, JAPAN)                 

               E-mail:
                 tanaka@i1nws1.fuis.fukui-u.ac.jp


               Download:
               http://geant4.kek.jp/~tanaka
               ftp://rhodes.fuis.fukui-u.ac.jp
                                   /pub/graphics/fukui_graphics_system/ 

                (File name: dawn_VERSION.tar.gz (Unix), 
                            WinDAWNVersion      (Windows) )
                                   

 What's new? 





<< What is DAWN? >>

  Fukui  Renderer   DAWN (Drawer for Academic WritiNgs) 
  is a renderer, which reads 3D geometrical data and visualize them.  
  It is a vectorized 3D PostScript processor. 
  It aims at precise technical drawing of complicated objects.  
  It performs geometrical hidden line/surface removal and calculates 
  out all visible parts of the 3D data before drawing.  This drawing 
  algorithm realizes device-independent technical high quality of
  vectorized graphics.
    3D Data files should be generated by a modeler or by hands 
  separately.  If you use DAWN as a visualizer of, 
  say, a simulator of physical experiments, 
  the simulator application itself is recognized as a modeler.
    An important feature of DAWN is that
  it has been developed to visualize 3D data generated by
  a high-energy experimental detector simulator "GEANT4".  
  How to use DAWN as  a visualizer of GEANT 4 is also described below.

<< Platform >>

  In order to use DAWN, the following softwares and libraries 
  should be installed beforehand (Items in () are optional):

  (1) UNIX with X-Window or Windows NT/98 
  (2) Tcl/Tk 
      ( http://www.scriptics.com/software/8.0.html )
  (3) PostScript-file viewer
  ( (4) Ghostscript )
  ( (5) OpenGL or Mesa )

<< How to compile and install DAWN in UNIX >>

  In order to compile DAWN, you need a C++ compiler 
  and  "make" utility for it. 

  Decompose the DAWN parckage dawn_VERSION.tar.gz, 
  go to the directory "dawn_VERSION", 
  and do the followings.

  (Case 1) In case you want to use OpenGL mode:

           % make clean
           % make guiclean
           % configure 
            (* Answer all questions properly.)
           % make 

  (Case 2) In case you do NOT want to use OpenGL mode, 
           and only want to use X-Window and 
           PostScript-file-generation modes:

           % make clean
           % make guiclean
           % configure_xwin 
            (* Answer all questions properly.)
           % make 

  (Case 3) In case you want to use neither OpenGL, X Window, ghostscript, 
           nor socket connection, 
           and are only interested in viewing generated EPS files with your 
           PostScript-file viewer, do the followings:

           % make clean
           % make guiclean
           % configure_min
             (* Answer all questions properly.)
           % make 

           Also, before executing DAWN, set the environmental
           variable "DAWN_PS_PREVIEWER" to the name of your 
           PostScript-file viewer:

           % setenv DAWN_PS_PREVIEWER "PostScript-file_viewer"

           In Unix version of DAWN, the default value of the 
           DAWN_PS_PREVIEWER is "ghostview.  
           Set this variable to "NONE" if you want to skip previewing:

           % setenv DAWN_PS_PREVIEWER "NONE"

  In all the above cases, "make" generates executable files 
  "dawn" and "DAWN_GUI_menu".  
  You need both of them for executing DAWN.
  The former is DAWN itself and the latter is a GUI program. 
  
  Next, do "make install". (You may have to become root beforehand.)

  % make install

  Then "dawn",  "DAWN_GUI_menu",
  and shell scripts "dawninetd", "dawn_unixd" are 
  installed (copied) to the directory specified 
  in executing the configure script.

  You can test your compiled DAWN before performing the installation. 
  See below.

<< How to compile DAWN in Windows 2000/NT/98/Me >>

 You can compile and install DAWN with Microsoft Visual C++ version 6.0.

 Once installed,  DAWN can be invoked either from DOS or Cygnus
 windows. How to compile and install DAWN is as follows.

 (0) Install Visual C++ 6.0, and set PATH to
     its "bin" directory, e.g. "C:\Program Files\DevStudio\VC\bin".

 (1) Install Tcl/Tk 8.0 for Windows 2000/NT/98/Me into 
     the default directory, i.e. C:\Program Files\Tcl.
     Check if the file name of wish is "wish80.exe".
     (You can obtain Tcl/Tk from the following site:  
       http://www.scriptics.com/software/8.0.html )

 (2) Install GSview into the default directory, i.e. 
     C:\gstools.
     (You can obtain GSview from the following site:  
      http://www.cs.wisc.edu/~ghost/aladdin/        )

 (3) Add "autoexec.add" to autoexec.bat
     This sets PATH to wish80.exe, g4view32.exe and DAWN itself.

 (4) Open DOS Window


 (5) DOS> cd dawn_VERSION

 (6) DOC> config_vc.bat

 (7) Execute vcvars32.bat in the "bin" directory of Visual C++, e.g.,
     DOS> "C:\Program Files\DevStudio\VC\bin\vcvars32.bat"

 (8) DOS> nmake

 (9) DOS> dawn_install.bat
     (DAWN is installed into "C:\Program Files\DAWN")

 (10) Reboot PC

 You can obtain the executable binary package from 
 our ftp site.

<< How to test DAWN >>

  In order to test DAWN, go to the directory 
  "dawn_VERSION/PRIM_DATA": 

   % cd dawn_VERSION/PRIM_DATA

  In PRIM_DATA, there are several g4.prim-format test data 
  files with an extension ".prim".  You can visualize 
  each data file with DAWN.  For example:

     % ../dawn  primitives.prim 
     % ../dawn  primitives2.prim 

  Files  "primitives.prim"  and "primitives2.prim" display 
  all kinds of 3D primitives which are visualizable by DAWN. 
  Try other data files, too.  Some of them are generated by GEANT4.

  Note: 
    A suitable camera distance is different 
    in each data.  We recommend to use the "AUTO"
    mode by simply giving a value "0" to the 
    Camera Distance entry (the top entry of the GUI menu).

<< Data format >>

  DAWN can read two kinds of data format, the  
  "B-rep format" and "g4.prim format"   

  (1) B-rep format  

     The "B-rep format"  is described in "./BREP_DATA/BREP_FORMAT.tex". 
     There are sample data files in the directory  ./BREP_DATA.
     A B-rep format data file can be visualized by

       % dawn -b [other option(s)] filename(s) 

     You can give plural data files and generate a combined picture.

  (2) g4.prim format

     The "g4.prim format", which has been developed for GEANT4 visualization, 
     is described in  "dawn_VERSION/PRIM_DATA/G4PRIM_FORMAT.tex".
     There are sample data files in the directory  PRIM_DATA.
     A g4.prim-format data file can be visualized by 

       % dawn [option(s)] filename

     It is equivalent to 

       % dawn -v [other option(s)] filename

<< Supported options >>

 The following options are supported:

       -b: B-rep format viewer mode 
       -d: Skip invoking GUI menu, and use the 
           previous parameter stored in a file
           ".dawn.history" in the current directory. 
       -g: inter-process-communication mode 
           (Unix domain (named pipe) used by dawnunixd)
       -G: inter-process-communication mode 
           (INET domain, used by dawninetd)
       -h: Help
       -o: Result of hidden-surface removal is 
           output to file "polygon.out", which 
           is reusable for redrawing and/or 
           additional drawing.  This file 
           also remembers camera parameters 
           used in the hidden-surface removal.
           Another file "camera.out" is also
           output.   This file remembers only 
           camera parameters, and it can be used 
           for rescaling.
           The -o option works only when -b option
           is set.
       -t: swap on/off of forceible wireframe attribute 
           assigned to each 3D primitive
       -v: g4.prim-format-viewer mode (default)

<< History mechanism >>

   DAWN remembers parameters (camera distance etc) used
   in the previous execution, and display them on GUI menu as the 
   initial values. The parameters are stored in ".dawn.history"
   in the current directory.  File ".dawn.default"
   stores default parameters.  Contents of these files 
   can be different in different directories, i.e., 
   in different kinds of works.

<< How to customize DAWN with environmental variables >>

  DAWN can be customized by setting environmental variables.
  See the file "CUSTOMIZE" for the variations.   
  You can edit (, rename) and source the file CUSTOMIZE 
  for your own customization.  Default values are also 
  described there.  

<< Visualization of B-rep format data >>

  (This format is an old format of DAWN, and is not supported 
   officially now. We recommend to use g4.prim format explained 
   below instead.)

  In order to see how to visualize B-rep format data, go to the directory 
  "./BREP_DATA":

  % cd ./BREP_DATA

  (1) Visualization of each data file

     In ./BREP_DATA, there are several B-rep format test data 
     files with an extension ".data".  You can visualize 
     each data file with DAWN.  For example:

     % ../dawn -b boxes.data

     Try other data files, too.

     Note: 
       A suitable camera distance is different 
       in each data.  We recommend to use the "AUTO"
       mode by simply giving a value "0" (zero) to the 
       Camera Distance entry (the top entry of the GUI menu).

  (2) Visualization of plural data files at one time

     Try the following to test visualizing 
     plural data files, i.e. plural objects:

     % ../dawn  -b box_1x4y9z.data  axes.data
     % ../dawn  -b detector.data  detector_axes.data

  (3) Redrawing and additional drawing

     Try the followings to test redrawing and additional 
     drawing.  The file "detector_polygon.out"
     is a renamed "polygon.out" file 
     (see description of -o option) for the data 
     "detector.data".  The file "detector_camera.out"
     is a renamed "camera.out" file for the same data. 
     In "detector_camera.out", a line for the focalDistance 
     is edited and modified.  This exhibits a way of 
     performing rescaled drawing of "polygon.out" data.
     (The data of "detector.data" is taken from the following 
     document:  "Technical Design Report SDC", SDC-92-201, 
     SDCL-SR-1215, 1992.)

     ----- simple redrawing -----
     % ../dawn   detector_polygon.out  

     ----- rescaled redrawing -----
     % ../dawn   detector_polygon.out  detector_camera.out

     ----- Additional drawing -----
     % ../dawn   detector_polygon.out  detector_axes.data

     ----- Changing color of polygon.out data -----
     Make a file with name "detector_polygon.out.att",
     and put it in the same directory as "detector_polygon.out" :

     % cat detector_polygon.out.att
     color  r g b 

     Here, r, g, and b is a RGB value between 0 and 1.

     % ../dawn   detector_polygon.out  

<< Visualization of g4.prim-format data >>

  DAWN can visualize the so-called g4.prim-format data.
  This data format is developed for efficient visualization of 
  GEANT4 simulation.  
  Details of the g4.prim format is described in 
  "dawn_VERSION/DOC/G4PRIM_FORMAT_XX.tex".
  In PRIM_DATA, there are several g4.prim-format test 
  data files with an extension ".prim".  You can visualize 
  each data file with DAWN:

      % cd dawn_VERSION/PRIM_DATA
      % dawn  filename

     It is equivalent to 

     % dawn -v  filename

  DAWN can also read g4.prim-format data by receiving them 
  from other process.  The process can be either 
  in the same host or in a remote host.
  That is to say, DAWN supports "remote graphics".
  There are several ways to visualize g4.prim-format data
  sent via inter-process communication.

  Before performing the following test, compile the test program
  "g4test_inet" and "g4test_unix" and go to the directory PRIM_DATA.

  % cd dawn_VERSION
  % make g4test_inet
  % make g4test_unix
  % cd PRIM_DATA

  (Way 1)  You can use daemon mode in INET domain.
           By default, hostname is automatically set to
           the local host name.
           The default port number is "40701".
           If a selected port is already in use,
           the port number is automatically incremented 
           one by one up to 40710.

          ===== Example =====
           % dawninetd 

           And in a different window,

           % g4test_inet filename

  (Way 2)  You can use daemon mode in INET domain,
           and run g4test_inet at a remote host.

           Hostname is set by setting the environmental 
           variable "G4DAWN_HOST_NAME".
           The default port number is "40701"
           If a selected port is already in use,
           the port number is automatically incremented 
           one by one upto 40710.

         ===== Example =====
         DAWN        Host (Local ) : i1dec2.fuis.fukui-u.ac.jp
         g4test_inet Host (Remote) : cernsp.cern.ch

         ------------ DAWN Host  -----------
         i1dec2 % dawninetd
      
         ------------ g4test_inet Host ------------
         cernsp % setenv G4DAWN_HOST_NAME i1dec2.fuis.fukui-u.ac.jp
         cernsp % g4test_inet filename.prim

  (Way 3) If your system supports Unix domain connection,
          i.e., named pipe connection,
	  you can use daemon mode of Unix domain.
          Sun path is "FR_TMP3".

          ===== Example =====
           % dawnunixd

           And in a different window,

           % g4test_unix filename


<< Drawing edges >>

  Ability of drawing edges sharply is one of the most 
  characteristic features of DAWN. 
  At rendering time, DAWN automatically distinguishes 
  (1) ordinary edges, (2) auxiliary edges, and (3) outline edges. 

   (1) An ordinary edge means a line segment formed between
       two facets, whose normal vector makes an angle greater
       than a given threshold angle.

   (2) An auxiliary  edge means a line segment formed between
       two facets, whose normal vector makes an angle smaller 
       than a given threshold angle.

   (3) An outline edge means a line segment formed between
       two facets, one of which is shows its front face to camera and 
       the other of which shows its back face.

  The threshold angle can be given on the GUI panel. 
  Its default value is 70.0 degrees.
  Each kind of edges can be assigned different style and width on 
  the GUI panel.  


<< Using DAWN for GEANT4 visualization >>

  DAWN is available for visualizing GEANT4 simulation.
  DAWN supports all CSG shapes defined in GEANT4.
  DAWN is connected to GEANT4 via inter-process communication,
  either with INET or Unix domain.

(1) Connecting GEANT4 to DAWN

   (Case A) Connection at the same host 

       By default,  connection between DAWN and
       GEANT4 is established within the same host automatically. 
       The connection is made via TCP/IP socket.
       (You have to install DAWN beforehand, of course.)
       DAWN is invoked by DAWN driver in GEANT4 automatically, 
       when the following command is performed:
       
         Idle> /vis/create_view/new_graphics_system DAWN 

       If the environmental variable  "G4DAWN_NAMED_PIPE" 
       is set to "1", i.e., 
       
         % setenv  G4DAWN_NAMED_PIPE  1

       Unix domain connection, i.e. named pipe connection, 
       is used.  

       WARNING: Some OS, e.g. AIX, does not support 
                Unix domain connection.

   (Case B) Connection at different hosts:

       In order to connect GEANT4 to DAWN running 
       in a different host via TCP/IP socket, 
       you have to do the following  steps.

       ---------- In DAWN host -------
       Invoke DAWN  with -G option       connection by GEANT4.

       % dawn -G 

       or, equivalently,  

       % dawninetd

       It makes DAWN invoked with network mode, and make DAWN 
       wait for connection request from GEANT4.

       ---------- GEANT4 host -------
       (1) Set the environmental variable  "G4DAWN_HOST_NAME", 
           in which you give hostname where dawn is running 
           with -G option (see above).  For example, 

           % setenv  G4DAWN_HOST_NAME  i1dec2.fuis.fukui-u.ac.jp 

           WARNING:  If the environmental variable 
                     G4DAWN_NAMED_PIPE  is set to "1"
                     The environmental variable G4DAWN_HOST_NAME
                     is ignored.

       (2) Invoke GEANT4 and perform the command as follows:

          Idle > /vis/create_view/new_graphics_system DAWN 

(2) X event handling

    When the drawing device X (or X-LS, landscape mode) is
    selected on the GUI panel, the following X-event handling 
    is available on the viewing window.

	           : go on to next drawing
	 : no effect"         
	 : invoke GUI and redraw
	 : go on to next drawing ( = Key ) 
    
(3) Re-visualization using a g4.prim file (GEANT4 off-line visualization)

   Drawn 3D data sent from GEANT4 are saved in a file "g4.prim".
   You can redraw the saved data as: 

    % dawn  g4.prim

   without help of GEANT4 with different viewing parameters.

(4) Multiple viewing of one scene

    Once a scene is visualized, you can re-visualize the scene 
    with different attributes, drawing styles, camera positions, 
    drawing devices etc, using data stored in g4.prim.
    Push the middle mouse button on the viewing window,
    and select attributes etc on the popped up GUI menu.
    Then re-visualization is performed in a new viewing 
    window.

(5) How to invoke GUI menu 

    By default, DAWN's GUI menu is not invoked,
    since GEANT4 has its own GUI.

    But  GEANT4's  GUI does not supports all 
    selectable issues of DAWN. 

    If you want to always invoke DAWN's GUI before 
    each drawing, 
    set the  environmental variable G4DAWN_GUI_ALWAYS to  "1":

      %  setenv  G4DAWN_GUI_ALWAYS   "1" 

(6) How to save drawn figures to EPS file

    Select EPS of EPS-LS (landscape mode) in GUI menu.

    In order to always generate printable PS file,
    set the environmental variable DAWN_ADD_SHOWPAGE to "1":

     %  setenv DAWN_ADD_SHOWPAGE  1


<< Associated Tools >> 

   We are developing tools to assist DAWN users.
   It is included in dawn_XXX/TOOLS.
   You can use them by invoking make there:

   % cd dawn_XXX/TOOLS
   % make

   Note that you have to install the tools by hands, e.g.,

   % cp dawn_epsclipper /usr/local/bin

   Tools included in dawn_XXX/TOOLS are:
     (A) DAWN EPS clipper: This tool clips EPS figures generated 
                           by DAWN with a given rectangle.
     (B) dawn_eps2ps       : This tool convert EPS file to PS file.

   For details, read dawn_XXX/TOOLS/README.

<< Copy right>>

  Authors claim their copy rights for DAWN.
  Authors cannot be responsible for any kinds of damages 
  caused by DAWN.

=============== END of README ===============