Welding Simulation

Using OpenSceneGraph

A few products recently have caught my attention for their use of OpenSceneGraph for interesting simulation markets (surgery, manufacturing, etc). One of these markets is the welding simulation market. As part of my investigation into this, I decided to build a demo of some of the technology. This section documents the relatively quick demo I made to evaluate what is involved in some aspects of this type of simulation.

Phase 1: Base Application
Phase 1 was simply to build a basic application which showed a T-joint welding coupon. All that was needed was a couple slab planes rendered with an appropriate texture map and lighting to give the feeling of metal. See the image to the right.

All of the geometry, and visual representation is build programmatically. Only the texture is read from disk. All of this could be more easily done by using a modelling package, and loading the geometry using one of OpenSceneGraph's loaders, but where is the fun in that?

Simple T-Joint welding coupon.

Phase 2: Bead
This phase added a simulated bead to the application. The following assumptions were made to keep the demo simple:

  • The cross section of the bead would be based on an arc with allowable variation.
  • No real efforts at this point would be made to mimic a real model for the bead.
The bead consists of an animated geometry which grows with simulation time somewhat randomly. It isn't driven at this point by the location or speed of a torch position. Instead, this phase focused on building and rendering a bead graphic. The bead consists of segments containing 9 sample points spread out radially from a center line. The general radius and the radius at each point varies over time. To represent, triangle strips are generated over time to show the bead growing.

The bead also has animation of colors per vertex to simulate cooling of the metal. It can be seen as a shift in color from white to yellow to a dull gray in the image to the right. It starts as an elliptical shape, and degrades in a linear fashion over time. Note: It is not physics based at the moment, so the cooling properties of the metal and bead are not taken into account. Instead it is a sample visualization.

The bead is textured here with the same texture as the slabs (just out of convenience.) Texture coords are computed as the bead is animated.

The bead with per vertex coloring and simple material properties.

Bead with a metal texture added.

Future Phases (for the OpenSceneGraph version):
If I find time, I would like to add the following:

  • Torch representation - A nice visual representation of where the torch is located, associated lighting caused by the arc, and tie that into the bead simulation.
  • Darkend helmet visualization - Mimic the view from inside the helmet.
  • Add shadows once the torch is represented. The bead represents some interesting shadow accuracy challenges.

The completed weld animation.

Using Unity3D

Game oriented tooling/libraries are gaining acceptance in other market places. Unity3D is one of those tools. I decided to port the Welding Simulation to the Unity3D environment to see how well it supports a simple simulation like this, and what types of flexibility it offers. The fact that I know C# makes this transition fairly easy too.

Adapting the simulation to Unity3D was quite simple. The base "application" simply required generating some geometry, and building a metal shader that applied the appropriate texture / lighting attributes.

Similar to the OpenSceneGraph version, the bead required building a C# script to generate the geometry, which was applied to the Beader GameObject. Almost all of the C++ shader logic was adapted, with minor changes to generate geometry in a manner that worked well for updating the Unity Mesh object that the script generates.

Unity3D Editor running the simulation.