Abstract:
A method and apparatus for applying a two-dimensional image on a three-dimensional model composed of a polygonal mesh. The method comprises generating an adjacency structure for all triangles within the mesh, identifying a triangle within membrane containing the desired centre point, calculating spatial distances between the three vertices and desired centre checking each triangle edge to see if the distances show an intersection, if a collision is detected add the triangle to the list and iteratively processing all the triangles in the list calculate the spatial data of the single unknown vertex, check the two edges of the triangle to see if the calculated distances show an intersection, if an intersection occurs add this new triangle to the list; transforming into UV-coordinates; and applying the two-dimensional image to the three-dimensional model using the UV-coordinates.

Description:
CROSS-REFERENCE TO RELATED APPLICATIONS 
       [0001]    The present application claims priority to the following applications and is a continuation application of U.S. patent application Ser. No. 14/771,553 filed Aug. 31, 2015, which claims priority to PCT International Application No. PCT/GB2014/050694 filed on Oct. 3, 2014, which claims priority to British Patent Application No. GB1304321.1 filed Mar. 11, 2013, the entirety of the disclosures of which are expressly incorporated herein by reference. 
     
    
     STATEMENT RE: FEDERALLY SPONSORED RESEARCH/DEVELOPMENT 
       [0002]    Not Applicable 
       BACKGROUND 
       [0003]    This invention relates to an apparatus and method for applying a two-dimensional image on a three-dimensional model. More specifically, but not exclusively, this invention relates to applying a label on a three-dimensional model. 
         [0004]    In product development, the visual appearance of the product is an important part of the marketing strategy. Accordingly, developers typically use computer editing suites to design their packaging. In some industries, containers for products are manufactured separately to the brand material, and the brand materials are subsequently fixed to the container. This is common practice in, for example, the drinks industry, in which bottles are manufactured to contain the product, and a label is produced separately and applied to the bottle. 
         [0005]    Separate computer editing suites exist for creating the label and creating a model of the bottle. To visualize the label on the bottle, a UV map of the model is created and the label is applied as a texture. This is computationally expensive and also requires a lot of user intervention to ensure the label is applied correctly. This leads to a significant delay for the computer to render the label onto the model. Accordingly, the label cannot be placed on the bottle and moved in real-time, as the processing requirements outweigh the processing power available. 
         [0006]    It is therefore desirable to alleviate some or all of the above problems. 
       BRIEF SUMMARY 
       [0007]    According to a first aspect of the invention, there is provided a method of applying a two-dimensional image to a three-dimensional model, the three-dimensional model composed of a polygonal mesh having a plurality of vertices, the method comprising the steps of: identifying a first point corresponding to a vertex of the plurality of vertices; identifying a second point corresponding to a vertex of the plurality of vertices and proximal to the first point; calculating spatial data between the second point and the first point; iteratively identifying successive points, wherein each successive point corresponds to a vertex of the plurality of vertices and is proximal to a previously identified point, and calculating spatial data between each successive point and the previously identified point, until a stop point is identified, the stop point being a point outside the boundary of the two dimensional image; transforming the points and spatial data into UV-coordinates; and applying the two-dimensional image to the three-dimensional model using the UV-coordinates. 
         [0008]    The present invention provides a method which may extract UV-coordinates for a particular area of the three-dimensional model, corresponding to the area on which the two-dimensional image is to be applied. Accordingly, the computational power required to apply the two-dimensional image is significantly reduced, as the conventional step of UV-mapping the entire model is not carried out. 
         [0009]    On a computing apparatus adapted to carry out the method of the present invention, the user may therefore select a first point in an area on the three-dimensional model to apply the two-dimensional image, and the processor extracts spatial data from that area until it identifies a point on the model being a greater distance from the first point than the distance from the centre to the boundary of the two-dimensional image. As the processing power required has been reduced significantly, the two-dimensional image may therefore be applied to the three-dimensional model and displayed on the computing apparatus&#39; display device in real time. This also allows the user to ‘drag’ the two-dimensional image across the three-dimensional model, i.e. selecting successive first points on the model, and the processor may apply the two-dimensional image to the model on the fly. 
         [0010]    The method may further comprise the step of generating a single three-dimensional model from a plurality of three-dimensional models to form a membrane, wherein the first point is on the membrane. The present invention may therefore apply the two-dimensional image to the membrane enveloping the models. The membrane may contain most or all the vertices of the three-dimensional model, or in the case of a plurality of three-dimensional models, each representing various parts of a complex product, the membrane may contain most or all the vertices of each three-dimensional model. 
         [0011]    The method may further comprise the step of applying a smoothing technique to the membrane. Thus, any sudden changes in curvature on the membrane (e.g. due to a gap in the membrane) may be smoothed over. Accordingly, the two-dimensional image may then be applied in a real-life manner. For example, in the case of a label being applied to a three-dimensional model, the label may be applied to the model such that it passes over the gap, in a similar manner to real-life. 
         [0012]    A computer program product comprising computer executable code which when executed on a computer may cause the computer to perform the method of the first aspect of the invention. 
         [0013]    According to a second aspect of the invention, there is provided a computing apparatus comprising a processor arranged to apply a two-dimensional image to a three-dimensional model, the three-dimensional model composed of a polygonal mesh having a plurality of vertices, the processor configured for: identifying a first point corresponding to a vertex of the plurality of vertices; identifying a second point corresponding to a vertex of the plurality of vertices and proximal to the first point; calculating spatial data between the second point and the first point; iteratively identifying successive points, wherein each successive point corresponds to a vertex of the plurality of vertices and is proximal to a previously identified point, and calculating spatial data between each successive point and the previously identified point, until a stop point is identified, the stop point being a greater distance from the first point than the distance from an outer edge to the boundary of the two-dimensional image; transforming the points and spatial data into UV-coordinates; and applying the two-dimensional image to the three-dimensional model using the UV-coordinates. 
         [0014]    The computing apparatus may further comprise a display device, wherein the processor is configured to cause the display device to display the three-dimensional model including the applied two-dimensional image. 
     
    
     
       BRIEF DESCRIPTION OF THE DRAWINGS 
         [0015]    These and other features and advantages of the various embodiments disclosed herein will be better understood with respect to the following description and drawings, in which like numbers refer to like parts throughout, and in which: 
           [0016]      FIG. 1  is flow diagram representing an embodiment of a method of the present invention; and 
           [0017]      FIG. 2  is a schematic diagram illustrating a computing apparatus configured to carry out the steps of the method of  FIG. 1 . 
       
    
    
     DETAILED DESCRIPTION 
       [0018]    The above description is given by way of example, and not limitation. Given the above disclosure, one skilled in the art could devise variations that are within the scope and spirit of the invention disclosed herein. Further, the various features of the embodiments disclosed herein can be used alone, or in varying combinations with each other and are not intended to be limited to the specific combination described herein. Thus, the scope of the claims is not to be limited by the illustrated embodiments. 
         [0019]    An embodiment of a method of applying a two-dimensional image to a three-dimensional model in a virtual environment will now be described with reference to  FIG. 1 . The embodiment will detail an example of placing a label (the two-dimensional image) onto a bottle (the three-dimensional model), but, on reviewing the following description, the skilled person will understand that the method may be applied to any type of two-dimensional image being placed on a three-dimensional model. 
         [0020]    As an initial step, a first image file representing a label is created. The first image file may be created in a suitable graphics editing computer program, such as Adobe Illustrator, and consists of a two-dimensional image representing a label (and shall hereinafter be referred to as the “label”). In this embodiment, the label is rectangular and includes a graphical portion enveloped by cutting lines. 
         [0021]    As a further initial step, a first model file representing a bottle is created. The first model file may be created in any suitable three-dimensional modelling software, such as 3DS Max or AutoCAD. The first model file consists of a three-dimensional representation of a bottle (and shall hereinafter be referred to as the “bottle”), defined by a triangular mesh. The skilled person will understand that the triangular mesh represents an outer surface of the bottle, and is a non-UV mapped model. 
         [0022]    The triangular mesh is used to create a set of data which records the adjacency information of all the triangles within the mesh, in one embodiment a structure such as a half-edge data structure could be used. This allows traversal of the mesh starting from a single point on the mesh. This is labelled as the membrane which consists of a set of triangles with adjacency information. 
         [0023]    As explained in more detail below, a plurality of triangular meshes may be merged together (such as one representing a bottle and another representing a bottle cap). 
         [0024]    In this embodiment, a single membrane which includes the form of both the cap and bottle is created, this is achieved by starting with a simple shape which encompasses both cap and bottle which is then shrunk to the form of the bottle and cap combined. This single mesh is then used to generate a membrane which is used to place the 2D label on both bottle and cap. 
         [0025]    In this embodiment, a ‘smoothing’ operation is applied to the membrane. Various smoothing techniques may be used, such as Laplacian polygon smoothing (however, the skilled person will understand that other smoothing techniques may be used). This technique ensures that the membrane closely follows a real-life surface that the label will be applied to. For example, if the bottle contained a small gap, the membrane may be smoothed such that it passes over the gap without any change in curvature. This closely represents how the real-life label would be applied to the real-life bottle, as the real-life label would simply be pasted over the gap without any change in curvature. 
         [0026]    The label is then applied to the membrane using the following algorithm. As a first step, an initial point of reference is taken as the centre of the label. A collision routine is used to correlate the centre of the label with an initial hit point on the triangle mesh. The initial hit point may be any arbitrary point on the triangle mesh. 
         [0027]    In a next step of the algorithm (as shown in  FIG. 1 ), the triangle containing the starting point on the membrane is chosen. The starting point is determined as a point on the membrane which is closest to the initial hit point on the triangular mesh. The distance between this point (horizontal and vertical) and each of the three vertices in the starting triangle is calculated and stored, then each of the three neighbouring triangles is added to a set of triangles to be processed. An iterative process is then employed in the following manner. For each of the triangles in the triangle list, calculate the distance between the vertex in which the distance to the starting point is known and the vertex whose distance is still to be calculated, and store this distance. This distance is calculated using geodesic techniques. Check the remaining two edges of the triangle to see if the 2D coordinates of the triangle intersect the boundary rectangle of the two dimensional label. If an edge does intersect then add the triangle neighbour which uses that edge to the list of triangles to process. The process is run in an iterative manner until there are no more triangles within the list to process. 
         [0028]    If the 2D label is likely to overlap itself, the process can be split so that the label is processed as two separate labels; the processing order defines the overlap direction. 
         [0029]    In one embodiment, an additional 2D rotation can be applied to all the calculated distances, which would have the effect of rotating the label around the centre point. 
         [0030]    The skilled person will understand that this process results in a data set containing a set of points on the membrane and a set of distances (horizontal and vertical) between each point in the set of points on the membrane and the starting point. The data set may then be converted into normalized UV coordinates using a transform. For example, the distances are stored as vectors from the starting point to each point, and are converted to UV coordinates by a translation by 0.5 and scaled to the particular height and width of the label. 
         [0031]    The normalized UV coordinates may then be used to apply the label to the bottle. That is, the label may be treated as a texture which may then be correlated with the UV coordinates. Accordingly, a plurality of points within the label may be correlated with particular UV coordinates, such that the label may then be placed on the bottle in the virtual environment. 
         [0032]    The skilled person will understand that the process is suitable for applying a two-dimensional image onto any three-dimensional model. The three dimensional model extracts UV coordinates for only a part of the three-dimensional model that the label is to be applied to, and thus reduces the computational power required for prior art techniques which involve a fully mapped UV model. The two-dimensional image may be applied to any portion of the three-dimensional model, and the algorithm detailed above applies the centre of the label to a starting point on the membrane in that portion and extracts the UV coordinates from the membrane of the surrounding area. 
         [0033]    The skilled person will also realise that by reducing the computational power required to apply the two-dimensional image to the three-dimensional model, the image may be applied in real-time. That is, the user may slide the image across the membrane of the three-dimensional model and the computational power required is reduced to the point that the image may be applied to the three-dimensional model “on-the-fly”. 
         [0034]    As noted above, a plurality of triangular meshes may be merged together. In this manner, a label may be applied to a complex product (i.e. an object having multiple constituent parts, such as a bottle and bottle cap). Next, a smoothing operation may be applied to the membrane to smooth any gaps or grooves between the parts of the complex product to ensure the label is applied appropriately. 
         [0035]    In the above embodiments, the three-dimensional model consists of one or more triangular meshes to which a single membrane is generated. The skilled person will understand that any form of polygonal meshed model would be appropriate for the present invention. Furthermore, the skilled person will understand that the application of a membrane is preferable as it allows the user to apply a smoothing technique such that the two-dimensional image is applied in a real-life manner. However, the smoothing step is non-essential. For example, the algorithm to extract the UV coordinates may be based on the vertices of the triangular mesh rather than points of a smoothed membrane. 
         [0036]    In the above embodiment, a label is applied to a model of a bottle. However, the skilled person will understand that the method of the present invention is suitable for applying any two-dimensional image to any three-dimensional model. For example, the method would be suitable for applying graphics to the bodywork of a vehicle in a virtual environment. 
         [0037]    The method of the present invention described above may be implemented on a computing apparatus  1 , such as a personal computer or mobile computing device (e.g. a tablet). As shown in  FIG. 2 , the computing device  1  includes a processor  3  configured for implementing the method of the present invention, and a display device  5  configured for displaying the three-dimensional model including the applied two-dimensional image. 
         [0038]    The skilled person will understand that any combination of elements is possible within the scope of the invention, as claimed.