6
machine design, Vol.8(2016) No.4, ISSN 1821-1259 pp. 165-170 *Correspondence Author’s Address: University of Novi Sad, Faculty of Technical Sciences, Trg Dositeja Obradovica 6, 21000 Novi Sad, Serbia, [email protected] Research paper FREE FORM SHAPE MODELLING BY HAND MOVEMENT IN VIRTUAL ENVIRONMENT Zoran MILOJEVIĆ 1, * - Slobodan TABAKOVIĆ 1 - Milan ZELJKOVIĆ 1 - Aleksandar ŽIVKOVIĆ 1 1 University of Novi Sad, Faculty of Technical Sciences, Novi Sad, Serbia Received (11.11.2016); Revised (14.12.2016); Accepted (16.12.2016) Abstract: This paper presents a program system for free form shape modelling by hand movement in a virtual environment. Model is approximated with dexels in three orthogonal directions (three dexel representation). This fact enables that Boolean subtraction and union operation between model and tool can be executed in a very short period of time. Tool manipulation in the modelling process is done by PHANToM Omni haptic device, which can reproduce a contact force between the model and the tool. Because of the fact that dexels are independent between themselves, calculation is done completely in Graphical Processing Unit (GPU) geometry shader stage, by utilizing its parallel processing power. For every tool instance, depth and normal textures are generated in three orthogonal directions and subtracted from the workpiece model. For the test workpiece model with complex geometry a few cuts in the developed program systems are performed and modified model is printed on MakerBot 2X 3D printer. Key words: Computer-Aided Design, dexel representation, free form sculpting, GPGPU. 1. INTRODUCTION Freeform models are widely employed in the aerospace, automobile, mould/die making, toy design and many other industries. The techniques of digital freeform model generation have been developed and deployed in virtual product design, digital prototyping, NC simulation and surgery simulation. Modern Computer-Aided Systems (CAD) for solid model representations use Constructive Solid Geometry (CSG), Boundary Representation (BRep) and Feature-Based Modelling (FBM) representation schemes. The user interacts with the solid modeller using either FBM or CSG representation to create the object and it is immediately converted into a system-friendly representation, which is BRep in most engineering applications [1]. However, free form models generation with modern CAD systems can be a very complex task. Firstly, CAD systems are not enabling users to create free form models intuitively (moving tool over model naturally). Also, subtracting model of the tool from workpiece model can be very time consuming process, as every tool subtraction from workpiece, BRep of workpiece is more memory demanding. Because of that, there was a need for virtual sculpting systems, where user creates freeform models on the computer by virtual technologies like moulding a piece of clay. Virtual sculpting was presented as a novel free-form interactive modelling technique [2]. There are two kinds of virtual sculpting systems. One is derived from surface- based deformable geometric object modelling, which may be vertex-based, spline-based, particle based, or FEM (Finite Element modelling)-based [3]. In these systems user moves surface vertexes and changes a shape of model. The other one is analogous to the NC (numerically controlled) simulation process, by which stock material is removed whenever a virtual tool sweeps [4]. Subtraction time in these systems is crucial for interactive simulation. In this second type of virtual sculpting systems, virtual model is usually approximated with voxel or dexel elements. The voxel approach represents an object with many small cubes (Fig. 1 a) whilst dexel approach represents an object with a grid of long columns compacted together (Fig.1 b). Dexel representation is widely used in NC simulation process, because it is less memory demanding than Voxel representation [5]. Fig.1. a) Voxel, b) Single dexel, and c) Multi dexel representation of simple circle shape The weak point of single dexel representation is that surfaces which are almost parallel with dexel direction can be missed in dexel generation (bolded circle segments in Fig. 1 b). Much better surface representation for the same number of rays is shown in Fig 1c, where circle is intersected with rays in two orthogonal directions. For three dimensional case presented in [5], three dexel model

machine design, Vol.8(2016) No.4, ISSN 1821-1259 pp. 165 … · Because of the fact that dexels are independent between themselves, ... Axis Aligned Bounding Box (AABB) ... a set

  • Upload
    lekhue

  • View
    214

  • Download
    0

Embed Size (px)

