Object rendering method
By creating object models, adjusting texture coordinates, and creating object map collections, the cumbersome rendering methods of chess and card games are solved, and the rendering efficiency and resource management are improved.
Patent Information
- Application Number
- CN202510931327.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-08-12
AI Technical Summary
The object rendering method of existing chess and card games requires individual texture coordinates for each chess and card, which makes the operation cumbersome and difficult to manage in a unified manner. Especially when adding new card flowers or adjusting models, it is difficult to efficiently handle rendering.
By creating an object model and determining the object texture coordinates, creating an object map collection, adjusting the texture coordinates using the position information of the object submap in the map collection, sampling the texture image to be rendered, and finally rendering the generated object.
It realizes the use of a set of resources to quickly switch different rendered objects, which improves rendering efficiency and resource management convenience, and simplifies the object rendering process.
Smart Images

Figure CN120472073A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rendering technology, and in particular to an object rendering method. The present invention also relates to a computing device, a computer-readable storage medium, and a computer program product. Background Art
[0002] With the development of computer technology, online games have also made great progress. In some online chess and card games, users can experience the fun of online chess and card games through terminals.
[0003] Current object rendering in chess and card games involves creating separate texture coordinates for each chess piece. For example, in a mahjong game, texture coordinates must be created for each tile (e.g., one bamboo, two bamboos, one strip, two strips, etc.). Adding a new tile suit requires recreating the corresponding UVs. Modifying a model requires modifying all corresponding models, which is cumbersome and difficult to manage. Furthermore, the number of different back-face textures for different chess and card games is numerous, making management difficult. Therefore, a new object rendering method is urgently needed to efficiently handle the rendering of chess and card objects. Summary of the Invention
[0004] In view of this, an embodiment of the present application provides an object rendering method. The present application also relates to a computing device, a computer-readable storage medium, and a computer program product to solve the above-mentioned problems existing in the prior art.
[0005] According to a first aspect of an embodiment of the present application, there is provided an object rendering method, comprising: Creating an object model corresponding to the virtual object, and determining object texture coordinates corresponding to the object model; Creating an object map set corresponding to the object model, wherein the object map set includes a plurality of object sub-maps, and a size of the object map set is the same as a size of the object texture coordinates; Adjust the object texture coordinates according to the position information of each object sub-map in the object map set, and sample the texture image to be rendered corresponding to each object sub-map through the adjusted object texture coordinates; According to the to-be-rendered texture image corresponding to each object sub-map and the object model, rendering is performed to generate a rendering object corresponding to each object sub-map.
[0006] According to a second aspect of an embodiment of the present application, a mahjong sub-rendering method is provided, comprising: Creating a mahjong sub-model corresponding to the mahjong piece, and determining the mahjong texture coordinates corresponding to the mahjong sub-model; Creating a mahjong sub-map set corresponding to the mahjong sub-model, wherein the mahjong sub-map set includes a plurality of mahjong sub-maps, and the size of the mahjong sub-map set is the same as the size of the mahjong sub-texture coordinates; Adjusting the mahjong sub-texture coordinates according to the position information of each mahjong sub-texture in the mahjong sub-texture set, and sampling the mahjong sub-texture image to be rendered corresponding to each mahjong sub-texture through the adjusted mahjong sub-texture coordinates; According to the to-be-rendered mahjong sub-texture images corresponding to the mahjong sub-maps and the mahjong sub-models, rendering is performed to generate the rendered mahjong pieces corresponding to the mahjong sub-maps.
[0007] According to a third aspect of an embodiment of the present application, a computing device is provided, including: memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above method are implemented.
[0008] According to a fourth aspect of an embodiment of the present application, a computer-readable storage medium is provided, which stores a computer program / instruction, and the computer program / instruction implements the steps of the above method when executed by a processor.
[0009] According to a fifth aspect of an embodiment of the present application, a computer program product is provided, comprising a computer program / instruction, which implements the steps of the above method when executed by a processor.
[0010] The object rendering method provided by the present application includes: creating an object model corresponding to a virtual object, and determining object texture coordinates corresponding to the object model; making an object map set corresponding to the object model, wherein the object map set includes multiple object sub-maps, and the size of the object map set is the same as the size of the object texture coordinates; adjusting the object texture coordinates according to the position information of each object sub-map in the object map set, and sampling the texture image to be rendered corresponding to each object sub-map through the adjusted object texture coordinates; rendering and generating a rendering object corresponding to each object sub-map according to the texture image to be rendered corresponding to each object sub-map and the object model.
[0011] In the object rendering method provided in the embodiment of the present application, the size of the object texture coordinates is the same as the size of the object map set. The object texture coordinates are scaled and offset accordingly according to the position information of each object sub-map in the object map set, so that it can sample the texture image to be rendered corresponding to different object sub-maps. Then it is rendered into the object model to obtain the final rendering object. This processing method can use a set of resources. It only needs to use the object texture coordinates to sample different object sub-maps to switch between different rendering objects conveniently and quickly. Thereby improving the rendering efficiency. In terms of resource management convenience, it is only necessary to adjust the object sub-map in the object map set, which improves the convenience of resource management. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 This is a flowchart of an object rendering method provided by an embodiment of the present application; Figure 2 is a flowchart of an object rendering method provided by another embodiment of the present application; Figure 3 This is a processing flow chart of an object rendering method applied to a mahjong sub-rendering scene provided by an embodiment of the present application; Figure 4 This is a schematic diagram of the model, UV and texture set of mahjong pieces provided in one embodiment of the present application; Figure 5 This is a diagram of the mahjong piece rendering process provided by an embodiment of the present application; Figure 6 This is a schematic structural diagram of an object rendering device provided by an embodiment of the present application; Figure 7 This is a structural block diagram of a computing device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0013] The following description sets forth many specific details to facilitate a thorough understanding of the present application. However, the present application can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the scope of the present application. Therefore, the present application is not limited to the specific implementations disclosed below.
[0014] The terms used in one or more embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present application. The singular forms "a", "the" and "the" used in one or more embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0016] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0017] First, the terms involved in one or more embodiments of the present application are explained.
[0018] Texture coordinates, often referred to as UV coordinates, are a technique used to map 2D textures onto 3D model surfaces. They are also referred to as a two-dimensional texture mapping coordinate system. Texture coordinates are used to locate pixels on the U (horizontal) and V (vertical) axes and map them to the surface of a 3D model. These coordinates are typically normalized to the range [0, 1]. This coordinate system aligns each vertex of a 3D model with a specific point on the texture image. Through interpolation, the texture is continuously distributed across the surface of the model. This system is widely used in game development, animation, and 3D rendering.
[0019] When rendering objects in online chess and card games, texture coordinates are typically set individually for each card object. If the model needs to be adjusted (e.g., adding new card flowers or adjusting the card back texture), the object model with the corresponding texture coordinates must be recreated. Furthermore, if adjustments are made to a specific object model, all object models must be modified, which is very cumbersome and hinders unified management.
[0020] Based on this, in the present application, an object rendering method is provided. The present application also relates to a computing device, a computer-readable storage medium and a computer program product, which are described in detail one by one in the following embodiments.
[0021] Figure 1 A flowchart of an object rendering method provided according to an embodiment of the present application is shown, which specifically includes the following steps: Step 102: Create an object model corresponding to the virtual object, and determine object texture coordinates corresponding to the object model.
[0022] A virtual object can be understood as a virtual image of an object to be rendered. For example, if mahjong tiles are to be rendered, the tiles are virtual objects. For another example, if playing cards are to be rendered, the playing cards are virtual objects.
[0023] The object model can be understood as the basic model corresponding to the virtual object. In computer graphics, 3D modeling, and game development, the model is the core data that describes the shape and structure of a three-dimensional object. The model is a mesh data composed of vertices, edges, and faces that describes the geometric structure of a three-dimensional object using mathematical methods.
[0024] In the specific implementations provided herein, an object model corresponding to a virtual object can be pre-created in 3D modeling software. The 3D modeling software can be Blender, 3Dmax, etc. The method provided herein does not limit the specific 3D modeling software, and the actual application shall prevail.
[0025] After creating the object model corresponding to the virtual object, determine the object texture coordinates corresponding to the object model. Object texture coordinates, also known as UV coordinates, are the core bridge for mapping 2D textures to 3D model surfaces. In UV coordinates, each vertex of the model carries the (u, v) coordinate, where u represents the horizontal coordinate and v represents the vertical coordinate. Their core function is to define the position of the model vertex on the texture.
[0026] In practical applications, each vertex of an object model independently stores corresponding UV coordinates, and the object texture coordinates corresponding to the object model can be obtained by parsing the vertex information of the object model.
[0027] Specifically, in a specific embodiment provided in this application, determining the object texture coordinates corresponding to the object model includes: The object model is parsed based on a texture editor to obtain object texture coordinates corresponding to the object model.
[0028] In practical applications, the object model can be parsed using a texture editor in 3D modeling software to obtain the object texture coordinates corresponding to the object model. For example, in Blender, you can select the UV editor in Edit mode and select each vertex of the object model to determine the object texture coordinates stored at each vertex.
[0029] In addition, a model file parsing method may be used to parse the model file of the object model using a pre-written software program to obtain the object texture coordinates corresponding to the object model.
[0030] In addition, the method provided in this application does not limit the specific implementation method of how to determine the object texture coordinates corresponding to the object model by obtaining it in the game engine, using shader debugging output, command line tool processing, etc.
[0031] Step 104: creating an object map set corresponding to the object model, wherein the object map set includes a plurality of object sub-maps, and the size of the object map set is the same as the size of the object texture coordinates.
[0032] In the method provided in this application, during the rendering process of a virtual object, a corresponding object texture set is also created for it. A texture is a 2D image wrapped around the surface of a 3D model, used to define the visual and physical properties of the model surface. An object texture set can be understood as a collection of multiple object sub-textures created for the object model.
[0033] It should be noted that in the method provided in the embodiments of this application, the object map set is presented as a single map, and the size of the object map set is the same as the size of the object texture coordinates. For example, if the object map set size is 1*1, the object texture coordinate size is also 1*1. If the number of object sub-maps in the object map set is 2*2, the UV range is adjusted to 0.5; if the number of object sub-maps in the object map set is 4*4, the model UV is reduced to 0.25.
[0034] In the specific implementations provided herein, multiple object sub-textures can be created for an object model based on actual business needs. To facilitate subsequent processing, these sub-textures are organized into an array of object texture sets. During subsequent processing, the position of an object sub-texture within the object texture set can be used for quick and accurate location, facilitating unified management of texture resources.
[0035] In a specific implementation provided in the present application, taking the object map set as a map set of mahjong pieces as an example, the object map set includes object sub-maps such as "one tube, two tubes, three tubes... one, two, three... ten thousand, twenty thousand, thirty thousand".
[0036] Step 106: adjusting the object texture coordinates according to the position information of each object sub-map in the object texture set, and sampling the texture image to be rendered corresponding to each object sub-map through the adjusted object texture coordinates.
[0037] After determining each object's sub-texture and object texture coordinates, the texture image to be rendered can be generated based on the sub-texture and object texture coordinates. The texture image to be rendered can be understood as the texture obtained by sampling the object sub-texture using the object texture coordinates and then rendering it onto the object model.
[0038] Specifically, for ease of understanding, in a specific embodiment provided in the present application, any one of the object sub-maps is used as an example for explanation. Adjusting the object texture coordinates according to the position information of each object sub-map in the object map set, and sampling the texture image to be rendered corresponding to each object sub-map using the adjusted object texture coordinates include: Determine a target object sub-map among each object sub-map; Determining target position information of the target object sub-map in the object map set; The object texture coordinates are adjusted according to the target position information.
[0039] In this embodiment, a target object sub-map is first determined among the object sub-maps. The target sub-map may be any one of the object sub-maps in the object map set.
[0040] After determining the target object sub-texture, the target position information of the target object sub-texture within the object texture set can be determined. This target position information can be understood as the location information for the target object sub-texture within the object texture set. Based on this target position information, adjustment information for the object texture coordinates can be determined, thereby adjusting the object texture coordinates so that the adjusted object texture coordinates can sample the target object sub-texture.
[0041] In another specific embodiment provided by the present application, determining target position information of the target object sub-map in the object map set includes: The target position coordinates and target size information of the target object sub-texture in the object texture set are obtained.
[0042] Accordingly, adjusting the object texture coordinates according to the target position information includes: Determining offset information of the object texture coordinates according to the target position coordinates; determining scaling information of the object texture coordinates according to the target size information; The object texture coordinates are adjusted according to the offset information and the scaling information.
[0043] In this embodiment, the target position information specifically includes the target position coordinates and target size information of the target object sub-texture in the object texture set. The target position coordinates are used to determine the location of the target object sub-texture in the object texture set, and the target size information is used to determine the size of the target object sub-texture.
[0044] After determining the target position coordinates and target size information, the offset information of the object texture coordinates is determined according to the target position coordinates, and the scaling information of the object texture coordinates is determined according to the target size information, thereby adjusting the object texture coordinates according to the offset information and the scaling information.
[0045] In the method provided in the embodiments of the present application, object rendering is achieved through a shader. Specifically, in the shader, the target position coordinates and target size information of the target object sub-map in the object map set are used. The target position coordinates and target size information are used to offset and scale the object texture coordinates accordingly, so that the object texture coordinates can be sampled into the target object sub-map, thereby obtaining a texture image to be rendered corresponding to the target object sub-map.
[0046] For example, let's assume an object map set with a size of 1*1 and 2*2 object sub-maps. The original size of the object texture coordinates is 1. When sampling the target object sub-map in the upper left corner, the target position coordinates of the target object sub-map are (0, 0) and the target size information is (0.5, 0.5). The object texture coordinates are scaled based on the target size information (0.5, 0.5), reducing the range of the object texture coordinates to 0.5. The object texture coordinates are then offset based on the target position coordinates (0, 0) of the target object sub-map so that the scaled object texture coordinates align with the target object sub-map. This allows the scaled object texture coordinates to sample the target object sub-map, resulting in the texture image to be rendered corresponding to the target object sub-map.
[0047] Step 108: Render and generate rendering objects corresponding to each object sub-map according to the to-be-rendered texture image corresponding to each object sub-map and the object model.
[0048] After obtaining the texture image to be rendered corresponding to the object sub-map, it is rendered onto the object model to obtain the rendering object corresponding to the object sub-map.
[0049] In the method provided in the embodiment of the present application, the size of the object texture coordinates is the same as the size of the object map set. The object texture coordinates are scaled and offset accordingly according to the position information of each object sub-map in the object map set, so that it can sample the texture image to be rendered corresponding to different object sub-maps. Then it is rendered into the object model to obtain the final rendering object. This processing method can use a set of resources. It only needs to use the object texture coordinates to sample different object sub-maps to switch between different rendering objects conveniently and quickly. Thereby improving the rendering efficiency. In terms of resource management convenience, it is only necessary to adjust the object sub-map in the object map set, which improves the convenience of resource management.
[0050] In actual applications, online chess and card games usually include two parts, the front and the back of the chess and card. Users can adjust the style of the chess and card by changing the color of the back. Based on this, Figure 2 FIG. 1 shows a flow chart of an object rendering method provided by another embodiment of the present application. Figure 2 As shown, the method includes: Step 202: Create an object model corresponding to the virtual object, where the object model includes a first model part and a second model part.
[0051] In practical applications, the object model is typically a three-dimensional model. Therefore, in the specific embodiments provided herein, the three-dimensional model is divided into a first model portion and a second model portion. Taking the object model as a chess and card game as an example, the first model portion can be understood as the front of the chess and card game (i.e., the different card faces in a chess and card game, such as the first and second bamboo cards in mahjong, or the two of hearts and three of spades in playing cards), and the second model portion can be understood as the back of the chess and card game (i.e., the backs of the cards in a chess and card game, which typically have the same back pattern).
[0052] In the method provided in this application, different types of card faces and card backs can be provided for users to choose from. Users can render and generate chess and card games of different styles by selecting different styles of card faces and card backs, thereby improving the user experience.
[0053] Step 204: Determine first object texture coordinates corresponding to the first model part, and second object texture coordinates corresponding to the second model part.
[0054] In this embodiment, first object texture coordinates corresponding to the first model portion and second object texture coordinates corresponding to the second model portion are determined respectively.
[0055] In practical applications, the specific implementation of determining the texture coordinates of the first object and the texture coordinates of the second object can be found in the relevant description of step 104 above, which will not be repeated here.
[0056] Step 206: Create a first object map set for the first model part, wherein the first object map set includes a plurality of first object sub-maps, and the size of the first object texture coordinates is the same as the size of the first object map set.
[0057] Step 208: Create a second object map set for the second model part, wherein the second object map set includes a plurality of second object sub-maps, and the size of the second object texture coordinates is the same as the size of the second object map set.
[0058] In this embodiment, since the object model is divided into a first model portion and a second model portion, different texture sets can be created for the first model portion and the second model portion during the creation of the texture sets. Specifically, a first object texture set is created for the first model portion, and a second object texture set is created for the second model portion. The first object texture set and the second object texture set each include multiple object sub-textures. The size of the first object texture coordinates is the same as the size of the first object texture set, and the size of the second object texture coordinates is the same as the size of the second object texture set.
[0059] Step 210: Determine a target first object sub-texture from the plurality of first object sub-textures, and determine a target second object sub-texture from the plurality of second object sub-textures.
[0060] In this embodiment, during the creation of a rendering object, corresponding rendering objects are created for the first model portion and the second model portion, respectively. Specifically, a target first object sub-map is first determined from the first object sub-map, and a target second object sub-map is determined from the plurality of second object sub-maps.
[0061] Step 212: Adjust the first object texture coordinates according to the first position information of the target first object sub-map in the first object map set, sample the target first object sub-map using the adjusted first object texture coordinates, and obtain a first texture image to be rendered.
[0062] Step 214: Adjust the second object texture coordinates according to the second position information of the target second object sub-map in the second object map set, and sample the target second object sub-map using the adjusted second object texture coordinates to obtain a second texture image to be rendered.
[0063] First adjustment information for first object texture coordinates is determined based on first position information of the first object sub-texture in the first object texture set, and the first object texture coordinates are offset and scaled based on the first adjustment information. Second adjustment information for second object texture coordinates is determined based on second position information of the second object sub-texture in the second object texture set, and the second object texture coordinates are offset and scaled based on the second adjustment information.
[0064] The first object sub-map is sampled according to the adjusted first object texture coordinates to obtain a first texture image to be rendered; and the second object sub-map is sampled according to the adjusted second object texture coordinates to obtain a second texture image to be rendered.
[0065] Step 216: Obtain a first rendering object according to the first texture image to be rendered and the first model part; obtain a second rendering object according to the second texture image to be rendered and the second model part; and obtain a rendering object according to the first rendering object and the second rendering object.
[0066] After obtaining the first texture image to be rendered, it is rendered with the first model portion to obtain a first rendering object. Similarly, a second rendering object is obtained based on the second texture image to be rendered and the second model portion.
[0067] After obtaining the first rendering object and the second rendering object, the two may be merged to generate a corresponding rendering object.
[0068] In the method provided in the embodiment of the present application, the corresponding rendering object can be rendered based on the user's selection of different types of first object sub-maps and second object sub-maps, enriching the types of rendering objects generated by the user and providing the user with more assembly and combination methods. This processing method can use a set of resources, and only needs to use the object texture coordinates to sample different object sub-maps to conveniently and quickly switch between different rendering objects. This improves rendering efficiency. In terms of resource management convenience, it is only necessary to adjust the object sub-map in the object map set, which improves the convenience of resource management.
[0069] The following combined Figure 3 , taking the application of the object rendering method provided by this application in mahjong as an example, the object rendering method is further explained. Figure 3 A processing flow chart of an object rendering method applied to a Mahjong sub-rendering scene provided by an embodiment of the present application is shown, which specifically includes the following steps: Step 302: Create a mahjong sub-model corresponding to the mahjong piece, and determine the mahjong texture coordinates corresponding to the mahjong sub-model.
[0070] Step 304: creating a mahjong sub-texture set corresponding to the mahjong sub-model, wherein the mahjong sub-texture set includes a plurality of mahjong sub-textures, and the size of the mahjong sub-texture set is the same as the size of the mahjong sub-texture coordinates.
[0071] Step 306: adjusting the mahjong sub-texture coordinates according to the position information of each mahjong sub-texture in the mahjong sub-texture set, and sampling the mahjong sub-texture image to be rendered corresponding to each mahjong sub-texture using the adjusted mahjong sub-texture coordinates.
[0072] Step 308: Render and generate rendered mahjong pieces corresponding to each mahjong sub-map according to the to-be-rendered mahjong sub-texture image corresponding to each mahjong sub-map and the mahjong sub-model.
[0073] Optionally, adjusting the mahjong sub-texture coordinates according to position information of each mahjong sub-texture in the mahjong sub-texture set includes: Determine a target mahjong sub-map among the mahjong sub-maps; Determine target position information of the target mahjong sub-tile in the mahjong sub-tile set; The mahjong sub-texture coordinates are adjusted according to the target position information.
[0074] Optionally, determining target position information of the target mahjong sub-tile in the mahjong sub-tile set includes: The target position coordinates and target size information of the target mahjong sub-map in the mahjong sub-map set are obtained.
[0075] Optionally, adjusting the mahjong texture coordinates according to the target position information includes: Determine the offset information of the mahjong sub-texture coordinates according to the target position coordinates; Determining scaling information of the mahjong sub-texture coordinates according to the target size information; The mahjong sub-texture coordinates are adjusted according to the offset information and the scaling information.
[0076] Optionally, determining the mahjong sub-texture coordinates corresponding to the mahjong sub-model includes: The mahjong sub-model is parsed based on a texture editor to obtain mahjong sub-texture coordinates corresponding to the mahjong sub-model.
[0077] Optionally, the mahjong sub-model includes a tile flower part and a tile back part; Determining the mahjong sub-texture coordinates corresponding to the mahjong sub-model includes: Determine the card flower texture coordinates corresponding to the card flower part and the card back texture coordinates corresponding to the card back part.
[0078] Optionally, making a set of mahjong sub-maps corresponding to the mahjong sub-model includes: Creating a card flower sticker set for the card flower part, wherein the card flower sticker set includes a plurality of card flower stickers; A card back sticker set is produced for the card back part, wherein the card back sticker set includes a plurality of card back stickers.
[0079] Optionally, adjusting the object texture coordinates according to position information of each object sub-map in the object texture set, and sampling the to-be-rendered texture image corresponding to each object sub-map using the adjusted object texture coordinates includes: Determine a target card flower texture from a plurality of card flower texture sets, and determine a target card back texture from a plurality of card back texture sets; Adjusting the card flower texture coordinates according to the card flower position information of the target card flower texture in the card flower texture set, sampling the target card flower texture using the adjusted card flower texture coordinates to obtain a card flower texture image to be rendered; The card back texture coordinates are adjusted according to the card back position information of the target card back map in the card back map set, and the target card back map is sampled through the adjusted card back texture coordinates to obtain the card back texture image to be rendered.
[0080] Optionally, rendering and generating rendered mahjong pieces corresponding to each mahjong sub-map according to the to-be-rendered mahjong sub-texture image corresponding to each mahjong sub-map and the mahjong sub-model includes: Obtaining a card flower rendering object according to the card flower texture image to be rendered and the card flower part; Obtaining a card back rendering object according to the card back texture image to be rendered and the card back part; The rendered mahjong pieces are obtained according to the tile flower rendering object and the tile back rendering object.
[0081] In the method provided in the embodiment of the present application, a mahjong sub-model and a mahjong sub-map set are prepared in advance. By adjusting the mahjong sub-texture coordinates of the mahjong sub-model, different offsets and scaling are performed in the mahjong sub-map set, thereby sampling different mahjong sub-maps, and then rendering the mahjong sub-maps into the mahjong sub-model to obtain rendered mahjong pieces. This processing method can use a set of resources. It only needs to use the mahjong sub-texture coordinates to sample different mahjong sub-maps to switch between different rendered mahjong pieces conveniently and quickly. Thereby improving the rendering efficiency. In terms of resource management convenience, it is only necessary to adjust the mahjong sub-map in the mahjong sub-map set, which improves the convenience of resource management.
[0082] See also Figures 4 and 5 , Figure 4 A schematic diagram of the model, UV and texture set of mahjong pieces provided in one embodiment of the present application is shown in FIG. Figure 4 As shown in a, a mahjong sub-model is created for the mahjong pieces. The mahjong sub-model includes a tile flower model and a tile back model. Use the texture coordinate tool to obtain the tile flower UV corresponding to the tile flower model and the tile back UV corresponding to the tile back model, as shown in Figure 4At the same time, create a card flower texture set for the card flower and a card back texture set for the card back, as shown in b. Figure 4 As shown in c.
[0083] Figure 5 FIG1 shows a diagram of the mahjong rendering process of mahjong pieces provided by an embodiment of the present application. Figure 5 As shown, the card flower "Yi Tong" is selected as the target card flower texture, and "Five-pointed Star" is selected as the target card back texture. The first position information and first size information of Yi Tong in the card flower texture set are determined, and the card flower UV is scaled and offset according to the first position information and first size information, so as to obtain a card flower rendering texture by sampling from the card flower texture set.
[0084] Determine the second position information and second size information of the five-pointed star in the card back texture set, scale and offset the card back UV according to the second position information and second size information, and thus sample from the card back texture set to obtain the card back rendering texture.
[0085] Then, the flower rendering texture is rendered onto the flower model to obtain a flower rendering object. The back rendering texture is rendered onto the back model to obtain a back rendering object. Finally, the flower rendering object and the back rendering object are merged to obtain the rendered mahjong pieces corresponding to the one-tube and five-pointed star.
[0086] Corresponding to the above method embodiment, the present application also provides an object rendering device embodiment, Figure 6 FIG. 1 shows a schematic diagram of the structure of an object rendering device provided by an embodiment of the present application. Figure 6 As shown, the device includes: A creation module 602 is configured to create an object model corresponding to the virtual object and determine object texture coordinates corresponding to the object model; A production module 604 is configured to produce an object map set corresponding to the object model, wherein the object map set includes a plurality of object sub-maps, and a size of the object map set is the same as a size of the object texture coordinates; An adjustment module 606 is configured to adjust the object texture coordinates according to position information of each object sub-map in the object texture set, and sample the texture image to be rendered corresponding to each object sub-map using the adjusted object texture coordinates; The rendering module 608 is configured to render and generate a rendering object corresponding to each object sub-map according to the to-be-rendered texture image corresponding to each object sub-map and the object model.
[0087] Optionally, the adjustment module 606 is further configured to: Determine a target object sub-map among each object sub-map; Determining target position information of the target object sub-map in the object map set; The object texture coordinates are adjusted according to the target position information.
[0088] Optionally, the adjustment module 606 is further configured to: The target position coordinates and target size information of the target object sub-texture in the object texture set are obtained.
[0089] Optionally, the adjustment module 606 is further configured to: Determining offset information of the object texture coordinates according to the target position coordinates; determining scaling information of the object texture coordinates according to the target size information; The object texture coordinates are adjusted according to the offset information and the scaling information.
[0090] Optionally, the creation module 602 is further configured to: The object model is parsed based on a texture editor to obtain object texture coordinates corresponding to the object model.
[0091] Optionally, the object model includes a first model part and a second model part; The creation module 602 is further configured to: A first object texture coordinate corresponding to the first model portion and a second object texture coordinate corresponding to the second model portion are determined.
[0092] Optionally, the production module 604 is further configured to: Creating a first object map set for the first model portion, wherein the first object map set includes a plurality of first object sub-maps; A second object map set is generated for the second model portion, wherein the second object map set includes a plurality of second object sub-maps.
[0093] Optionally, the adjustment module 606 is configured to: Determine a target first object sub-map among the plurality of first object sub-maps, and determine a target second object sub-map among the plurality of second object sub-maps; Adjusting the first object texture coordinates according to first position information of the target first object sub-map in the first object map set, and sampling the target first object sub-map using the adjusted first object texture coordinates to obtain a first texture image to be rendered; The second object texture coordinates are adjusted according to second position information of the target second object sub-map in the second object map set, and the target second object sub-map is sampled using the adjusted second object texture coordinates to obtain a second texture image to be rendered.
[0094] Optionally, the rendering module 608 is further configured to: Obtaining a first rendering object according to the first texture image to be rendered and the first model part; Obtaining a second rendering object according to the second texture image to be rendered and the second model part; A rendering object is obtained according to the first rendering object and the second rendering object.
[0095] In the device provided in the embodiment of the present application, the size of the object texture coordinates is the same as the size of the object map set. The object texture coordinates are scaled and offset accordingly according to the position information of each object sub-map in the object map set, so that it can sample the texture image to be rendered corresponding to different object sub-maps. Then it is rendered into the object model to obtain the final rendering object. This processing method can use a set of resources. It only needs to use the object texture coordinates to sample different object sub-maps to switch between different rendering objects conveniently and quickly. Thereby improving the rendering efficiency. In terms of resource management convenience, it is only necessary to adjust the object sub-map in the object map set, which improves the convenience of resource management.
[0096] The above is a schematic diagram of an object rendering device according to this embodiment. It should be noted that the technical solution of the object rendering device and the technical solution of the object rendering method described above are based on the same concept. For details not described in detail in the technical solution of the object rendering device, please refer to the description of the technical solution of the object rendering method described above.
[0097] Figure 7 7 shows a block diagram of a computing device 700 according to an embodiment of the present application. Components of the computing device 700 include, but are not limited to, a memory 710 and a processor 720. The processor 720 is connected to the memory 710 via a bus 730, and a database 750 is used to store data.
[0098] Computing device 700 also includes an access device 740 that enables computing device 700 to communicate via one or more networks 760. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. Access device 740 may include one or more of any type of network interface (e.g., a network interface controller (NIC)) whether wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, a near field communication (NFC) interface, and the like.
[0099] In one embodiment of the present application, the above components of the computing device 700 and Figure 7 Other components not shown in the figure may also be connected to each other, for example, via a bus. Figure 7 The computing device structure block diagram shown is for illustrative purposes only and is not intended to limit the scope of the present application. Those skilled in the art may add or replace other components as needed.
[0100] Computing device 700 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, personal digital assistant, laptop computer, notebook computer, netbook computer, etc.), a mobile phone (e.g., a smartphone), a wearable computing device (e.g., a smartwatch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or personal computer (PC). Computing device 700 can also be a mobile or stationary server.
[0101] The processor 720 is configured to execute the following computer program / instruction, which implements the steps of the above-mentioned object rendering method when executed by the processor.
[0102] The above is a schematic solution of a computing device of this embodiment. It should be noted that the technical solution of the computing device and the technical solution of the object rendering method described above are based on the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the object rendering method described above.
[0103] An embodiment of the present specification further provides a computer-readable storage medium storing a computer program / instruction. When the computer program / instruction is executed by a processor, the steps of the above-mentioned object rendering method are implemented.
[0104] The above is a schematic diagram of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of the storage medium and the technical solution of the object rendering method described above are based on the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the object rendering method described above.
[0105] An embodiment of the present specification further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned object rendering method when executed by a processor.
[0106] The above is a schematic diagram of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the object rendering method described above are based on the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the object rendering method described above.
[0107] The foregoing description describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different from that described in the embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0108] The computer instructions include computer program code, which may be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium may include any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium. It should be noted that the content of the computer-readable medium may be appropriately increased or decreased based on the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media does not include electric carrier signals and telecommunication signals.
[0109] It should be noted that for the aforementioned method embodiments, for ease of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.
[0110] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0111] The preferred embodiments of the present application disclosed above are intended only to help illustrate the present application. The optional embodiments do not describe all details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and variations can be made based on the content of this application. This application selects and describes these embodiments in detail in order to better explain the principles and practical applications of this application, so that those skilled in the art can better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. An object rendering method, characterized in that: include: Creating an object model corresponding to the virtual object, and determining object texture coordinates corresponding to the object model; Creating an object map set corresponding to the object model, wherein the object map set includes a plurality of object sub-maps, and a size of the object map set is the same as a size of the object texture coordinates; Adjust the object texture coordinates according to the position information of each object sub-map in the object map set, and sample the texture image to be rendered corresponding to each object sub-map through the adjusted object texture coordinates; According to the to-be-rendered texture image corresponding to each object sub-map and the object model, rendering is performed to generate a rendering object corresponding to each object sub-map.
2. The method according to claim 1, wherein Adjusting the object texture coordinates according to position information of each object sub-texture in the object texture set includes: Determine a target object sub-map among each object sub-map; Determining target position information of the target object sub-map in the object map set; The object texture coordinates are adjusted according to the target position information.
3. The method according to claim 2, wherein Determining target position information of the target object sub-map in the object map set includes: The target position coordinates and target size information of the target object sub-texture in the object texture set are obtained.
4. The method according to claim 3, wherein Adjusting the object texture coordinates according to the target position information includes: Determining offset information of the object texture coordinates according to the target position coordinates; Determining scaling information of the object texture coordinates according to the target size information; The object texture coordinates are adjusted according to the offset information and the scaling information.
5. The method according to claim 1, wherein The object model includes a first model part and a second model part; Determining object texture coordinates corresponding to the object model includes: A first object texture coordinate corresponding to the first model portion and a second object texture coordinate corresponding to the second model portion are determined.
6. The method according to claim 5, wherein Creating an object map set corresponding to the object model, including: Creating a first object map set for the first model portion, wherein the first object map set includes a plurality of first object sub-maps; A second object map set is generated for the second model portion, wherein the second object map set includes a plurality of second object sub-maps.
7. The method according to claim 6, wherein Adjusting the object texture coordinates according to position information of each object sub-map in the object map set, and sampling the to-be-rendered texture image corresponding to each object sub-map using the adjusted object texture coordinates, including: Determine a target first object sub-map among the plurality of first object sub-maps, and determine a target second object sub-map among the plurality of second object sub-maps; Adjusting the first object texture coordinates according to first position information of the target first object sub-map in the first object map set, and sampling the target first object sub-map using the adjusted first object texture coordinates to obtain a first texture image to be rendered; The second object texture coordinates are adjusted according to second position information of the target second object sub-map in the second object map set, and the target second object sub-map is sampled using the adjusted second object texture coordinates to obtain a second texture image to be rendered.
8. The method according to claim 7, wherein Rendering and generating rendering objects corresponding to each object sub-map according to the to-be-rendered texture image corresponding to each object sub-map and the object model, including: Obtaining a first rendering object according to the first texture image to be rendered and the first model part; Obtaining a second rendering object according to the second texture image to be rendered and the second model part; A rendering object is obtained according to the first rendering object and the second rendering object.
9. A computing device, characterized in that include: memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the method according to any one of claims 1 to 8 are implemented.
10. A computer-readable storage medium storing a computer program / instruction, characterized in that: When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.