tating prism is located (see figure 2, top). For the en-
doscope, the graphical simulation is much more com-
plex than the physical simulation. In order to be able
to evaluate the concept of the rotating prism camera
optics, we need to model the camera behavior as accu-
rate as possible. For example, we model the complex
movement of the view frustum caused by the internal
reflections in the prism, and apply radial lens distor-
tion, depth-of-field, and chip noise as post-processing
effects.
5.2 The Grasper
Our grasper is composed of a shaft and two jaws that
open and close (figure 2, bottom). In PhysX, the in-
strument is represented by a capsule for the shaft and
two boxes for the jaws. When opening or closing the
grasper, we request PhysX to rotate the boxes of the
jaws around their base at the tip of the shaft.
Pinching can be realized by attaching soft body
vertices that lie between the jaws. Unfortunately,
PhysX does not report contacts between rigid bodies
and soft bodies, which made it necessary to imple-
ment the pinching by hand.
Finding soft body vertices between the jaws could
be implemented by casting rays from the jaws against
the soft bodies. However, it turned out that the ray
casting routine in PhysX is computationally too ex-
pensive and significantly drops the frame rate. As
shown in figure 2 we span a virtual wedge between the
jaws. This wedge defines five planes with which we
basically perform a view-frustum culling operation in
order to find all vertices inside the wedge. Once these
vertices are detected, they are attached to the grasper
and follow it in the continuing simulation.
For the grasping, we attach the vertices as tear-
able, which allows the attachment to break as soon as
the force acting on it becomes large enough. In order
to model forceful grasping when the jaws are almost
closed, the tear factor depends on the opening angle
of the jaws. Once the user opens the grasper, we de-
tach all attached vertices and thereby release the soft
body from the grasper.
5.3 The Cauterizer
The geometry of the cauterizer consists of a tip with
a loop at which a sphere is attached with which the
surgeon can cauterize (figure 2, middle). When push-
ing the tip against an organ, the tissue is burned
and smoke rises. In PhysX, smoke can be modeled
using its GPU-based fluid simulation, which imple-
ments particle-based smoothed-particle hydrodynam-
ics (SPH) (M
¨
uller et al., 2003). During rendering,
each particle can be rendered as textured billboard,
using the positions from the fluid simulation.
In our simulator, we attach a PhysX fluid emit-
ter at the tip of the cauterizer. As soon as the user
activates the cauterizer, we start to check if any soft
body vertex is in immediate proximity of the tip, in
which case we slowly start emitting particles and let
the emitter’s flow rate increase constantly from near-
zero to a maximum. If no soft body vertex is close to
the cauterizer tip, we switch off the emitter again. Ad-
ditionally, we define a fade-out time in order to avoid
sudden disappearance of smoke particles.
6 RESULTS
We implemented our simulator in C++ using DirectX
for rendering and input handling and PhysX version
2.8.1 for the physical simulation. Figure 3 shows a
screenshot of the simulator, which consists of two
windows. On the left, the control window renders
with an overview camera. On the right, the output
of the simulated endoscope camera is presented. The
position and orientation of this camera is controlled
when moving the endoscope geometry. As can be
seen, the simulation takes into account various prop-
erties of the camera, such as field of view, lens dis-
tortion, chip noise, or the image circle that does not
cover the entire chip depending on the zooming level.
For testing our image-processing algorithms, we di-
rect the simulation window onto the secondary moni-
tor port and grab the video on a second computer, as
it would be done with the video stream coming from
the actual endoscope camera.
Our testing platform uses one core of an Intel
Core2 Duo CPU at 3 GHz and 3.2 GB main memory.
For rendering and the PhysX simulation, an NVIDIA
GeForce 9600 GT graphics card with 512 MB RAM
is used. For a scene with roughly 540,000 polygons
and 4,300 tetraheda, the application renders at about
40 frames per second. The physics simulation runs at
about 20 frames per second. Note that we run PhysX
asynchronously for better performance.
As shown in figure 4, our grasper allows to lift or-
gans and inspect the underlying areas. Depending on
the placement of the camera, this can significantly al-
ter the image. In the same way, the implemented cau-
terizer and smoke (see figure 5) also helps testing the
robustness of image-processing algorithms and their
reaction to fast-changing views.
We have already been able to evaluate different
aspects of the endoscope prototype with our simula-
tor. For example, we found that the rotation of the
endopscope camera has to use at least eight steps, and
USING PHYSX FOR SIMULATION-BASED ENDOSCOPIC HARDWARE DESIGN
361