<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>Elaboration of New Viewing Modes in CATIA CAD for Lighting Simulation Purpose*</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Eliss</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>y Birukov[</string-name>
          <email>birukov@gin.keldysh.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>y Volo</string-name>
          <email>voloboy@gin.keldysh.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>nisov[</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>The Keldysh Institute of the Applied Mathematics of RAS</institution>
          ,
          <addr-line>Moscow</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>During integration of lighting simulation systems into CATIA CAD often are needed additional view modes initially absent in this CAD. This article describes adding such view modes directly in CATIA workspace window using CATIA's native CAA RADE programming environment. Adding these new view modes can significantly simplify user's preparation of data for lighting simulation. Here the following additional view modes are mentioned: geometry tessellation to triangular meshes (in the wireframe mode), heat map display of the optical values distribution over the scene, and spherical panorama preview. In the paper the problems which may occur while trying to redraw the additional data in real time are described and possible ways of solving or bypassing them are proposed. Using the new display modes provides a possibility of tuning some scene parameters and viewing preliminary results immediately while rendering of such scenes may take several hours. Such additional functionality can significantly increase the modeling process.</p>
      </abstract>
      <kwd-group>
        <kwd>Computer-aided Design</kwd>
        <kwd>Optical Simulation</kwd>
        <kwd>CATIA</kwd>
        <kwd>Tessellation</kwd>
        <kwd>Realistic Computer Graphics</kwd>
        <kwd>Spherical Panorama</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>-</title>
      <p>
        Optical simulation systems allow synthesizing photorealistic images of various virtual
3D scenes as well as obtaining numerical values of various optical parameters of
virtual objects, with sufficient speed and accuracy [
        <xref ref-type="bibr" rid="ref1">1</xref>
        ]. For making obtained images more
realistic-looking, such systems require high-quality and precise input data. The most
simple and convenient way to get such data for end user is integration of optical
simulation systems with existing computer-aided design systems [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ]. Such integration
allows usage of ready object models which were designed at the earlier stages in the
corresponding CAD systems.
      </p>
      <p>
        CATIA system is one of the most popular CAD systems, especially in automobile
and aviation industry, and physical accuracy of the modeling results are especially
Copyright © 2020 for this paper by its authors. Use permitted under Creative Commons
License Attribution 4.0 International (CC BY 4.0).
important for CATIA users [
        <xref ref-type="bibr" rid="ref2">2</xref>
        ], so integration with this CAD is very important for the
optical simulation.
      </p>
      <p>
        At the initial stage of the integration of optical simulation systems with existing
CAD it is sufficient to develop an algorithm of data conversion from the internal data
format of the CAD to some format suitable for processing in the optical simulation
system. However, the most convenient for end-users way of integration is direct
integration of the user interface controls of this system in the native user interface of the
target CAD. It allows user to consider the combined complex of the initial CAD
system and optical simulation system integrated into it as a monolith program [
        <xref ref-type="bibr" rid="ref3">3</xref>
        ]. User
gets a possibility of multiple changes in the initial object model and immediate
execution of optical simulation functionality without additional actions for converting of
saved files to another format and opening them in other program. Still, user may
experience inconvenience if user interface of the target CAD doesn’t provide some
specific modes which are important for optical simulation.
2
      </p>
    </sec>
    <sec id="sec-2">
      <title>Problems encountered during integration of the optical simulation module to the CATIA CAD system</title>
      <p>
        CATIA Workspace is a document window where all scene objects are shown and
which provides possibility of their visual editing. As workspace requires real-time
update of the shown data during editing, usually it displays a scene with draft quality,
while some details with potentially long rendering time are omitted. The CATIA
CAD system provides different modes and additional possibilities for displaying
scene objects in its workspace. However, CATIA system is primarily intended for
geometric modeling of parts in the mechanical engineering. Creation of plug-ins for
CATIA intended for some other purposes, for example, for optical simulation tasks,
requires additional display modes which are not provided by the built-in functionality
of the CATIA system. In this work we describe insertion of such modes using the
CATIA’s own programming system – CAA RADE (integrated with Microsoft Visual
Studio development environment) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ].
      </p>
      <p>Among the view modes absent in the CATIA CAD system but important for
optical simulation tasks there are most often required displaying of tessellation of
geometrical objects into triangular meshes with different subdivision accuracy, and also
showing optical values at the surfaces of the geometrical objects in the form of a heat
map. Also in this article is described a functionality of showing spherical panorama
used as a background image directly in the CATIA workspace viewport.
3</p>
    </sec>
    <sec id="sec-3">
      <title>Displaying tessellation of CATIA geometrical objects</title>
      <p>Geometrical objects in CATIA usually represent themselves by analytically defined
surfaces. For tasks of computational optics, in most cases such surfaces must be
tessellated into triangular meshes. Size of the obtained triangles can be different for
achievement of balance between calculation speed and accuracy. Tessellation
proce</p>
      <p>
        Elaboration of New Viewing Modes in CATIA CAD for Lighting Simulation Purpose 3
dure may often take very long time [
        <xref ref-type="bibr" rid="ref5">5</xref>
        ]. Further calculations with too accurate
geometry presented by very dense mesh may take even more time. So it is necessary to
select the tessellation parameters which will provide satisfactory compromise between
calculation accuracy and time. Besides it, after tessellation of an object which has
mostly simple shape but also contains some small important parts we may occur
problems if the tessellation parameters selected according to the entire object size are
insufficient for correct displaying of these small parts [
        <xref ref-type="bibr" rid="ref6">6</xref>
        ]. For selecting appropriate
tessellation parameters it is often advisable to draw the calculated triangle mesh
directly in CATIA workspace so user will be able to see if current parameters satisfy his
goals or not.
      </p>
      <p>The CATIA system provides a possibility of creating special temporary geometric
models which are shown in its workspace but are not inserted into the virtual scene
and are not saved to files. For triangular mesh display we use such temporary objects.
There is also possibility to set an 0wn viewing mode (wireframe, shaded etc.) for each
object in CATIA system. So we always show tessellation results in wireframe mode
in spite of the current global viewing mode for scene objects. It should be noticed that
if objects in the workspace are painted in the wireframe mode and their coordinates
coincide with coordinates of other objects painted in some other mode, then the first
ones are not overlapped with the last ones. So there is no need in some additional
manipulations with depth buffer to guarantee permanent visibility of triangle meshes
in wireframe.</p>
      <p>Viewport orientation parameters in CATIA have an influence not only to the scene
objects, but to the temporary visualized objects too. So there are not needed in any
additional actions to provide correspondence between source object and its
tessellation results during viewport transformations. But still the tessellation results may do
not correspond to the initial object if this object has been changed since the last
tessellation procedure. Currently we have decided not to add any automatic rebuilding of
the tessellation data because this process may take significant time. So it will
embarrass user’s editing of the scene objects.</p>
      <p>The CATIA viewport with tessellated mesh for two different tessellation sag
values is shown on Fig. 1. Tessellation parameters at the upper part of the image are
insufficient, so tessellation sag has been reduced and the result is shown at the lower
part of the figure.
4</p>
    </sec>
    <sec id="sec-4">
      <title>Implementation of the heat map mode in CATIA system for the computational optics tasks</title>
      <p>
        The so-called heat map mode means graphical representation of the function of
several variables. Value of the displayed quantity is expressed with color of the
corresponding pixel [
        <xref ref-type="bibr" rid="ref7">7</xref>
        ]. There are different color models of heat map display. One of the
popular color model is rainbow one. Despite its disadvantages from the scientific
point of view [8] it still is very vivid for user. In the rainbow mode parts with minimal
value of the quantity have blue color, parts with maximal value have red color, and
intermediate value parts have green and yellow colors. Usually heat map is just a
2dimensional diagram, but similar color shading can be applied to any surface.
Quantities which are suitable for heat map display include luminance, illuminance, radiance,
irradiance and other quantities used in the optical simulation. Values of the optical
quantities calculated for node points of the tessellated mesh correspond to definite
colors of the heat map. Such mode is especially convenient if it is necessary to mark
parts where the displayed quantity significantly excess average value.
      </p>
      <p>CATIA system does not have built-in functionality for displaying heat maps. We
had to develop such functionality from scratch by extending the existing display
modes. It had been decided to create a special texture for scene objects and use
Shading with Material for displaying it. Shading with Material mode allows displaying
scene and temporary objects with applied textures directly in the workspace.</p>
      <p>
        We have developed the special method which significantly simplified applying the
heat map to the meshes in the viewport. For objects displayed in the workspace we
have selected the one-dimensional texture coordinates mode. Then we created a
texture with single-pixel width which represents smooth color gradient corresponding to
the colors of the heat map. Value of the single texture coordinates for each mesh
vertex is set equal to ration of the luminance (illuminance etc.) value in this vertex to the
difference between maximal and minimal luminance of the current scene. In such a
case each specific vertex is painted with the color corresponding to the required value
of the displayed quantity. Using linear interpolation for pixels located between
vertices with explicitly set luminance/illuminance value provides satisfactory quality of
shading for these pixels. The described texture is being generated automatically
depending on the current luminance/illuminance data and heat map parameters.
Applying the generated textures directly to the CATIA scene objects is hardly
possible. The tree of representations of CATIA scene objects can have complicated
structure which does not always correspond to tree structure of the scene objects
themselves. Besides this, it was already told that we use tessellation (conversion of initial
CATIA scene objects to triangle meshes according to specified parameters) so
calculated luminance/illuminance values significantly depend on these parameters because
tessellated meshes may have noticeable difference from initial scene objects. That is
why we display heat map upon the additionally created temporary geometrical meshes
similar to viewing tessellation results. There comes another problem – it is necessary
to display these newly created objects in front of the initial CATIA scene objects in
the viewport. Because we were unable to manipulate the depth buffer of the CATIA
main viewport, we have decided just to hide the initial geometry in the workspace. To
do so, we obtained pointer to the graphic representation (a CATRep object) [
        <xref ref-type="bibr" rid="ref4">4</xref>
        ]
corresponding to the scene root object and changed its view mode to wireframe. This
forcedly set view mode bypasses the view mode previously set by user with the UI.
      </p>
      <p>As displaying any bitmap textures in the CATIA workspace viewport is possible
only in the Shading with Material display mode, we disable turning on heat map mode
in case if any other view mode is currently active. But user also can switch from
Shading with Material view mode to other view mode already after heat map display
had been turned on. For automatic turning off heat map display in this case, we had to
set up the callback for the VIEWER_UPDATE event. This event is being activated
each time after any redraw of the viewport. The event handler checks the current view
mode and turns off heat map display if the mode is not Shading with Material.</p>
      <p>CATIA workspace with heat map display turned on and dialog box containing
controls of this mode is shown on Fig 2. The color bar shown at the left of the dialog box
shown on Fig. 2 corresponds to the 1-dimensional texture applied to the surfaces.
5</p>
    </sec>
    <sec id="sec-5">
      <title>Showing a spherical panorama as a background image</title>
      <p>Spherical panorama is an image combined from several photos which display a
view from some point in all directions (360 x 180 degrees). Usage of a spherical
panorama as a background image allows increasing realism of artificially created model.
The model is being inserted in such panorama which is obtained from a photo taken
with special equipment. Such panorama can also be a light source for the created
models if it has high dynamic range [9].</p>
      <p>For setting up correct orientation parameters of the spherical panorama relatively
to the built models it is desirable to show the panorama preview directly in the
CATIA viewport. User should have a possibility to change common parameters of the
panorama and its orientation and see the results in real time.</p>
      <p>For solving this task we created the temporary geometrical representation with
spherical shape in CATIA viewport. The entire scene built by user should be
inscribed into this sphere. The simplest way to place the sphere visually behind all other
scene objects would be forced changing of the workspace depth buffer. But
unfortunately, as in the previous cases, absence of direct access to the CATIA depth buffer
functions for third-party programmers forced us to use some actions for bypassing
this problem. So the sphere was created just as a usual temporary geometric
representation in the workspace. The center and radius of the sphere are set automatically and
are changed corresponding to viewpoint orientation change.</p>
      <p>Initially the sphere center is set equal to the current camera position and sphere
radius is set equal to some constant. Then, in the callback of the viewport redraw event,
there is obtained current radius of the scene bounding sphere (which includes the
radius of the newly created sphere object). If the obtained radius is more than in
1.00001 times larger than the radius of the panorama object, then the panorama radius
is doubled. Such stepped radius change with additional threshold allows to avoid
infinite looping which may appear because global bounding sphere radius obtained
through CATIA API functions includes the newly created sphere radius too.</p>
      <p>The preview of a spherical panorama together with a rough car model in the
CATIA workspace is shown on Fig.3. User can change camera orientation in real time
and see the preview immediately while high quality scene rendering may take several
hours.</p>
      <p>Elaboration of New Viewing Modes in CATIA CAD for Lighting Simulation Purpose 7</p>
    </sec>
    <sec id="sec-6">
      <title>Conclusion</title>
      <p>Implementation of additional viewing modes provided better integration of optical
simulation and physically accurate rendering system into CATIA CAD and made the
work of end user with the program complex more convenient. Lighting engineers who
use extended CATIA program complex now are able to edit the required models
dynamically. Added viewing modes allow them to view immediately the reflectance of
these changes to the results of optical simulation as well as preview of the changes
without repeating the time-consuming procedures of optical simulations after each
adjustment of scene parameters.</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          1.
          <string-name>
            <surname>Barladian</surname>
            ,
            <given-names>B.Kh.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voloboy</surname>
            ,
            <given-names>A.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Galaktionov</surname>
            ,
            <given-names>V.A.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shapiro L</surname>
          </string-name>
          .
          <article-title>Z: Integration of Realistic Computer Graphics into Computer-Aided Design and Product Lifecycle Management Systems</article-title>
          .
          <source>Programming and Computer Software</source>
          .
          <volume>44</volume>
          (
          <issue>4</issue>
          ),
          <fpage>225</fpage>
          -
          <lpage>232</lpage>
          (
          <year>2018</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          2.
          <string-name>
            <surname>Barladian</surname>
            ,
            <given-names>B. Kh.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voloboy</surname>
            ,
            <given-names>A.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shapiro</surname>
            ,
            <given-names>L.Z.</given-names>
          </string-name>
          :
          <article-title>Integration of illumination simulation by ray tracing method into CAD systems</article-title>
          ,
          <source>In: Proc. of the 16th Int. Conf. GraphiCon'</source>
          <year>2006</year>
          , Novosibirsk, Russia, pp.
          <fpage>275</fpage>
          -
          <lpage>278</lpage>
          (
          <year>2006</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          3.
          <string-name>
            <surname>Barladian</surname>
            ,
            <given-names>B. Kh.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Voloboy</surname>
            ,
            <given-names>A.G.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Shapiro</surname>
            ,
            <given-names>L.Z.</given-names>
          </string-name>
          :
          <article-title>Generating realistic images in CAD systems</article-title>
          ,
          <source>In: Proc. Of the 23rd Int. Conf. GraphiCon'</source>
          <year>2013</year>
          , Vladivostok, Russia, pp.
          <fpage>186</fpage>
          -
          <lpage>190</lpage>
          (
          <year>2013</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          4.
          <string-name>
            <given-names>Dassault</given-names>
            <surname>Systemes</surname>
          </string-name>
          , Inc. CATIA Version 5
          <article-title>-6 R2015 Documentation</article-title>
          . http://media.3ds.com.
          <source>Last accessed 05 Aug 2018</source>
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          5.
          <string-name>
            <surname>Loop</surname>
            ,
            <given-names>C.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Schaeffer</surname>
            ,
            <given-names>S.</given-names>
          </string-name>
          :
          <article-title>Approximating Catmull-Clark subdivision surfaces with bicubic patches</article-title>
          .
          <source>ACM Trans. Graph</source>
          .
          <volume>27</volume>
          (
          <issue>1</issue>
          ), 8:
          <fpage>1</fpage>
          -
          <lpage>8</lpage>
          :
          <fpage>11</fpage>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          6.
          <string-name>
            <surname>Yuan</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Wang</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Huang</surname>
            ,
            <given-names>J.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Jia</surname>
            ,
            <given-names>Y.</given-names>
          </string-name>
          ,
          <string-name>
            <surname>Bao</surname>
          </string-name>
          , H.:
          <article-title>Simplified and tessellated mesh for realtime high quality rendering</article-title>
          .
          <source>Computers &amp; Graphics</source>
          <volume>54</volume>
          ,
          <fpage>135</fpage>
          -
          <lpage>144</lpage>
          (
          <year>2016</year>
          )
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          7.
          <string-name>
            <surname>Weinstein</surname>
            ,
            <given-names>J.: A Postgenomic</given-names>
          </string-name>
          <string-name>
            <surname>Visual</surname>
            <given-names>Icon</given-names>
          </string-name>
          ,
          <source>Science</source>
          <volume>319</volume>
          ,
          <fpage>1772</fpage>
          -
          <lpage>1773</lpage>
          (
          <year>2008</year>
          )
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>