Method and apparatus for generating three-dimensional model, and terminal and storage medium
By overlaying and displaying multiple selectable and colorable grids on the surface of the 3D model, the problem of the lack of direct coloring of the 3D model in the existing technology is solved, and users can create highly accurate and convenient pixel paintings on the 3D model.
Patent Information
- Application Number
- PCT/CN2024/078232
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-21
- Filing Date
- 2024-02-23
- Publication Date
- 2024-09-26
AI Technical Summary
The existing technology only supports the creation of pixel paintings on 2D canvases and lacks direct coloring and selection functions on 3D models, making it difficult for users to directly perceive and accurately color 3D models.
By overlaying and displaying multiple selectable and colorable meshes on the surface of the 3D model, users can select and color meshes directly on the 3D model, thereby generating a colored 3D model, which improves the accuracy of direct coloring on the 3D model. sex.
It enables users to directly perceive and accurately color 3D models, improves the convenience and accuracy of creating pixel paintings of 3D models, and reduces learning costs.
Smart Images

Figure CN2024078232_26092024_PF_FP
Abstract
Description
Three-dimensional model generation method, device, terminal and storage medium
[0001] This application claims priority to Chinese patent application No. 202310306289.9, filed on March 21, 2023, entitled “Pixel painting drawing method, device, terminal and storage medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] The embodiments of the present application relate to the field of computer technology, and in particular to a method, device, terminal, and storage medium for generating a three-dimensional model. Background Art
[0003] Pixel art refers to a type of painting composed of multiple pixels, where a pixel can refer to the smallest unit on a canvas, such as the smallest square pixel grid.
[0004] In the related art, users select and color pixel grids on a 2D (Two Dimensional) canvas provided by a client to obtain a 2D pixel painting. However, the above related art only supports 2D canvases.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a method, device, terminal, and storage medium for generating a three-dimensional model. The technical solution is as follows:
[0007] According to one aspect of an embodiment of the present application, a method for generating a three-dimensional model is provided, the method being executed by a terminal device, the method comprising:
[0008] Displaying a coloring interface, wherein the coloring interface displays an initial three-dimensional model;
[0009] Overlaying and displaying a plurality of grids that fit the surface on the surface of the initial three-dimensional model, wherein the grids are the smallest colored units on the surface;
[0010] In response to the respective shading instructions for the plurality of meshes, the shaded three-dimensional model is generated.
[0011] According to one aspect of an embodiment of the present application, a device for generating a three-dimensional model is provided, the device comprising:
[0012] A model display module, configured to display a coloring interface in which an initial three-dimensional model is displayed;
[0013] A grid display module, configured to overlay and display a plurality of grids conforming to the surface of the initial three-dimensional model, wherein the grids are the smallest coloring units on the surface;
[0014] The mesh coloring module is configured to generate the colored three-dimensional model in response to the coloring instructions for each of the plurality of meshes.
[0015] According to one aspect of an embodiment of the present application, a terminal device is provided, which includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned three-dimensional model generation method.
[0016] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned method for generating a three-dimensional model.
[0017] According to one aspect of an embodiment of the present application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a terminal device reads the computer program from the computer-readable storage medium and executes the computer program, causing the terminal device to perform the above-described method for generating a three-dimensional model.
[0018] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0019] By supporting the superposition and display of multiple selectable and colorable grids that fit the surface of the three-dimensional model on the surface of the three-dimensional model, users can directly select the grids to be colored on the three-dimensional model to obtain the colored three-dimensional model, which is conducive to the user's direct perception of the three-dimensional model and thus improves the accuracy of direct coloring on the three-dimensional model. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] FIG1 is a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application;
[0021] FIG2 is a flowchart of a method for coloring a pixel painting provided by one embodiment of the present application;
[0022] FIG3 is a schematic diagram of a coloring interface provided by an embodiment of the present application;
[0023] FIG4 is a schematic diagram of the shape of a stylus provided by one embodiment of the present application;
[0024] FIG5 is a schematic diagram of a color disk provided in one embodiment of the present application;
[0025] FIG6 is a schematic diagram of the edge of a stylus handwriting provided by one embodiment of the present application;
[0026] FIG7 is a schematic diagram of handwriting of a stylus provided by one embodiment of the present application;
[0027] FIG8 is a schematic diagram of a grid provided by one embodiment of the present application;
[0028] FIG9 is a schematic diagram of a three-dimensional model provided by one embodiment of the present application, in which a plurality of grids are superimposed and displayed on the surface of the three-dimensional model;
[0029] FIG10 is a schematic diagram of a colored three-dimensional model provided by one embodiment of the present application;
[0030] FIG11 is a schematic diagram of colored touch points on a three-dimensional model provided by one embodiment of the present application;
[0031] 12-16 are schematic diagrams showing exemplary methods for obtaining subgrids;
[0032] FIG17 is a schematic diagram of a method for rotating a three-dimensional model provided in one embodiment of the present application;
[0033] FIG18 is a schematic diagram of a method for reducing a three-dimensional model according to an embodiment of the present application;
[0034] FIG19 is a schematic diagram of a method for magnifying a three-dimensional model provided in one embodiment of the present application;
[0035] FIG20 is a schematic diagram of a method for moving a three-dimensional model provided in one embodiment of the present application;
[0036] FIG21 is a flowchart of a grid map superposition method provided by one embodiment of the present application;
[0037] FIG22 is a schematic diagram of a UV map provided by one embodiment of the present application;
[0038] FIG23 is a schematic diagram of desired coloring density provided by one embodiment of the present application;
[0039] FIG24 is a schematic diagram of the display principle of a pixel painting provided by one embodiment of the present application;
[0040] FIG25 is a flowchart of a grid map superposition method provided by another embodiment of the present application;
[0041] FIG26 is a schematic diagram of a three-dimensional model provided by another embodiment of the present application, in which a plurality of grids are superimposed and displayed on the surface of the three-dimensional model;
[0042] FIG27 is a flowchart of a grid map superposition method provided by another embodiment of the present application;
[0043] FIG28 is a schematic diagram of a three-dimensional model provided by another embodiment of the present application, in which a plurality of grids are superimposed and displayed on the surface of the three-dimensional model;
[0044] FIG29 is a block diagram of a device for generating a three-dimensional model according to an embodiment of the present application;
[0045] Figure 30 is a block diagram of a terminal device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0046] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0047] Before introducing the embodiments of the present application, the relevant terms involved in the present application are first explained.
[0048] 1. Three-dimensional model: A model that represents an object in three dimensions, X, Y, and Z. It usually consists of a polygonal model (i.e., a white model) and a texture on the polygonal model. A three-dimensional model can also be called a 3D model.
[0049] 2. UV map: UV map is a map obtained by UV unfolding a 3D model, which can be used to display the skin on the surface of the 3D model. Any 3D model can create a UV map with the help of software. U and V in the UV map are used to represent the projection relationship of the 3D model on the horizontal and vertical axes of the 2D plane. For example, a point in the coverage area in the UV map can correspond to a point on the surface of the 3D model. The coverage area in the UV map refers to the area formed by all points on the surface of the 3D model projected onto the UV map. There are UV trend lines on the UV map. The closed area enclosed by the UV trend lines corresponds to a surface on the 3D model. The UV trend lines can be used to reflect the surface curve of the 3D model.
[0050] 3. Pixel painting: A painting composed of multiple pixels, where the pixel can refer to the smallest unit on the canvas, such as the smallest square pixel grid. The pixel particles in the pixel painting are clearly visible. In some embodiments, no matter from which perspective the three-dimensional model is observed, multiple grids can be observed, and the multiple grids are displayed on the surface of the three-dimensional model in the form of a dot matrix. In some embodiments, the pixel painting is created by the user himself, or it can be modified using the provided template. For example, on the surface of the initial three-dimensional model, multiple grids after preliminary coloring are displayed, and the user can make adjustments to the multiple grids after preliminary coloring. The multiple grids after preliminary coloring may only have the outline of the pattern, or may include a pattern filled with color blocks, which is not limited in this application.
[0051] 4. Pixel grid: The smallest unit of a pixel art, which is generally a square. The present embodiment does not limit the shape of the pixel grid, such as triangle, rectangle, diamond, etc. The size of the pixel grid can be set and adjusted according to actual use requirements.
[0052] 5. Mapping: The construction of a three-dimensional model can be divided into two steps: modeling and mapping. "Mapping" here is a verb, which refers to the process of generating the skin of a three-dimensional model, also known as "painting the skin", such as color, material, texture, etc.
[0053] 6. Grid: In embodiments of the present application, a grid may be a pixel grid composed of multiple pixel grids, such as a pixel grid composed of multiple square pixel grids, wherein the grid has grid lines with a width of one pixel. In some embodiments, multiple grids on the three-dimensional model can be observed in any field of view.
[0054] Please refer to FIG1 , which shows a schematic diagram of an implementation environment of a solution provided by an embodiment of the present application. The implementation environment may include: a terminal device 10 and a server 20 .
[0055] The terminal device 10 can be an electronic device such as a mobile phone, tablet computer, game console, multimedia player, PC (Personal Computer), vehicle-mounted terminal, intelligent robot, wearable device, etc. The terminal device 10 can be installed with a client of a target application, such as a client of a 3D model creation application, a pixel art creation application, a gaming application, a simulation learning application, a social application, an interactive entertainment application, etc. Optionally, the target application can have a UV map generation function. Optionally, the terminal device 10 can have a touch screen display to allow users to create pixel images on the 3D model.
[0056] The server 20 is used to provide background services for the client of the target application (such as a game application) in the terminal device 10. For example, the server 20 can be the background server of the target application (such as a game application). The server 20 can be a single server, a server cluster consisting of multiple servers, or a cloud computing service center.
[0057] The terminal device 10 and the server 20 can communicate with each other via a network 30. The network 30 can be a wired network or a wireless network.
[0058] For example, referring to FIG1 , a client for a game application is used as an example. The client provides a service for creating pixel images on a three-dimensional model. The client displays a three-dimensional model 101 through a coloring interface. On the surface of the three-dimensional model 101, multiple grids 102 that fit the surface of the three-dimensional model are superimposed and displayed. The multiple grids 102 are selectable and colorable. In response to the user's selective coloring of at least one grid 102 on the surface of the three-dimensional model 101, the client generates a pixel image 103 based on the operation and displays the three-dimensional model 101 with the pixel image 103. The pixel image 103 is attached to the surface of the three-dimensional model 101 and displayed with a three-dimensional effect.
[0059] Please refer to FIG2 , which shows a flow chart of a method for generating a three-dimensional model provided by one embodiment of the present application. The execution subject of each step of the method may be the terminal device 10 in the implementation environment of the solution shown in FIG1 , such as a client in the terminal device 10. The method may include the following steps (steps 201 to 203):
[0060] Step 201: Display a rendering interface, in which an initial three-dimensional model is displayed.
[0061] A coloring interface refers to an interface that can provide image coloring services. For example, the coloring interface in the embodiment of the present application can refer to an interface that can provide pixel painting services on a three-dimensional model, and the coloring interface can refer to the coloring interface corresponding to the above-mentioned target application.
[0062] Optionally, the shading interface can load and display an initial three-dimensional model. For example, after the shading interface loads the initial three-dimensional model, it constructs a 3D canvas (such as a square, rectangle, etc.) for the initial three-dimensional model, and the user can use the 3D canvas to create pixel art for the initial three-dimensional model. The initial three-dimensional model can be displayed from the perspective of a virtual camera, and the virtual camera is used to observe the three-dimensional model. For example, the shading interface displays the initial three-dimensional model in the first field of view of the virtual camera. The first field of view can be the initial field of view of the virtual camera, and the initial field of view can be used to fully display the initial three-dimensional model.
[0063] The embodiments of the present application do not limit the initial three-dimensional model mentioned above, and it can be an initial three-dimensional model of any object, such as an initial three-dimensional model corresponding to clothing, a person, an animal, a plant, a building, etc. The initial three-dimensional model can refer to an initial three-dimensional model that has been completed.
[0064] For example, referring to FIG3 , the coloring interface displays an initial three-dimensional model 301 in a first field of view. The initial three-dimensional model 301 may refer to an initial three-dimensional model of clothing on a three-dimensional human body model. Optionally, the coloring interface may further include a stylus selection control 302 and a part selection control 303. The stylus selection control 302 may be used to select the shape, size, color, and pressure sensitivity of a stylus (e.g., a pixel pen). The stylus serves as a bridge for interaction between the user and the 3D canvas, and is used to select and color meshes on the 3D canvas.
[0065] The embodiment of the present application does not limit the stylus. Optionally, the shape of the stylus can refer to a square, a triangle, a rectangle, etc. For example, referring to Figure 4, the shape of the stylus is a square 401. For pixel paintings composed of grids, a square stylus is conducive to the selection of grids and the infinite continuation of the grids up, down, left, and right, which is a better choice. The size of the stylus refers to the number of grids that can be filled with each touch operation. The size of the stylus (i.e., setting the number of grids) can correspond to 1 grid, 2 grids, 3 grids, and so on. The color of the stylus can be selected through a color wheel or a palette. For example, referring to Figure 5, the user can select the color of the stylus through the color wheel 501 to fill the grid. The handwriting edge of the stylus in the example of the present application can be a vector edge. A vector edge refers to the boundary of lines and surfaces formed by analyzing the spatial relationship between different grids on the initial three-dimensional model. For example, referring to Figure 6, the area corresponding to the stylus is a square color block 601 with sharp corners. In some embodiments, the pressure sensitivity of the stylus refers to the relationship between the contact area between the user's finger and the touch display screen and the size of the stylus. For example, the greater the pressure sensitivity of the stylus, that is, the greater the contact area between the user's finger and the touch display screen, the larger the size of the stylus. In order to facilitate the manipulation of the size of the stylus, the pressure sensitivity of the stylus in the example of the present application is fixed, that is, no matter how large the contact area between the user's finger and the touch display screen is, the size of the stylus remains unchanged. In some embodiments, the handwriting of the stylus refers to the pattern displayed on the colored grid. In some embodiments, the handwriting of the stylus can be a color fill or a pattern fill. In some embodiments, the handwriting of the stylus can adjust parameters such as transparency and brightness. Optionally, the handwriting of the stroke is filled with full color and has no transparency. For example, referring to Figure 7, the grid corresponding to the handwriting 701 of the stroke is filled with all black and has no transparency.
[0066] The part selection control 303 can be used to select different parts of the initial three-dimensional model 301. For example, when the initial three-dimensional model 301 is a clothing model, the part selection control 303 can be used to select the left sleeve part, right sleeve part, front chest part, back chest part, etc. of the clothing model.
[0067] Step 202 : Overlay and display a plurality of grids that fit the surface on the surface of the initial three-dimensional model. The grid is the smallest shading unit on the surface determined based on pixels.
[0068] In the embodiments of the present application, a grid may be a pixel grid composed of multiple pixel grids. The multiple grids are displayed in a manner aligned with the surface of the initial three-dimensional model. However, the multiple grids are not merged with the surface of the initial three-dimensional model, but are superimposed on the surface of the initial three-dimensional model. The surface of the initial three-dimensional model can be used to describe the shape and outline of the initial three-dimensional model.
[0069] In some embodiments, the coloring interface further displays a part selection control, wherein the part selection control is used to select a part of the initial three-dimensional model, and the multiple grids are superimposed and displayed on the surface of the selected part.
[0070] The grid in the embodiment of the present application may include two parts: grid lines and sub-grids. Grid lines can be shared by adjacent sub-grids, and sub-grids are unique to the grid. Users can select and color the grid as a whole, or select and color only the sub-grids in the grid to create pixel art. Grid lines are used by users to distinguish different grids. The transparency of grid lines is non-zero, such as 90%, 100%, etc., and the transparency of sub-grids is 0%.
[0071] Taking a square pixel grid as an example, referring to Figure 8 , grid 801 comprises 4*4 pixel grids. Horizontal grid lines 802 of grid 801 consist of 4 pixel grids, and vertical grid lines 803 of grid 801 consist of 3 pixel grids. Horizontal grid lines refer to the grid lines in the horizontal direction (i.e., the X-axis direction), and vertical grid lines refer to the grid lines in the vertical direction (i.e., the Y-axis direction). Subgrid 804 of grid 801 comprises 3*3 pixel grids.
[0072] For example, referring to FIG9 , the coloring interface displays multiple grids 304 (white areas are subgrids) superimposed on the surface of the initial three-dimensional model 301. The multiple grids 304 (or subgrids of the multiple grids 304) are selectable and colorable, that is, the user can select a grid 304 and color it using a stylus. Referring to FIG10 , the colored grids 304 (or corresponding subgrids) are filled with full color.
[0073] Step 203 : generating a colored three-dimensional model in response to the coloring instructions for the plurality of meshes.
[0074] Coloring commands are instructions for selective coloring of meshes. Selective coloring is the process of selecting and coloring meshes. By selectively selecting and coloring meshes, users can create multiple colored meshes. These colored meshes and uncolored meshes can then be combined to form a pixel art.
[0075] When the user continuously selects grids, the client generates color blocks (i.e., colored grids or sub-grids) in real time at a certain frame rate, that is, the selected grids are colored. In response to the user stopping coloring, the client can hide the grid lines of the grid (e.g., adjust the transparency to 100%) to obtain a colored pixel map. The colored pixel map is attached to the surface of the initial 3D model, but the pixel map is not merged with the surface of the initial 3D model, but is superimposed on the surface of the initial 3D model.
[0076] Optionally, after the pixel painting is rendered, the user can rotate the initial three-dimensional model to view the pixel painting on the initial three-dimensional model.
[0077] In one example, selective coloring of the mesh on the initial three-dimensional model can be performed by filling all pixel cells included in the mesh with full color, or by filling only sub-grids corresponding to the mesh with full color. Taking the example of filling the mesh with full color, step 203 can also include the following:
[0078] 1. Get the colored touch points corresponding to the touch operation on the 3D model.
[0079] It should be noted that the three-dimensional model mentioned in the embodiments of the present application may refer to the initial three-dimensional model, the three-dimensional model after coloring, or the three-dimensional model in the coloring process, and the present application does not limit this.
[0080] Optionally, the touch operation may refer to a touch operation of the user on the touch display screen. In some embodiments, the colored touch point is determined based on the contact surface between the touch operation and the touch display screen. In some embodiments, the colored touch point may be the center point of the contact surface between the touch operation and the touch display screen, or may be any point on the contact surface between the touch operation and the touch display screen, and this application does not limit this. Exemplarily, the center point of the contact surface between the touch operation and the touch display screen is a colored touch point, and the colored touch point can be used to select a grid on a three-dimensional model. For example, referring to Figure 11, the touch operation may refer to a single-finger touch operation of the user, and the center point 1101 of the contact surface between the single-finger touch operation and the touch display screen is the colored touch point.
[0081] In one example, a ray can be used to determine which grid on the 3D model a touch point falls within. For example, a ray is emitted from the touch point, perpendicular to the touch screen and pointing toward the interior of the touch screen. The intersection of this ray and the 3D model is the point on the 3D model where the touch point falls. The grid on the 3D model where this point falls is the grid to which the touch point falls.
[0082] Optionally, because the grids in embodiments of the present application include grid lines, the point where the colored touch point lands on the 3D model may fall on a grid line, and the grid line may be shared by adjacent grids. In this case, a set rule may be used to determine the first grid, or the user may be prompted that the touch point location cannot be identified. In some embodiments, using the example of setting a rule to determine the first grid, embodiments of the present application may further include the following: if the colored touch point lands on a horizontal grid line on the 3D model, the grid below the horizontal grid line and with the horizontal grid line as its grid line is determined as the first grid; or, if the colored touch point lands on a vertical grid line on the 3D model, the grid to the right of the vertical grid line and with the vertical grid line as its grid line is determined as the first grid. The first grid refers to the grid to which the colored touch point lands on the 3D model. In some embodiments, using the example of prompting the user that the touch point location cannot be identified, embodiments of the present application may further include the following: displaying a first prompt message, the first prompt message being used to notify the user that the colored touch point is located on a grid line; and in response to an action in response to the first prompt message, restarting execution from step 202. Through the above method, a method for determining the first grid is provided for the case where the colored touch point is located on the grid line. The use of set rules to determine the first grid can improve the efficiency of determining the first grid; using prompt information to prompt the user to reselect the colored touch point can avoid first grid recognition errors and improve the user experience.
[0083] For example, referring to Figure 8, when the colored touch point falls on horizontal grid line 802, grid 804 below horizontal grid line 802 and with horizontal grid line 802 as the grid line is determined as the first grid; when the colored touch point falls on vertical grid line 803, the grid to the right of vertical grid line 803 and with vertical grid line 803 as the grid line is determined as the first grid.
[0084] 2. When the colored touch point falls on the three-dimensional model, obtain at least one mesh corresponding to the colored touch point.
[0085] Optionally, at least one grid corresponding to the colored touch point is determined in combination with the size of the stylus. The colored touch point is displayed in the colored interface in the form of a stylus and has the functions of a stylus.
[0086] In one example, when the number n of set grids corresponding to the colored touch point is an odd number, n*n grids are obtained with the first grid where the colored touch point falls on the three-dimensional model as the center.
[0087] The number of set grids corresponding to the colored touch points is the size of the stylus, and n is a positive integer.
[0088] For example, referring to Figure 12, the grid lines of the grid are simplified and displayed as straight lines (the same applies to the entire text). The number of set grids corresponding to the colored touch point 1201 is 1, so 1*1=1 grid needs to be obtained. The black square 1202 is the size of the colored touch point 1201. The colored touch point 1201 falls in the grid 1203, then the grid 1203 is determined as the first grid, and the grid 1203 is obtained.
[0089] For another example, referring to Figure 13, the number of set grids corresponding to the colored touch point 1301 is 3, so 3*3=9 grids need to be obtained. The colored touch point 1301 falls in the grid 1302, so the grid 1302 is determined as the first grid, and 9 grids centered on the grid 1302 are obtained, that is, the 9 grids included in the area 1303.
[0090] For another example, referring to Figure 14, the number of set grids corresponding to the colored touch point 1401 is 5, so 5*5=25 grids need to be obtained. The colored touch point 1401 falls in the grid 1402, so the grid 1402 is determined as the first grid, and 25 grids centered on the grid 1402 are obtained, that is, the 25 grids included in the area 1403.
[0091] In another example, when the number n of set grids corresponding to the colored touch point is an even number, the first grid where the point where the colored touch point falls on the three-dimensional model is located is divided into four areas, and the area where the colored touch point falls is obtained; the grid is expanded according to the direction indicated by the area where the colored touch point falls, and n*n grids including the first grid are obtained.
[0092] Optionally, if the grid is expanded in the direction indicated by the area where the colored touch point falls, n*n grids can be obtained, then the grid expansion is stopped; if the grid is expanded in the direction indicated by the area where the colored touch point falls, (n-1)*(n-1) grids can be obtained, then 2n-1 grids are expanded in the opposite direction to obtain n*n grids distributed in an n-grid, so as to ensure that the grid is selected reasonably.
[0093] For example, referring to Figure 15, the number of set grids corresponding to the colored touch point 1501 is 2, then 2*2=4 grids need to be obtained, and the colored touch point 1501 falls in the grid 1502, then the grid 1502 is determined as the first grid, and after the grid 1502 is evenly divided into 4 areas, it is found that the colored touch point 1501 falls in the area 1503, then the grid is expanded in the direction of the area 1503, and 4 grids including the grid 1502 are obtained, that is, the 4 grids in the area 1504.
[0094] For another example, referring to Figure 16, the number of set grids corresponding to the colored touch point 1601 is 4, so 4*4=16 grids need to be obtained. The colored touch point 1601 falls in the grid 1602, and the grid 1602 is determined as the first grid. After the grid 1602 is evenly divided into 4 areas, it is found that the colored touch point 1601 falls in the area 1603, and the grid is expanded in the direction of the area 1603 to obtain 9 grids including the grid 1602, and then 2*4-1=7 grids are expanded in the reverse direction to obtain 16 grids including the grid 1602, that is, the 16 grids in the area 1604.
[0095] By using the above method, when the number of set grids corresponding to the colored touch points is odd or even, grids can be reasonably selected.
[0096] 3. Fill at least one grid with a specified color to generate a colored three-dimensional model.
[0097] Optionally, at least one grid corresponding to each colored touch point is obtained, and the corresponding at least one grid is fully filled with the specified color corresponding to each colored touch point, so as to obtain a three-dimensional model with pixel painting on the surface (the colored three-dimensional model).
[0098] In one example, if the touch point doesn't land on the 3D model, the 3D model is controlled to rotate in the direction of the touch point's movement in response to the touch point's movement. That is, if a vertical ray originating from the touch point doesn't intersect the 3D model, the touch point is used to control the 3D model's rotation. This control allows users to adjust the display of the grid and 3D model as needed, allowing for more accurate pixel art creation on the 3D model.
[0099] For example, referring to Figure 17, the colored touch point 1701 does not fall on the three-dimensional model. In response to the colored touch point 1701 moving to the left, the client controls the three-dimensional model to rotate to the left; in response to the colored touch point 1701 moving to the right, the client controls the three-dimensional model to rotate to the right; in response to the colored touch point 1701 moving upward, the client controls the three-dimensional model to rotate upward; in response to the colored touch point 1701 moving downward, the client controls the three-dimensional model to rotate downward.
[0100] In one example, during the coloring process of the pixel painting, the user can also adjust the 3D model by zooming in, zooming out, and translating. The embodiment of the present application may also include the following:
[0101] First, a plurality of adjustment touch points corresponding to the adjustment operation on the three-dimensional model are obtained.
[0102] The adjustment operation is different from the touch operation described above. The adjustment operation is used to adjust the display mode of the three-dimensional model. It can be a two-finger touch operation, a multi-finger touch operation, etc., which is not limited in the present embodiment. In the case of a two-finger touch operation, the multiple adjustment touch points are the center points of the contact areas between the two fingers and the touch screen.
[0103] Optionally, when the multiple adjustment touch points change from being dispersed to being gathered, the field of view of the virtual camera is increased and the three-dimensional model is displayed in a reduced size.
[0104] The virtual camera is used to observe the 3D model. Raising the virtual camera's field of view increases the relative distance between the virtual camera and the 3D model, thereby reducing the size of the 3D model. The change in the multiple adjustment touch points from dispersed to converged refers to the gradual decrease in the distance between the multiple adjustment touch points.
[0105] For example, referring to Figure 18, when the adjustment touch point 1801 and the adjustment touch point 1802 change from dispersion to convergence, the virtual camera field of view is raised, the three-dimensional model, grid and brush strokes are reduced at the same time, and the three-dimensional model, grid and brush strokes are in the same three-dimensional airdrop, and the reduction ratio of the three is the same. The reduction ratio can be positively correlated with the change in the distance between the adjustment touch point 1801 and the adjustment touch point 1802.
[0106] Optionally, when the multiple adjustment touch points change from being gathered together to being dispersed, the field of view of the virtual camera is lowered and the three-dimensional model is displayed in an enlarged manner.
[0107] For example, referring to Figure 19, when the adjustment touch point 1901 and the adjustment touch point 1902 change from gathering to dispersing, the virtual camera field of view is lowered, the three-dimensional model, grid and brush strokes are all enlarged, and the three-dimensional model, grid and brush strokes are in the same three-dimensional airdrop. The magnification ratio of the three is the same, and the magnification ratio can be positively correlated with the change in the distance between the adjustment touch point 1901 and the adjustment touch point 1902.
[0108] Optionally, when the plurality of adjustment touch points are moved as a whole from the first position to the second position, the virtual camera used to observe the initial three-dimensional model is horizontally smoothed from the first field of view to the second field of view to display the three-dimensional model in the second field of view.
[0109] The second field of view is different from the first field of view. The second field of view is at the same height as the first field of view. The second position is different from the first position.
[0110] For example, referring to Figure 20, if the adjustment touch point 2001 and the adjustment touch point 2002 move upward as a whole, the client will adjust the position of the virtual camera horizontally upward to observe the head of the three-dimensional model; if the adjustment touch point 2001 and the adjustment touch point 2002 move downward as a whole, the client will adjust the position of the virtual camera horizontally downward to observe the legs of the three-dimensional model; if the adjustment touch point 2001 and the adjustment touch point 2002 move to the left as a whole, the client will adjust the position of the virtual camera horizontally to the left to observe the left arm of the three-dimensional model; if the adjustment touch point 2001 and the adjustment touch point 2002 move to the right as a whole, the client will adjust the position of the virtual camera horizontally to the right to observe the right arm of the three-dimensional model.
[0111] To sum up, the technical solution provided by the embodiments of the present application supports the superimposition and display of multiple selectable and colorable grids that fit the surface of the three-dimensional model on the surface of the three-dimensional model, so that the user can directly select the grid to be colored on the three-dimensional model to obtain the colored three-dimensional model, which is conducive to the user's direct perception of the three-dimensional model and thereby improves the accuracy of direct coloring on the three-dimensional model.
[0112] In addition, by allowing the grid to zoom in, out, move, and rotate along with the 3D model, users can adjust the display of the grid and 3D model as needed to more accurately create pixel art of the 3D model. At the same time, by creating pixel art on the 3D model, users can accurately perceive the 3D model, which improves the convenience of creating pixel art corresponding to the 3D model and reduces the learning cost of pixel art corresponding to the 3D model. Users can view their creations while creating pixel art, and can intuitively view their own creations, which improves the user experience.
[0113] The following describes in detail how to overlay multiple grids on a 3D model.
[0114] In some embodiments, the pixel grid can be superimposed on the surface of the three-dimensional model according to the UV map of the three-dimensional model. Referring to Figure 21, the above step 202 can also include the following sub-steps:
[0115] Step S11 : obtaining a UV map of the three-dimensional model, where points in a coverage area of the UV map have a mapping relationship with points on the surface of the three-dimensional model.
[0116] Optionally, the UV map of the three-dimensional model can be obtained by UV unfolding the three-dimensional model, that is, all points on the surface of the three-dimensional model are projected onto a 2D plane to obtain the UV map of the three-dimensional model. Among them, all points on the surface of the three-dimensional model correspond to the coverage area of the UV map. In some embodiments, the UV map is rectangular, and the points on the surface of the three-dimensional model projected onto the 2D plane may not be a rectangular 2D map. In this case, the coverage area of the UV map is not the complete UV map, so the coverage area of the UV map can also be called the effective area of the UV map.
[0117] For example, referring to FIG22 , by UV unfolding the three-dimensional model 2201 , a UV map 2202 of the three-dimensional model 2201 can be obtained. The grid area in the UV map 2202 is the coverage area of the UV map 2202 , and the grid lines in the grid area are the UV direction lines.
[0118] Step S12: grid-superimpose the UV map to obtain a UV map with a grid.
[0119] Alternatively, you can create a mesh map based on the user's mesh size requirements, and then overlay the mesh map on the UV map to create a UV map with a mesh. The mesh map can be deployed in a layer above the UV map.
[0120] In one example, step S12 may include the following:
[0121] 1. Get the first pixel size and the desired shading density corresponding to the pixel art. The first pixel size is the pixel size corresponding to the UV map.
[0122] The first pixel size of the UV map determines the pixel size of the grid map. That is, the pixel size of the grid map corresponding to the UV map is consistent with the pixel size of the UV map. However, only the area in the grid map that corresponds to the coverage area of the UV map is valid, that is, it is used to be superimposed on the 3D model.
[0123] The first pixel size is the pixel size of the UV map. For example, if the UV map is rectangular, its first pixel size can be expressed as length * width, in pixels, such as 512*512.
[0124] The desired shading density is used to indicate the number of grids corresponding to the pixel art, and can be set and adjusted according to user needs. The number of pixel grids corresponding to each grid can be calculated based on the desired shading density. The desired shading density can be 32*32 grids, 64*64 grids, 128*128 grids, 256*256 grids, etc. The more grids there are, the finer the pixel art, but the higher the shading cost.
[0125] The client can also recommend a desired shading density by first trying different desired shading densities to determine the fit between the 3D model and the desired density, then finding the optimal desired shading density to recommend to the user. For example, referring to FIG23 , the client provides three simulated pixel maps at three desired shading densities: a 32*32 simulated pixel map 2301, a 64*64 simulated pixel map 2302, and a 128*128 simulated pixel map 2303. The client then maps the initial 3D model based on simulated pixel maps 2301, 2302, and 2303, respectively, to obtain mapped 3D models 2304, 2305, and 2306, respectively. Mapped 3D model 2304 has a low painting effect and a low painting cost; mapped 3D model 2305 has a moderate painting effect and a moderate painting cost; and mapped 3D model 2306 has a high painting effect and a high painting cost.
[0126] Alternatively, painting is usually done on a white or off-white canvas. In order to simulate this pure effect, a pure white or pure gray UV map can be generated. The pixel size of the UV map can be set and adjusted according to actual usage requirements.
[0127] 2. Determine a first grid size based on the desired shading density and the first pixel size.
[0128] Considering that at each moment, the shading interface only displays one face of the three-dimensional model, half of the first pixel value can be used to determine the first grid size. For example, the length or height corresponding to the first pixel size is obtained, and then half of the length or height is obtained to obtain a first intermediate parameter, and the first intermediate parameter is divided by the desired shading density to obtain a second intermediate parameter. The first grid size can be obtained according to the second intermediate parameter. The grid size is used to refer to the number of grids in the grid. Optionally, the first grid size can be the second intermediate parameter * the second intermediate parameter.
[0129] For example, referring to Figure 22, assume that the first pixel size of the UV map 2202 is 512*512. Considering that at each moment, the shading interface only displays one face of the three-dimensional model 2201, such as the front chest of the three-dimensional model 2201, we take half of the length or height of the first pixel size: 256. If the expected shading density is 64, the second intermediate parameter can be obtained: 256 / 64=4, and the first grid size is 4*4, which includes 16 pixel grids.
[0130] 3. Construct a first grid map corresponding to the UV map according to the first pixel size and the first grid size, wherein the size of the grids in the first grid map is equal to the first grid size.
[0131] Optionally, the first grid map is constructed with the first pixel size being the pixel size of the first grid map and the first grid size being the size of the grids in the first grid map. The first grid map may be a wireframe map.
[0132] Wherein, each grid in the first grid diagram includes grid lines and sub-grids. Exemplarily, the grid under the first grid size includes m*m pixel grids, then the width of the grid lines of the grid under the first grid size is 1 pixel grid, and the sub-grid of the grid under the first grid size includes (m-1)*(m-1) pixel grids, where m is an integer greater than 1. The first grid diagram is divided into grid lines and sub-grids, and the user can determine the coloring range of the pixel painting based on the grid lines and sub-grids, which makes it more convenient for the user to color and improves the user experience.
[0133] Optionally, the grid is a square, with the first row of pixels forming the horizontal grid lines of the grid, the first column of pixels forming the vertical grid lines of the grid, and the remaining pixels forming the subgrids of the grid. Alternatively, the mth row of pixels forming the horizontal grid lines of the grid, the mth column of pixels forming the vertical grid lines of the grid, and the remaining pixels forming the subgrids of the grid, which is not limited in this embodiment of the present application. The grid lines of the grid can be filled with black or dark gray with 0% transparency, and the subgrids can be hollowed out with 100% transparency to form a first grid map.
[0134] 8 , the first grid image is composed of multiple grids 801, each of which includes horizontal grid lines 802, vertical grid lines 803, and subgrids 804. Horizontal grid lines 802 and vertical grid lines 803 are filled with black at 0% transparency, while subgrids 804 are hollowed out at 100% transparency.
[0135] 4. Superimpose the first mesh map and the UV map to obtain a UV map with a mesh, wherein the UV map with a mesh only includes the coverage area with the mesh.
[0136] Optionally, the first grid map and the UV map are aligned and overlaid to create a UV map with a grid. Each point in the first grid map corresponds one-to-one with each point in the UV map, i.e., the first grid map and the UV map have a one-to-one correspondence in terms of space and area. The first grid map can be deployed in a layer above the UV map. Optionally, the client also provides adjustment parameters to overlay the grid only on the area covered by the UV map.
[0137] Through the above method, the UV map can be superimposed on the grid to obtain a UV map with a grid. Users can color pixel paintings based on the grid, laying the foundation for users to color pixel paintings on three-dimensional models.
[0138] Step S13 , mapping the initial three-dimensional model according to the UV mapping with the grids, to obtain a three-dimensional model with a plurality of grids superimposed and displayed on the surface.
[0139] In some embodiments, based on the mapping relationship between points in the UV map and points on the surface, the grid on the UV map with the grid is superimposed on the three-dimensional model to obtain a three-dimensional model with multiple grids superimposed and displayed on the surface.
[0140] Optionally, based on the mapping relationship between points in the coverage area of the UV map and points on the surface, the meshes on the UV map with meshes are superimposed on the 3D model to obtain a 3D model with multiple meshes superimposed and displayed on the surface. Points in the coverage area of the UV map are mapped and superimposed on the 3D model, while points outside the coverage area are not mapped. This allows the multiple meshes on the mapped 3D model to better fit the surface of the 3D model, avoiding the situation where meshes are mapped outside the display range of the 3D model.
[0141] In some embodiments, the mapping relationship between points on the grid of the UV map with a grid and points on the surface is determined based on the mapping relationship between points in the coverage area of the UV map and points on the surface; based on the mapping relationship between points on the grid of the UV map with a grid and points on the surface, the points on the grid on the UV map with a grid are projected in sequence, and the grid on the UV map with a grid is superimposed on the three-dimensional model to obtain a three-dimensional model with multiple grids fitted and superimposed on the surface.
[0142] Taking the first grid map as an example, for any point A in the coverage area of the UV map, it corresponds to point B on the surface of the three-dimensional model and to point C on the first grid map. Point C can be projected to the position of point B, and point C can be set in the layer above point B. The points in the first grid map can be projected in turn, and the first grid map can be superimposed on the three-dimensional model to obtain a three-dimensional model with multiple grids fitted and superimposed on the surface.
[0143] The grid lines in the first grid map are evenly and curvedly projected onto the 3D model, following the distribution of the UV lines in the UV map. This means the first grid map corresponds to a grid map on the 3D model. Below the grid lines is the original texture, such as a pure white or gray texture, resulting from the UV map projection.
[0144] Optionally, the first grid map corresponding to the grid map can be superimposed on the surface of the three-dimensional model by the client in real time for the user to create pixel art. For example, referring to Figure 24, the first grid map 2402 is based on the UV map 2401 of the three-dimensional model to obtain the grid map 2403 on the surface of the three-dimensional model. The grid map 2403 is displayed with a three-dimensional effect. The user's coloring operation on the grid map 2403 is actually applied to the first grid map 2402 to achieve selective coloring of the grid on the surface of the first grid map 2402 to obtain a 2D pixel painting. The client then converts the changes on the first grid map 2402 to the grid map 2403 in real time according to the UV map 2401, that is, the 2D pixel painting is projected onto the surface of the three-dimensional model. The projected 2D pixel painting will follow the outline of the three-dimensional model, thereby realizing the display of the pixel painting on the three-dimensional model. Optionally, during the pixel painting creation process, the client can turn off the UV direction lines projected by the UV map on the three-dimensional model to avoid affecting the user.
[0145] In summary, the technical solution provided by the embodiments of this application enables users to create pixel art on a 3D model by projecting a grid image onto the surface of the 3D model based on the spatial mapping relationship between the UV map and the 3D model. This allows the grid image corresponding to the grid image to fit more closely to the 3D model, reducing the pulling problem of the pixel art, thereby improving the accuracy of creating pixel art on the 3D model.
[0146] Furthermore, for any 3D model, the grid image can be projected onto the 3D model using its corresponding UV map, thereby increasing the versatility of the technical solution provided by the embodiments of this application. Furthermore, since the UV maps of different 3D models are all rectangular, it is easier to determine the pixel size of the grid on the grid image, reducing the difficulty of determining the pixel size of the grid and improving the efficiency of grid image construction.
[0147] In some embodiments, the UV map of the three-dimensional model can be directly meshed to achieve the superposition and display of multiple meshes that fit the surface of the three-dimensional model on the surface of the three-dimensional model. Referring to Figure 25, the above step 202 can also include the following sub-steps:
[0148] Step S21 : obtaining a UV map of the three-dimensional model, where points in a coverage area of the UV map have a mapping relationship with points on the surface.
[0149] Step S22: Obtain a first pixel size and an expected shading density corresponding to the pixel painting, where the first pixel size is the pixel size corresponding to the UV map.
[0150] Step S23: determining a first grid size according to the desired coloring density and the first pixel size.
[0151] Steps S21-S23 are the same as those described in the above embodiment. For matters not described in the embodiment of this application, reference can be made to the above embodiment and will not be repeated here.
[0152] Step S24 : dividing the closed area in the coverage area of the UV map according to the first grid size to obtain a gridded UV map, wherein the size of the grids in the gridded UV map is less than or equal to the first grid size.
[0153] Among them, the closed area in the coverage area refers to the area enclosed by the UV trend line. The shape of the closed area is mostly irregular. Each closed area can correspond to a polygonal face on the three-dimensional model, such as a triangle face, a square face, a hexagonal face, etc.
[0154] Optionally, for each closed area in the coverage area, it is divided according to the first grid size so that each closed area is composed of a grid. For example, for a closed area with an area smaller than the first grid size, it can be directly divided into grids. For a closed area with an area greater than or equal to the first grid size, as many grids of the first grid size as possible are obtained. The purpose of the division is to make the newly added UV trend lines and the original UV trend lines as evenly distributed as possible in the form of grid lines, the UV trend lines are filled with 0% transparency, and the closed areas after division are hollowed out with 100% transparency.
[0155] For example, referring to FIG26 , a mesh map formed by meshed UV map projection is superimposed on the three-dimensional model 2601 , and the meshes in the mesh map are composed of meshes of a first mesh size and meshes similar to the first mesh size.
[0156] Optionally, when constructing a UV map, the closed area can be directly constructed into a grid of the first grid size to obtain a gridded UV map, and then the gridded UV map is projected onto the surface of the three-dimensional model to form a grid map for users to create pixel paintings.
[0157] Step S25 , mapping the initial three-dimensional model according to the gridded UV mapping, to obtain a three-dimensional model with a plurality of grids superimposed and displayed on the surface.
[0158] Optionally, based on the spatial mapping relationship between the points in the coverage area of the UV map and the points on the surface of the three-dimensional model, the UV direction lines in the UV map are projected onto the surface of the three-dimensional model to obtain a three-dimensional model with multiple grids superimposed on the surface.
[0159] Optionally, while the user is creating a pixel painting, the client selectively colors the grid on the gridded UV map based on the user's coloring operations in real time, and updates it to the grid map on the three-dimensional model in real time. After the user completes the pixel painting creation, the client stops displaying the UV direction lines on the three-dimensional model and keeps displaying the pixel painting.
[0160] In summary, the technical solution provided by the embodiments of the present application directly adjusts the UV direction lines of the UV map to achieve grid superposition on the surface of the three-dimensional model, thereby enabling users to create pixel art on the three-dimensional model. At the same time, because the UV map is more closely aligned with the three-dimensional model, it is beneficial to improve the accuracy of creating pixel art on the three-dimensional model. Moreover, since there is no need to construct a grid map, the implementation cost of the technical solution provided by the embodiments of the present application is further reduced.
[0161] In some embodiments, the grid image can be directly projected onto the three-dimensional model to achieve the superposition and display of multiple grids that fit the surface on the surface of the three-dimensional model. Referring to Figure 27, the above step 202 can also include the following sub-steps:
[0162] Step S31 : obtaining a second pixel size and an expected coloring density corresponding to the pixel painting, where the second pixel size is the pixel size of the three-dimensional model.
[0163] The second pixel size may refer to the pixel size of the 3D model in the first field of view, such as the pixel size of a 2D vertical projection of the 3D model in the first field of view, or half of the UV map. The desired shading density is the same as that described in the above embodiment and will not be repeated here.
[0164] Step S32: determining a second grid size according to the desired coloring density and the second pixel size.
[0165] The length or height of the second pixel size is divided by the desired shading density to obtain a third intermediate parameter. The second grid size is the third intermediate parameter * the third intermediate parameter, and the unit is pixel grid.
[0166] Step S33: constructing a second grid map corresponding to the three-dimensional model according to the second pixel size and the second grid size, wherein the size of the grids in the second grid map is equal to the second grid size.
[0167] The second grid map is constructed by taking the second pixel size as the pixel size of the second grid map and the second grid size as the pixel size of the grids in the second grid map.
[0168] In step S34 , the second grid image is projected onto the three-dimensional model using the virtual camera used to observe the initial three-dimensional model as a starting point.
[0169] Optionally, the second grid image is projected onto the three-dimensional model with the virtual camera as the starting point and 90 degrees vertically as the direction, so as to obtain a three-dimensional model with a plurality of grids uniformly superimposed on the surface.
[0170] In some embodiments, the second grid image is projected onto the three-dimensional model using the principle of pinhole imaging.
[0171] In some embodiments, the starting point refers to the location of the second grid diagram, and the imaging hole can be located on a ray extending from the starting point toward the three-dimensional model. The imaging hole refers to a hole through which light can pass, and other locations on the plane where the imaging hole is located are opaque. The plane where the imaging hole is located is perpendicular to the line between the three-dimensional model and the starting point. In one example, following the principle of light propagation in reality, the imaging hole is located between the starting point and the three-dimensional model, and the sum of the distance between the starting point and the imaging hole and the distance between the imaging hole and the three-dimensional model is equal to the distance between the three-dimensional model and the starting point. In another example, computer imaging does not follow the principle of light propagation in reality, but only follows the imaging law of larger objects near and smaller objects far away. The imaging hole is located on the side of the three-dimensional model away from the starting point, and the distance between the starting point and the imaging hole is equal to the sum of the distance between the imaging hole and the three-dimensional model and the distance between the three-dimensional model and the starting point.
[0172] In some embodiments, the starting point refers to the location of the imaging aperture, and the second grid can be located on a ray extending from the starting point toward the three-dimensional model. In one example, following real-world physical principles, the second grid is located between the starting point and the three-dimensional model, and the sum of the distance between the starting point and the second grid and the distance between the second grid and the three-dimensional model is equal to the distance between the three-dimensional model and the starting point. In another example, computer imaging does not follow real-world physical principles, but only follows the imaging principle of near-larger objects and far-smaller objects. The second grid is located on the side of the three-dimensional model away from the starting point, and the distance between the starting point and the imaging aperture is equal to the sum of the distance between the second grid and the three-dimensional model and the distance between the three-dimensional model and the starting point.
[0173] For example, referring to Figure 28, the second grid image 2802 is directly projected onto the surface of the three-dimensional model 2801 to obtain a three-dimensional model 2801 with multiple grids evenly superimposed on the surface. The surface of the three-dimensional model 2801 has some curves, and the grids are distorted accordingly.
[0174] Step S35 , fitting the surface, and overlaying and displaying multiple grids corresponding to the second grid map.
[0175] The second grid image is not merged with the surface of the 3D model, but is instead displayed as an overlay on the surface of the 3D model. Optionally, while the user is creating a pixel art, the client selectively colors the grid on the surface of the 3D model based on the user's coloring operation in real time to generate the pixel art. After the user completes the pixel art creation, the client stops displaying the grid on the 3D model and continues to display the pixel art.
[0176] In summary, the technical solution provided by the embodiments of this application directly projects a grid image onto a 3D model, thereby achieving a grid overlay on the surface of the 3D model, thereby enabling users to create pixel art on the 3D model. Furthermore, since UV mapping is not required, the implementation cost of the technical solution provided by the embodiments of this application is further reduced.
[0177] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0178] Please refer to Figure 29, which shows a block diagram of a device for generating a three-dimensional model provided by one embodiment of the present application. The device has the functions of implementing the above-mentioned method examples, and the functions can be implemented by hardware or by hardware executing corresponding software. The device can be the terminal device described above, or it can be set in a terminal device. As shown in Figure 29, the device 2900 includes: a model display module 2901, a grid display module 2902, and a grid coloring module 2903.
[0179] The model display module 2901 is used to display a rendering interface in which an initial three-dimensional model is displayed.
[0180] The grid display module 2902 is used to overlay and display a plurality of grids that fit the surface on the surface of the initial three-dimensional model, where the grid is the smallest coloring unit on the surface determined based on pixels.
[0181] The mesh coloring module 2903 is configured to generate the colored three-dimensional model in response to the coloring instructions for each of the plurality of meshes.
[0182] In some embodiments, the grid display module 2902 is used to:
[0183] Obtaining a UV map of the three-dimensional model, where points in a coverage area of the UV map have a mapping relationship with points on the surface;
[0184] Performing grid superposition on the UV map to obtain a UV map with a grid;
[0185] The initial three-dimensional model is mapped according to the UV map with the grids, so as to obtain the three-dimensional model with a plurality of grids fitted and superimposed on the surface.
[0186] In some embodiments, the grid display module 2902 is further configured to:
[0187] Obtaining a first pixel size and a desired shading density corresponding to the pixel painting, wherein the first pixel size is a pixel size corresponding to the UV map;
[0188] determining a first grid size according to the desired shading density and the first pixel size;
[0189] Constructing a first grid map corresponding to the UV map according to the first pixel size and the first grid size, wherein the size of the grids in the first grid map is equal to the first grid size;
[0190] The first grid map and the UV map are superimposed to obtain the UV map with a grid, wherein the UV map with a grid only includes a coverage area with a grid.
[0191] In some embodiments, the grid at the first grid size includes m*m pixel grids, the width of the grid lines of the grid at the first grid size is 1 pixel grid, and the sub-grid of the grid at the first grid size includes (m-1)*(m-1) pixel grids, where m is an integer greater than 1.
[0192] In some embodiments, the grid display module 2902 is also used to superimpose the grid on the UV map with the grid onto the three-dimensional model according to the mapping relationship between the points in the coverage area of the UV map and the points on the surface, so as to obtain the three-dimensional model with multiple grids superimposed and displayed on the surface.
[0193] In some embodiments, the grid display module 2902 is used to determine the mapping relationship between the points on the grid of the UV map with a grid and the points on the surface based on the mapping relationship between the points in the coverage area of the UV map and the points on the surface; according to the mapping relationship between the points on the grid of the UV map with a grid and the points on the surface, the points on the grid on the UV map with a grid are projected in sequence, and the grid on the UV map with a grid is superimposed on the three-dimensional model to obtain the three-dimensional model with multiple grids fitted and superimposed and displayed on the surface.
[0194] In some embodiments, the grid display module 2902 is further configured to:
[0195] Obtaining a UV map of the three-dimensional model, where points in a coverage area of the UV map have a mapping relationship with points on the surface;
[0196] Obtaining a first pixel size and a desired shading density corresponding to the pixel painting, wherein the first pixel size is a pixel size corresponding to the UV map;
[0197] determining a first grid size according to the desired shading density and the first pixel size;
[0198] Dividing the closed area in the coverage area of the UV map according to the first grid size to obtain a gridded UV map, wherein the size of the grids in the gridded UV map is less than or equal to the first grid size;
[0199] The initial three-dimensional model is mapped according to the gridded UV map to obtain the three-dimensional model with a plurality of grids overlapped and displayed on the surface.
[0200] In some embodiments, the grid display module 2902 is further configured to:
[0201] Obtaining a second pixel size and an expected coloring density corresponding to the pixel painting, wherein the second pixel size is a pixel size corresponding to the three-dimensional model;
[0202] determining a second grid size based on the desired shading density and the second pixel size;
[0203] constructing a second grid map corresponding to the three-dimensional model according to the second pixel size and the second grid size, wherein the size of the grids in the second grid map is equal to the second grid size;
[0204] Taking a virtual camera used to observe the initial three-dimensional model as a starting point, projecting the second grid image onto the three-dimensional model;
[0205] The surface is fitted, and multiple grids corresponding to the second grid map are superimposed and displayed.
[0206] In some embodiments, the grid coloring module 2903 is used to:
[0207] Obtaining a colored touch point corresponding to a touch operation on the three-dimensional model, where the colored touch point refers to a center point of a contact surface between the touch operation and the touch display screen;
[0208] When the colored touch point falls on the three-dimensional model, obtaining at least one mesh corresponding to the colored touch point;
[0209] The at least one grid is filled with a specified color to generate the three-dimensional model with pixel art on the surface.
[0210] In some embodiments, the grid coloring module 2903 is further configured to:
[0211] When the number n of set grids corresponding to the colored touch point is an odd number, obtaining n*n grids with the first grid where the colored touch point falls on the three-dimensional model as the center;
[0212] Alternatively, when the number n of set grids corresponding to the colored touch point is an even number, the first grid where the point where the colored touch point falls on the three-dimensional model is located is divided into four areas, and the area where the colored touch point falls is obtained; the grid is expanded according to the direction indicated by the area where the colored touch point falls, and n*n grids including the first grid are obtained; wherein n is a positive integer.
[0213] In some embodiments, the grid coloring module 2903 is further configured to:
[0214] When the colored touch point falls on a horizontal grid line on the three-dimensional model, determining a grid below the horizontal grid line and having the horizontal grid line as a grid line as the first grid;
[0215] Alternatively, when the colored touch point falls on a longitudinal grid line on the three-dimensional model, a grid on the right side of the longitudinal grid line and having the longitudinal grid line as a grid line is determined as the first grid.
[0216] In some embodiments, the apparatus 2900 further includes: a model adjustment module (not shown in the figure).
[0217] The model adjustment module is configured to control the three-dimensional model to rotate according to a moving direction of the colored touch point in response to the movement of the colored touch point when the colored touch point does not fall on the three-dimensional model.
[0218] In some embodiments, the model adjustment module is further configured to:
[0219] Acquiring a plurality of adjustment touch points corresponding to the adjustment operation on the three-dimensional model;
[0220] When the plurality of adjustment touch points change from being dispersed to being gathered, the field of view of the virtual camera is enlarged and the three-dimensional model is displayed in a reduced size;
[0221] Alternatively, when the plurality of adjustment touch points change from being gathered together to being dispersed, the field of view of the virtual camera is lowered to enlarge and display the three-dimensional model;
[0222] Or; when the multiple adjustment touch points are moved as a whole from the first position to the second position, the virtual camera used to observe the initial three-dimensional model is horizontally smoothed from the first field of view to the second field of view, and the three-dimensional model under the second field of view is displayed.
[0223] In some embodiments, the coloring interface further displays a part selection control, wherein the part selection control is used to select a part of the initial three-dimensional model, and the multiple grids are superimposed and displayed on the surface of the selected part.
[0224] To sum up, the technical solution provided by the embodiments of the present application supports the superimposition and display of multiple selectable and colorable grids that fit the surface of the three-dimensional model on the surface of the three-dimensional model, so that the user can directly select the grid to be colored on the three-dimensional model to obtain the colored three-dimensional model, which is conducive to the user's direct perception of the three-dimensional model and thereby improves the accuracy of direct coloring on the three-dimensional model.
[0225] It should be noted that the apparatus provided in the above embodiments, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.
[0226] Please refer to Figure 30, which shows a block diagram of a terminal device 3000 provided in one embodiment of the present application. The terminal device is used to implement the method for generating a three-dimensional model provided in the above embodiment. The terminal device can be the terminal device 10 in the implementation environment shown in Figure 1. Specifically:
[0227] Typically, the terminal device 3000 includes: a processor 3001 and a memory 3002 .
[0228] Optionally, the processor 3001 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 3001 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), or PLA (Programmable Logic Array). The processor 3001 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 3001 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and coloring the content to be displayed on the display screen. In some embodiments, the processor 3001 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0229] Optionally, the memory 3002 may include one or more computer-readable storage media, which may be non-transitory. The memory 3002 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices and flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 3002 is used to store a computer program, which is configured to be executed by one or more processors to implement the above-mentioned three-dimensional model generation method.
[0230] In some embodiments, terminal device 3000 may optionally include a peripheral device interface 3003 and at least one peripheral device. The processor 3001, memory 3002, and peripheral device interface 3003 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 3003 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 3004, a display screen 3005, an audio circuit 3006, and a power supply 3007.
[0231] Those skilled in the art will understand that the structure shown in FIG30 does not constitute a limitation on the terminal device 3000 , and may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0232] In some embodiments, a computer-readable storage medium is further provided, wherein a computer program is stored in the storage medium. When the computer program is executed by a processor, the computer program implements the above-mentioned method for generating a three-dimensional model.
[0233] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0234] In some embodiments, a computer program product is further provided, comprising a computer program stored in a computer-readable storage medium. A processor of a terminal device reads the computer program from the computer-readable storage medium and executes the computer program, causing the terminal device to perform the above-described method for generating a three-dimensional model.
[0235] It should be noted that this application can display a prompt interface, pop-up window or output voice prompt information before collecting the user's relevant data and during the process of collecting the user's relevant data. The prompt interface, pop-up window or voice prompt information is used to remind the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining the user's relevant data after obtaining the user's confirmation operation on the prompt interface or pop-up window. Otherwise (that is, when the user's confirmation operation on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the user's relevant data are terminated, that is, the user's relevant data is not obtained. In other words, all user data (including three-dimensional models, UV maps, etc.) collected by this application are processed strictly in accordance with the requirements of relevant national laws and regulations. The informed consent or separate consent of the personal information subject is obtained only when the user agrees and authorizes it to be collected, and the subsequent data use and processing behavior is carried out within the scope of authorization of laws and regulations and the personal information subject, and the collection, use and processing of relevant user data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0236] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.
[0237] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A method for generating a three-dimensional model, the method being executed by a terminal device, the method comprising: Displaying a coloring interface, wherein the coloring interface displays an initial three-dimensional model; On the surface of the initial three-dimensional model, a plurality of grids that fit the surface are superimposed and displayed, wherein the grids are the smallest coloring units on the surface determined based on pixels; In response to the respective coloring instructions for the plurality of meshes, the colored three-dimensional model is generated.
2. The method according to claim 1, wherein: The method of overlaying and displaying a plurality of grids fitting the surface on the surface of the initial three-dimensional model includes: Acquire a UV map of the three-dimensional model, where points in a coverage area of the UV map have a mapping relationship with points on the surface; Performing grid superposition on the UV map to obtain a UV map with a grid; The initial three-dimensional model is mapped according to the UV map with grids to obtain the three-dimensional model with multiple grids fitted and superimposed on the surface.
3. The method according to claim 1 or 2, wherein: The step of grid-superimposing the UV map to obtain a UV map with a grid includes: Obtaining a first pixel size and an expected shading density corresponding to the three-dimensional model, wherein the first pixel size is a pixel size corresponding to the UV map; Determining a first grid size according to the desired shading density and the first pixel size; Constructing a first grid map corresponding to the UV map according to the first pixel size and the first grid size, wherein the size of the grids in the first grid map is equal to the first grid size; The first grid map and the UV map are superimposed to obtain the UV map with a grid, wherein the UV map with a grid only includes a coverage area with a grid.
4. The method according to any one of claims 1 to 3, wherein: The grid under the first grid size includes m*m pixel grids, the width of the grid line of the grid under the first grid size is 1 pixel grid, and the sub-grid of the grid under the first grid size includes (m-1)*(m-1) pixel grids, where m is an integer greater than 1.
5. The method according to any one of claims 1 to 4, wherein: The initial three-dimensional model is mapped according to the UV map with the grid to obtain the three-dimensional model with a plurality of grids superimposed and displayed on the surface, including: According to the mapping relationship between the points in the coverage area of the UV map and the points on the surface, the grids on the UV map with grids are superimposed on the three-dimensional model to obtain the three-dimensional model with multiple grids superimposed and displayed on the surface.
6. The method according to any one of claims 1 to 5, wherein: The method of superimposing the grid on the UV map with the grid onto the three-dimensional model according to the mapping relationship between the points in the coverage area of the UV map and the points on the surface, so as to obtain the three-dimensional model with a plurality of grids superimposed and displayed on the surface, comprises: Determine a mapping relationship between points on a grid of the UV map with a grid and points on the surface according to a mapping relationship between points in a coverage area of the UV map and points on the surface; According to the mapping relationship between the points on the grid of the UV map with grid and the points on the surface, the points on the grid on the UV map with grid are projected in sequence, and the grid on the UV map with grid is superimposed on the three-dimensional model to obtain the three-dimensional model with multiple grids fitted and superimposed on the surface.
7. The method according to any one of claims 1 to 6, wherein: The method of overlaying and displaying a plurality of grids fitting the surface on the surface of the initial three-dimensional model includes: Acquire a UV map of the three-dimensional model, where points in a coverage area of the UV map have a mapping relationship with points on the surface; Obtaining a first pixel size and an expected shading density corresponding to the three-dimensional model, wherein the first pixel size is a pixel size corresponding to the UV map; Determining a first grid size according to the desired shading density and the first pixel size; Dividing the closed area in the coverage area of the UV map according to the first grid size to obtain a gridded UV map, wherein the size of the grids in the gridded UV map is less than or equal to the first grid size; The initial three-dimensional model is mapped according to the gridded UV map to obtain the three-dimensional model with a plurality of grids overlapped and displayed on the surface.
8. The method according to any one of claims 1 to 7, wherein: The method of overlaying and displaying a plurality of grids fitting the surface on the surface of the initial three-dimensional model includes: Acquire a second pixel size and an expected shading density corresponding to the three-dimensional model, wherein the second pixel size is a pixel size corresponding to the three-dimensional model; determining a second grid size according to the desired shading density and the second pixel size; constructing a second grid map corresponding to the three-dimensional model according to the second pixel size and the second grid size, wherein the size of the grids in the second grid map is equal to the second grid size; Taking a virtual camera used to observe the initial three-dimensional model as a starting point, projecting the second grid image onto the initial three-dimensional model; The surface is fitted, and a plurality of grids corresponding to the second grid map are superimposed and displayed.
9. The method according to any one of claims 1 to 8, wherein: The generating of the colored three-dimensional model in response to the coloring instructions for each of the plurality of meshes comprises: Acquire a colored touch point corresponding to a touch operation on the three-dimensional model, wherein the colored touch point is determined based on a contact surface between the touch operation and the touch display screen; When the colored touch point falls on the three-dimensional model, obtaining at least one mesh corresponding to the colored touch point; The at least one grid is filled with a specified color to generate the colored three-dimensional model.
10. The method according to any one of claims 1 to 9, wherein: The obtaining at least one grid corresponding to the colored touch point includes: When the number n of set grids corresponding to the colored touch point is an odd number, taking the first grid where the colored touch point falls on the three-dimensional model as the center, obtaining n*n grids; or, When the number n of set grids corresponding to the colored touch point is an even number, the first grid where the point where the colored touch point falls on the three-dimensional model is located is divided into four areas, and the area where the colored touch point falls is obtained; the grid is expanded according to the direction indicated by the area where the colored touch point falls, to obtain n*n grids including the first grid; Wherein, n is a positive integer.
11. The method according to any one of claims 1 to 10, wherein: The method further comprises: When the colored touch point falls on a horizontal grid line on the three-dimensional model, a grid below the horizontal grid line and having the horizontal grid line as a grid line is determined as the first grid; or, When the colored touch point falls on a longitudinal grid line on the three-dimensional model, a grid on the right side of the longitudinal grid line and having the longitudinal grid line as a grid line is determined as the first grid.
12. The method according to any one of claims 1 to 11, wherein: The method further comprises: When the colored touch point does not fall on the three-dimensional model, in response to the movement of the colored touch point, the three-dimensional model is controlled to rotate according to the movement direction of the colored touch point.
13. The method according to any one of claims 1 to 12, wherein: The method further comprises: Acquire a plurality of adjustment touch points corresponding to the adjustment operation on the three-dimensional model; When the plurality of adjustment touch points change from being dispersed to being gathered, raising the field of view of the virtual camera and reducing the display of the three-dimensional model; or, When the plurality of adjustment touch points change from being gathered together to being dispersed, lowering the field of view of the virtual camera and enlarging and displaying the three-dimensional model; or; When the plurality of adjustment touch points are moved as a whole from the first position to the second position, the virtual camera used to observe the initial three-dimensional model is horizontally smoothed from the first field of view to the second field of view to display the three-dimensional model in the second field of view.
14. The method according to any one of claims 1 to 13, characterized in that: The coloring interface also displays a part selection control, which is used to select a part of the initial three-dimensional model, and the multiple grids are superimposed and displayed on the surface of the selected part.
15. A pixel painting coloring device, the device comprising: A model display module, used to display a coloring interface, in which a three-dimensional model is displayed; A grid display module, used for overlaying and displaying a plurality of grids that fit the surface on the surface of the three-dimensional model, wherein the grid is the smallest coloring unit on the surface determined based on pixels; The mesh coloring module is used to generate the colored three-dimensional model in response to the coloring instructions for each of the plurality of meshes.
16. A terminal device, comprising a processor and a memory, wherein the memory stores a computer program, and the computer program is loaded and executed by the processor to implement the method for generating a three-dimensional model as described in any one of claims 1 to 14.
17. A computer-readable storage medium, wherein a computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the method for generating a three-dimensional model as described in any one of claims 1 to 14.
18. A computer program product, comprising a computer program, wherein the computer program is stored in a computer-readable storage medium, and a processor reads and executes the computer program from the computer-readable storage medium to implement the method for generating a three-dimensional model as described in any one of claims 1 to 14.
Citation Information
Patent Citations
Three-dimensional object color adjusting method and device, computer equipment and computer readable storage medium
CN108876931A
System and method for creating editable configurations of 3D model
CN109118593A
Eyebrow pencil drawing method and device
CN113256694A
Method and device for generating building model on three-dimensional map and storage medium
CN113838204A
Graphics processing system and rendering method
CN115546386A