Citation preview

  • machine design, Vol.8(2016) No.4, ISSN 1821-1259 pp. 165-170

    *Correspondence Authors Address: University of Novi Sad, Faculty of Technical Sciences, Trg Dositeja Obradovica 6, 21000 Novi Sad, Serbia, [email protected]

    Research paper FREE FORM SHAPE MODELLING BY HAND MOVEMENT IN VIRTUAL ENVIRONMENT Zoran MILOJEVI1, * - Slobodan TABAKOVI1 - Milan ZELJKOVI1 - Aleksandar IVKOVI1 1 University of Novi Sad, Faculty of Technical Sciences, Novi Sad, Serbia

    Received (11.11.2016); Revised (14.12.2016); Accepted (16.12.2016) Abstract: This paper presents a program system for free form shape modelling by hand movement in a virtual environment. Model is approximated with dexels in three orthogonal directions (three dexel representation). This fact enables that Boolean subtraction and union operation between model and tool can be executed in a very short period of time. Tool manipulation in the modelling process is done by PHANToM Omni haptic device, which can reproduce a contact force between the model and the tool. Because of the fact that dexels are independent between themselves, calculation is done completely in Graphical Processing Unit (GPU) geometry shader stage, by utilizing its parallel processing power. For every tool instance, depth and normal textures are generated in three orthogonal directions and subtracted from the workpiece model. For the test workpiece model with complex geometry a few cuts in the developed program systems are performed and modified model is printed on MakerBot 2X 3D printer. Key words: Computer-Aided Design, dexel representation, free form sculpting, GPGPU. 1. INTRODUCTION Freeform models are widely employed in the aerospace, automobile, mould/die making, toy design and many other industries. The techniques of digital freeform model generation have been developed and deployed in virtual product design, digital prototyping, NC simulation and surgery simulation. Modern Computer-Aided Systems (CAD) for solid model representations use Constructive Solid Geometry (CSG), Boundary Representation (BRep) and Feature-Based Modelling (FBM) representation schemes. The user interacts with the solid modeller using either FBM or CSG representation to create the object and it is immediately converted into a system-friendly representation, which is BRep in most engineering applications [1]. However, free form models generation with modern CAD systems can be a very complex task. Firstly, CAD systems are not enabling users to create free form models intuitively (moving tool over model naturally). Also, subtracting model of the tool from workpiece model can be very time consuming process, as every tool subtraction from workpiece, BRep of workpiece is more memory demanding. Because of that, there was a need for virtual sculpting systems, where user creates freeform models on the computer by virtual technologies like moulding a piece of clay. Virtual sculpting was presented as a novel free-form interactive modelling technique [2]. There are two kinds of virtual sculpting systems. One is derived from surface-based deformable geometric object modelling, which may be vertex-based, spline-based, particle based, or FEM (Finite Element modelling)-based [3]. In these systems user moves surface vertexes and changes a shape of model. The other one is analogous to the NC (numerically controlled) simulation process, by which stock material is removed whenever a virtual tool sweeps [4]. Subtraction time in these systems is crucial for interactive simulation. In this second type of virtual sculpting systems, virtual

    model is usually approximated with voxel or dexel elements. The voxel approach represents an object with many small cubes (Fig. 1 a) whilst dexel approach represents an object with a grid of long columns compacted together (Fig.1 b). Dexel representation is widely used in NC simulation process, because it is less memory demanding than Voxel representation [5].

    Fig.1. a) Voxel, b) Single dexel, and c) Multi dexel representation of simple circle shape

    The weak point of single dexel representation is that surfaces which are almost parallel with dexel direction can be missed in dexel generation (bolded circle segments in Fig. 1 b). Much better surface representation for the same number of rays is shown in Fig 1c, where circle is intersected with rays in two orthogonal directions. For three dimensional case presented in [5], three dexel model

  • Zoran Milojevi, Slobodan Tabakovi, Milan Zeljkovi, Aleksandar ivkovi: Free Form Shape Modelling by Hand Movement in Virtual Environment; Machine Design, Vol.8(2016) No.4, ISSN 1821-1259; pp. 165-170

    166

    is introduced, where model is approximated with dexels in three orthogonal directions. In this paper, a sculpting system for freeform modelling based on three dexel representation is presented. For tool manipulation, Sensable PHANToM Omni haptic device is used. Tool model subtraction from workpiece model is done by Graphical Processing Unit (GPU). 2. MODEL OF PROGRAM SYSTEM FOR

    FREE FORM MODELLING Model of program system for free form sculpting based on single dexel principle is presented in [6]. One of the limitations of this system is that approximation of the model is done by single dexel representation. Poor approximation and artefacts can appear on the surfaces which are almost parallel to the view direction. Also, it is view dependant and that means that if user wants to change a view, polygonal model should be generated from dexel model first and after a new view direction setting, new dexel representation should be generated. In program system presented in this paper, model is view-independent because it is represented in three directions by dexels. Also because that number of dexels is now three times greater, computation of subtracting tool from model is done by use of GPU. Model of the developed program system is presented in Fig. 2.

    Fig.2. Model of the developed program system As shown in Fig 2., input in the program system are STereoLitography (STL) models of workpiece and tools which are to be used in cutting simulation. For three-dexel model generation, ray intersection with model in three orthogonal directions should be calculated. This process can be very time consuming (blank workpiece may consist of millions of triangles). To speed up computation, depth peeling algorithm [7] is applied in the

    program system. Model is rendered in projection as many times as maximal complexity of point in this projection is. First, Axis Aligned Bounding Box (AABB) for work piece is created, and three orthogonal projections are defined where AABB mid point is in the center of the projections. Detailed procedure is presented in paper [8]. After that, in all tree projections depth peeling algorithm is applied and two textures for every peeled layer are generated. In the first texture (depth texture) every pixel contains depth value in the range 0.0-1.0. In the second texture (normal texture) every pixel has a RGB (Red Green Blue) color, where red, green and blue components contain x, y and z normal information. In Fig. 3a example model for this procedure is presented. In Fig 3b,c and d, generated textures for front, right and top views are shown.

    Fig.3. Generated depth and normal textures for three

    orthogonal projections

    For better understanding, respective points on one dexel ray in front view on 3D model and in generated depth textures are shown in Fig.3a and Fig. 3b. This procedure is completely done in GPU and was introduced for the first time in [9]. Depth and normal textures are merged into one texture and this texture was named Layer Depth Normal Images (LDNI). By utilizing this procedure, a very complex model can be presented as a set of textures.

  • Zoran Milojevi, Slobodan Tabakovi, Milan Zeljkovi, Aleksandar ivkovi: Free Form Shape Modelling by Hand Movement in Virtual Environment; Machine Design, Vol.8(2016) No.4, ISSN 1821-1259; pp. 165-170

    167

    2.1. Generation of Three Dexel Structures from Generated Textures

    Based on the generated textures in the previous step, structures for dexels in all three dimensions should be generated. Parameters for dexel definition are presented in Fig. 4. Every texture has a resolution (texture resolution). Parameters depth and length define coordinates of first and last point of dexel in the view direction, while positionx and positiony define dexel position on a plane. Also, from normal textures every dexel point normals are calculated as normal1 and normal2. Last two parameters in dexel structure, cut1 and cut2, give information if blank workpiece dexels are cut in the simulation process and if they are cut by tool, then the color of dexel is different than the color of uncut dexels.

    Fig.4. Parameters of dexel structure Dexel structures are then written into three buffers (one buffer for every dexel direction) and then they are transferred into GPU. In GPU, Boolean subtraction and union operation between workpiece dexels and modelling tool dexels is executed. 2.2. Cutting Process Simulation on GPU

    At the beginning of XXI century , Central Processing Unit (CPU) frequency reached limit of 4GHz. On the other hand modern GPU has thousands stream processors which are optimized for parallel processing. That GPU architecture causes that GPU can be used not only for displaying images on monitor but for complex computations also. This leads to term General-Purpose computing on Graphics Processor Units (GPGPU). In Fig. 5 comparisons between modern CPUs and GPUs compute power in GFLOP/s (Giga FLoating point Operations Per Second) are shown [10]. Computation power of GPU is used in many scientific areas such as physically-based simulations, image processing, global illumination, geometric computing, Finite Element Analysis (FEA) and more. Reported compute time acceleration is 10-100 times, depending on suitability of the analyzed problem for parallel computing.

    In the case of three dexel models, all dexels of tool and workpiece are independent and computation of Boolean operations in GPU can be highly parallelized.

    Fig.5. Comparison of modern CPU i GPU computation power [10]

    For obtaining tool position and orientation in modelling process, haptic PHANToM Omni device is used. This device has capability to reproduce forces if contact between tool and workpiece occur and can also return position and orientation of tool as a 4x4 matrix. Device operates at 1kHz frequency and transform tool matrix can be obtained every 1ms. By this matrix, tool is transformed in program system and as a workpiece at the beginning of a modelling process, tool transformation and tool depth and normal textures are generated for every tool position. An example of tool depth and normal textures for one dexel direction are presented in Fig. 6. This principle of generation depth and normal textures for tool in cutting process enables that tool can be of free form shape. The only demand is that one ray should have an even numbers of intersection points with tool model in any of the three normal directions.

    Fig.6. Generated tool depth (up) and normal textures(down) for one dexel direction

    Principle of generation of the final image onto monitor by programmable shader stages in GPU is shown in Fig. 7. In the first step, geometry which has to be displayed is

  • Zoran Milojevi, Slobodan Tabakovi, Milan Zeljkovi, Aleksandar ivkovi: Free Form Shape Modelling by Hand Movement in Virtual Environment; Machine Design, Vol.8(2016) No.4, ISSN 1821-1259; pp. 165-170

    168

    sent to GPU. Also - transformation, view, model and projection matrices, material, camera and light properties are sent to GPU. In the first stage (vertex shader) this geometry can be transformed. After that transformed elements (points, triangles) can be sent to the next stage (geometry shader). Geometry shader has a possibility to create new geometry or to apply another transformation. After geometry shader processing, every fragment (pixel) in the final image is generated by last stage (fragment shader).

    Fig.7. Programmable GPU shader stages In the case of cutting simulation based on the dexel models, input geometry is coded as an array of points, where every point has a dexel structure parameters presented in Fig 4. These points are only passed through the vertex shader. Boolean operations are done in geometry shader stage. Every point (dexel structure) is compared with appropriate point in tool depth and normal textures. Possible cases in dexel Boolean subtraction and union are shown in Fig. 8. As shown in Fig.8, for the Boolean subtraction of tool dexel from workpiece dexel next casses can occur. When tool dexel is above (1) or bellow (6), intersection does not exist. If tool is cutting workpiece from the top (2), top workpiece dexel is set with bottom tool dexel. When tool is cutting workpiece from above (3), bottom worpiece dexel is set with top tool dexel. If a tool dexel divides workpiece dexel (4), then two workpiece dexels are generated. And the last case (5) is when tool dexel completely removes workpiece dexel. For Boolean union operation of tool and worpiece dexels there are also 6 cases. When tool dexel is above (1) or bellow (6), union of these dexels does not exist. If tool is cutting workpiece from the top (2), top workpiece dexel is set with top tool dexel. When tool is cutting workpiece from above (3), bottom worpiece dexel is set with bottom tool dexel. If a tool dexel divides a workpiece dexel, worpiece dexel stays unchanged. And the last case (5) is when tool dexel completely covers workpiece dexel. Then, workpiece dexel top and bottom are set as a tool dexel top and bottom. From Fig. 8 can be noticed that only case 4 in Boolean subtraction generates new worpiece dexel. This fact was a problem, because it was not possible to generate new geometry in GPU. With geometry shader stage introduced

    in 2007., a possibility for a new elements generation on GPU was enabled.

    Fig.8. Possible cases of dexels subtraction and union

    2.3. Three Dexel Model Export

    Developed program system enables user to export sculpted model in two formats. First format is .XYZ, where model is exported as a cloud of points. Every point has its coordinates and a normal vector. Model in this format can be imported in many program systems and algorithms for surface mesh reconstruction can be applied. Another format in which model can be exported is STL file format. For polygonal model generation Marching Cubes [11] algorithm is applied which is part of VTK (Visualisation Toolkit Library) [12]. 3. RESULTS Developed program system is written in C++ program language in MS Visual Studio environment, while OpenGL (Open Graphic Library) and GLSL (openGL Shading Language) are used for GPU programming. For dexels number of 2105, on GeForce GTX660, computing time for subtraction and displaying was 3 ms. Authors expect that on modern GPUs, which have almost three times more stream processors and higher clocks, computing time will be significantly under 1 ms. As an example, complex STL model is used where depth complexity in all three orthogonal directions are greater than two. Generated dexels in all three directions are presented in Fig. 9., dexels in front view are shown in Fig. 9a, dexels in side view are presented in Fig. 9b., and dexels generated in top view are shown in Fig. 9c. Model defined with all three dexel directions is shown in Fig. 9d.

  • Zoran Milojevi, Slobodan Tabakovi, Milan Zeljkovi, Aleksandar ivkovi: Free Form Shape Modelling by Hand Movement in Virtual Environment; Machine Design, Vol.8(2016) No.4, ISSN 1821-1259; pp. 165-170

    169

    Fig.9. Example model presented as three dexel representation

    Fig.10. Original model (top left) and modified model in the sculpting process

    From Fig. 9 it is obvious that all three single dexel representations have a problem with surfaces which are parallel with the view direction. This problem is more noticeable in side and top views, because of the example model shape. In Fig. 10, original model (top left) and a few cuts, which are done during the sculpting process, are presented. Cuts are done at different parts of the model, and view is changed interactively in the modelling process. Three dexel model is exported in STL format, and produced on MakerBot 2X 3D printer. In Fig. 11, original model (white) and modified model in the system (gray) are shown. 4. CONCLUSION Developed program system for free form shape modelling by hand movement in virtual environment is presented in this paper. In the program system, workpiece model is represented by three dexel representation which enables user to change view interactively in modelling process. Also, poor representation of surfaces which are almost parallel to view direction is eliminated. Computation of Boolean operations between workpiece model and tool in sculpting process is done in GPU which results in very short computational time per one operation.

    Fig.11. Original model (left) and modified model (right) with a few cuts in the program system printed on

    MakerBot 2X printer

  • Zoran Milojevi, Slobodan Tabakovi, Milan Zeljkovi, Aleksandar ivkovi: Free Form Shape Modelling by Hand Movement in Virtual Environment; Machine Design, Vol.8(2016) No.4, ISSN 1821-1259; pp. 165-170

    170

    ACKNOWLEDGEMENTS In this paper some results of the project: Contemporary approaches to the development of special solutions related to bearing supports in mechanical engineering and medical prosthetics R 35025, carried out by the Faculty of Technical Sciences, University of Novi Sad, Serbia, are presented. Project is supported by the Ministry of Education, Science and Technological Development of Republic of Serbia. REFERENCES [1] Karunakaran, KP and Shringi, R (2007), Octree-to-

    BRep conversion for volumetric NC simulation, The International Journal of Advanced Manufacturing Technology, 32 (1-2), pp: 116-131.

    [2] Coquillart, S. (1990), Extended free-form deformation: a sculpturing tool for 3D geometric modeling, ACM SIGGRAPH Computer Graphics, 24 (4), pp: 187-196.

    [3] IX, F Dachille, Qin, H., Kaufman, A. (2001), A novel haptics-based interface and sculpting system for physics-based geometric design, Computer-Aided Design, 33 (5), pp: 403-420.

    [4] Zhu, W., Lee, Y.S., (2004), Dexel-based forcetorque rendering and volume updating for 5-DOF haptic product prototyping and virtual sculpting, Computers in industry, 55 (2), pp: 125-145.

    [5] Benouamer, M. O., Michelucci, D., (1997), Bridging the gap between CSG and Brep via a triple ray representation, Proceedings of the fourth ACM symposium on Solid modeling and applications, pp: 68-79.

    [6] Milojevic, Z., Navalusic, S., Zeljkovic, M., Tabakovic, S., Vicevic, M., Beju, L., (2013), Sculpting system based on the dexel approach, International Conference on Manufacturing Science and Education - MSE2013, pp: 3-6.

    [7] Everitt, C., (2001), Interactive order-independent transparency, White paper, nVIDIA, 2 (6),.

    [8] Milojevi, Z., Tabakovic, S., Bojanic, M., Zeljkovic, M., (2015), Multi Axis NC Code Simulation Based on Three-Dexel Model Representation and GPU, Journal of Production Engineering, 18 (2), pp: 73-76.

    [9] Wang, C., Leung, Y.S., Chen, Y., (2010), Solid modeling of polyhedral objects by Layered Depth-Normal Images on the GPU, Computer-Aided Design, 42 (6), pp: 535-544.

    [10] Nvidia, CUDA, (2014), Toolkit Documentation, (February).

    [11] Lorensen, W. E., Cline, H.E., (1987), Marching cubes: A high resolution 3D surface construction algorithm, ACM siggraph computer graphics, 21(4), pp: 163-169.

    [12] Schroeder, W., Martin, K., and Lorensen, B., (2003), The visualization toolkit: an object oriented approach to 3D graphics, New York: Kitware', Inc. Publisher.

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 300 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /CreateJDFFile false /Description > /Namespace [ (Adobe) (Common) (1.0) ] /OtherNamespaces [ > /FormElements false /GenerateStructure false /IncludeBookmarks false /IncludeHyperlinks false /IncludeInteractive false /IncludeLayers false /IncludeProfiles false /MultimediaHandling /UseObjectSettings /Namespace [ (Adobe) (CreativeSuite) (2.0) ] /PDFXOutputIntentProfileSelector /DocumentCMYK /PreserveEditing true /UntaggedCMYKHandling /LeaveUntagged /UntaggedRGBHandling /UseDocumentProfile /UseDocumentBleed false >> ]>> setdistillerparams> setpagedevice