Scene processing method, computing device, storage medium and computer program product
By determining the correspondence between the target point and the material map in virtual scene rendering, the problem of vertex color channel limitation is solved, the authenticity and richness of the virtual scene are achieved, and the rendering effect is improved.
Patent Information
- Application Number
- CN202411316461.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
AI Technical Summary
In the prior art, the RGBA channel of vertex color limits that at most four maps can be mixed during the rendering of virtual scenes, resulting in poor authenticity of virtual scenes.
By determining the target points and their attribute information in the initial scene model, and determining the target material map based on the corresponding relationship between the attribute information and the material map, avoiding the limitation of the vertex color channel, increasing the number of material maps, and realizing the initial scene model rendering.
It realizes the authenticity and richness of virtual scene rendering, can mix more material maps, and improves the rendering effect.
Smart Images

Figure CN119169238A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of computer technology, and in particular, to scene processing methods, computing devices, storage media, and computer program products. Background Art
[0002] At present, in order to ensure the authenticity of virtual scenes, multiple materials are usually mixed during the virtual scene rendering process to achieve the rendering of the virtual scene. Usually, material mixing can be performed based on the RGB value of the vertex color of the virtual scene. Since the vertex color contains only four channels RGBA at most, only four maps can be mixed during the virtual scene rendering process, which affects the authenticity of the virtual scene finally rendered. Therefore, an effective technical solution is urgently needed to solve the above problem. Summary of the invention
[0003] In view of this, an embodiment of the present specification provides a scene processing method. One or more embodiments of the present specification also relate to a scene processing device, a computing device, a computer-readable storage medium, and a computer program product to solve the technical defect of poor authenticity of virtual scene rendering in the prior art.
[0004] According to a first aspect of an embodiment of this specification, a scene processing method is provided, including: Determine a target point between the first area and the second area in the initial scene model; Determine target attribute information of the target point, and determine a first texture map and a second texture map corresponding to the target attribute information according to a correspondence between the attribute information and the texture map; The first region and the second region are processed according to the first material map and the second material map to obtain a target scene model.
[0005] According to a second aspect of an embodiment of this specification, a scene processing device is provided, including: A first determination module is configured to determine a target point between the first area and the second area in the initial scene model; A second determination module is configured to determine target attribute information of the target point, and determine a first material map and a second material map corresponding to the target attribute information according to a correspondence between the attribute information and the material map; The processing module is configured to process the first area and the second area according to the first material map and the second material map to obtain a target scene model.
[0006] According to a third aspect of an embodiment of this specification, 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-mentioned scene processing method are implemented.
[0007] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned scene processing method are implemented.
[0008] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program / instruction, which implements the steps of the above-mentioned scene processing method when executed by a processor.
[0009] An embodiment of the present specification provides a scene processing method, including: determining a target point between a first area and a second area in an initial scene model; determining target attribute information of the target point, and determining a first material map and a second material map corresponding to the target attribute information based on a correspondence between the attribute information and the material map; and processing the first area and the second area based on the first material map and the second material map to obtain a target scene model.
[0010] In the above method, by determining the target point between the first area and the second area in the initial scene model that needs to be rendered, the target attribute information of the target point is determined, and the first material map and the second material map corresponding to the target attribute information are determined according to the correspondence between the attribute information and the material map. By setting the correspondence between the attribute information and the material map, the limitation on the number of material maps caused by the RGBA channel of the vertex color is avoided, so that the number of mixed material maps is greater. The first area and the second area are processed according to the first material map and the second material map to complete the rendering of the initial scene model, obtain the target scene model, and ensure the authenticity and richness of the rendering of the target scene model. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 This is a schematic diagram of an application scenario of a scenario processing method provided by an embodiment of this specification; Figure 2 is a flow chart of a scene processing method provided by an embodiment of this specification; Figure 3 is a schematic diagram of an initial scene model in a scene processing method provided by an embodiment of this specification; Figure 4 It is a schematic diagram of the correspondence between vertex color values and index numbers in a scene processing method provided by an embodiment of this specification; Figure 5 is a schematic diagram of a texture set in a scene processing method provided by an embodiment of this specification; Figure 6 is a processing flow chart of a scene processing method provided by an embodiment of this specification; Figure 7 It is a schematic diagram of an offline resource preparation stage in a scene processing method provided by an embodiment of this specification; Figure 8 It is a schematic diagram of a real-time rendering stage in a scene processing method provided by an embodiment of this specification; Fig. 9 is a structural schematic diagram of a scene processing device provided by an embodiment of this specification; Fig.10 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0012] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0013] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0014] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, 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".
[0015] In addition, 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 one or more embodiments of this specification 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 countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0016] First, the terms involved in one or more embodiments of this specification are explained.
[0017] Vertex color: is a technique in 3D graphics and game development that is used to store color information on the vertices of a 3D model. This color information can then be used to color the surface of the model during rendering. Vertex colors are often used to quickly add color to a model, or used in conjunction with textures and other shading techniques to enhance visual effects.
[0018] RGBA: is a color model used to represent color and transparency. "RGBA" stands for Red, Green, Blue, and Alpha. This is a color model widely used in graphics and computer vision.
[0019] DCC Baking Model: The model baking process performed in Digital Content Creation software. Baking is a technique used to transfer complex information on a high-detail model to a low-detail model for use in real-time rendering.
[0020] UV: refers to the two-dimensional coordinate system on the surface of the model, corresponding to the X, Y, and Z coordinates in three-dimensional space. The U and V here represent the two dimensional directions of the model surface, similar to the longitude and latitude on a map.
[0021] In practical applications, material mixing can usually be done by using the RGB channel of the vertex color as a template. For example, when the RGB value of the vertex color is (1,0,0), it means that the color of the first set of textures is mixed 100%. When the RGB value of the vertex color is (0.5,0.5,0), it can be mixed according to the first set of textures with 50% transparency and the second set of textures with 50% transparency. Based on this, since the vertex color only contains four channels, RGBA at most, a vertex color is limited to mixing four sets of textures, which is difficult to meet the higher realism requirements of material mixing. Therefore, an effective technical solution is urgently needed to solve the above problems.
[0022] In this specification, a scene processing method is provided. This specification also relates to a scene processing device, 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.
[0023] See also Figure 1 , Figure 1 A schematic diagram of an application scenario of a scenario processing method provided according to an embodiment of the present specification is shown.
[0024] Figure 1 The device 102 is included in the terminal side.
[0025] During specific implementation, the display interface of the terminal device 102 can display the initial scene model to the user, and in response to the user's click instruction for the initial scene model, determine the target point between the first area and the second area in the initial scene model, determine the target attribute information of the target point, and determine the first material map and the second material map corresponding to the target attribute information based on the correspondence between the attribute information and the material map, and process the first area and the second area based on the first material map (index number is 1) and the second material map (index number is 2) to obtain the target scene model, and display the target scene model through the display interface. Figure 1 The two sides of the road model shown on the terminal device 102, the upper and lower parts in the figure, are the map fusion areas, and the left side is the display map area. Figure 1 The right side shows the sticker Figure 2 The middle part is for pasting Figure 1 Hetie Figure 2 The mixed part avoids the abrupt connection of the textures and makes the transition more natural. The rendering of the target scene model is realized, the transition effect between the first area and the second area is ensured, and the authenticity of the rendered target scene model is ensured.
[0026] The end-side device 102 may include a browser, an APP (Application), or a web application such as an H5 (Hyper Text Markup Language 5, version 5 of Hypertext Markup Language) application, or a light application (also known as a mini-program, a lightweight application) or a cloud application, etc. The end-side device may be based on a software development kit (SDK) of the corresponding service provided by the server, such as based on the real-time communication (RTC, Real Time Communication) SDK development and acquisition. The end-side device may be deployed in an electronic device and needs to rely on the device to run or some APPs in the device to run. The electronic device may have a display screen and support information browsing, such as a personal mobile terminal such as a mobile phone, a tablet computer, a personal computer, etc. Various other types of applications may also be configured in the electronic device, such as human-computer dialogue applications, model training applications, text processing applications, web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0027] See also Figure 2 , Figure 2 A flow chart of a scene processing method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0028] Step 202: Determine a target point between the first area and the second area in the initial scene model.
[0029] Specifically, the scene processing method provided in the embodiments of this specification can be applied to the field of virtual scene rendering. For example, it can be virtual scene generation in the field of games, that is, rendering and generating game scenes in games. It can also be applied to virtual scene generation in other fields, such as film and television fields, architectural design fields, education fields, and product design fields. Specifically, in the field of film and television, movie special effects, animated films, and TV programs can use virtual scene rendering to create visual effects. In the field of architectural design, virtual scene rendering can be used to display unbuilt buildings or interior designs to achieve a preview of the final effect of architectural design. In the field of education, scene rendering in virtual reality and augmented reality can provide students with an immersive learning experience. In the field of product design, virtual scene rendering can be used to simulate the appearance and function of a product, so as to achieve product display to users and performance testing of products under different conditions. The embodiments of this specification do not limit this.
[0030] The initial scene can be understood as a three-dimensional scene model of a virtual scene to be rendered, such as a highway scene, a snowy mountain scene, a grassland scene, a street scene, etc. The target point can be understood as any point in the initial scene model. In practical applications, the target point can be understood as a pixel point displayed in the initial scene model. The first area and the second area can be understood as the first area and the second area on both sides of the target point in the initial scene model.
[0031] In practical applications, the effect of mixing multiple maps can be achieved in a model material of a three-dimensional scene model. For example, on a terrain model, different landforms, sand, grass, brick, land and their two-by-two mixing effects can be simulated. Different from traditional terrain mixing, such as mixing through 4 channels of vertex colors and using 4 channels of a mask map to control mixing, these traditional methods can generally only mix 4 sets of maps. If there are more than 4 sets, it is necessary to introduce another set of vertex colors or mask maps, which not only has a larger data volume, but also is inflexible. Based on this, the 8 bits of the single channel of the vertex color of the model material can be divided into two 4 bits, which are used to record the index values of the two maps that need to be mixed for the current pixel in the atlas. If the two index values are the same, it means that only one map needs to be sampled. If the two index values are different, it means that two maps need to be mixed. And 4 bits can represent up to 2 to the power of 4, that is, 16 numbers, from 0 to 15. So the maximum number of mixed maps in the atlas is 16.
[0032] Based on this, see Figure 3 , Figure 3 FIG. 1 is a schematic diagram showing an initial scene model in a scene processing method provided according to an embodiment of the present specification. Figure 3 As shown, the initial scene model may be a highway scene model, and a target point 306 between a first area 302 and a second area 304 in the initial scene model may be determined.
[0033] In a specific implementation, determining the target point between the first area and the second area in the initial scene model includes: Display the initial scene model through the display interface; In response to a point selection instruction for the initial scene model, a target point between a first area and a second area in the initial scene model is determined.
[0034] The display interface can be understood as a display interface for displaying the initial scene model, and the click instruction can be understood as a user's click operation on the initial scene model on the display interface. For example, if a user clicks a point in the initial scene model on the display interface, the point is the target point, and the two sides of the point are the first area and the second area where material mixing is required. In the field of virtual scene rendering, the user can be a designer of the virtual scene.
[0035] In one embodiment of the present specification, the scene processing method can be applied to a client, and the initial scene model can be displayed through a display interface of the client, and in response to a virtual scene designer's click operation on the initial scene model displayed in the display interface, a target point between the first area and the second area in the initial scene model can be determined.
[0036] In another embodiment of the present specification, the scene processing method can also be applied to the server. Then, the server can send the generated initial scene model to the client, and display the initial scene model through the client's display interface. The client responds to the user's click instruction for the initial scene model and sends the click instruction to the server. The server determines the target point between the first area and the second area in the initial scene model based on the click instruction.
[0037] In summary, through preprocessing operations, the areas where all vertices in the initial scene model are located are determined, and the index values of the material maps in the areas where the vertices are located in the merged maps are encoded and saved in the output model in the form of vertex colors, which facilitates the subsequent material mixing of the first area and the second area on both sides of the target point, further ensuring the authenticity of the virtual scene rendering.
[0038] Step 204: determining target attribute information of the target point, and determining a first texture map and a second texture map corresponding to the target attribute information according to a correspondence between the attribute information and the texture map.
[0039] In the case where the target point is a vertex, the target attribute information of the target point can be understood as the vertex color value of the vertex.
[0040] Based on this, the vertex color value of any vertex in the initial scene model can be determined, and according to the corresponding relationship between the vertex color value and the texture map, the first texture map and the second texture map corresponding to the vertex color value can be determined.
[0041] In actual applications, the vertex color value of the vertex may be pre-set, and after the user clicks the vertex, the vertex color value of the vertex is directly displayed on the display interface. Alternatively, the vertex color value of the vertex may be input by the user, for example, after the user clicks the vertex, the desired vertex color value is input on the display interface, and subsequently the corresponding first texture map and second texture map may be determined according to the vertex color value input by the user.
[0042] In a specific implementation, determining the first material map and the second material map corresponding to the target attribute information according to the correspondence between the attribute information and the material map includes: Determine first index information and second index information corresponding to the target attribute information according to a correspondence between the attribute information and the index information of the material map; A first material map corresponding to the first area is determined according to the first index information, and a second material map corresponding to the second area is determined according to the second index information.
[0043] The first index information and the second index information may both be understood as index information, and the index information is used to determine the material map.
[0044] For example, the index information can be an index number, which can be expressed as idx1, idx2, where idx1 represents the first material texture in the texture set, and idx2 represents the second material texture in the texture set. It can also be expressed as 1, 2, 3, etc., where 1 represents a material texture in the texture set, and 2 represents the second material texture in the texture set. The embodiments of this specification do not limit this.
[0045] Specifically, the first index information and the second index information corresponding to the vertex color value of the target point can be determined based on the correspondence between the vertex color value and the index information of the material map, and the first material map corresponding to the first area can be determined from the map set based on the first index information, and the second material map corresponding to the second area can be determined from the map set based on the second index information.
[0046] In summary, by setting the index information, the material maps corresponding to the first area and the second area on both sides of the target point can be determined, which is convenient for subsequent material mixing.
[0047] In practical applications, the target attribute information is represented by a first number system; After determining the target attribute information of the target point, the method further includes: Converting the numerical representation of the target attribute information from a first numerical system to a second numerical system; The determining, according to the correspondence between the attribute information and the index information of the material map, the first index information and the second index information corresponding to the target attribute information comprises: According to the correspondence between the second number system of the attribute information and the index information of the material map, the first index information and the second index information corresponding to the second number system of the target attribute information are determined.
[0048] The numerical representation of the target attribute information can be understood as the numerical representation of the vertex color value, and the numerical representation can include decimal, binary, octal, hexadecimal, quaternary, duodecimal, etc.
[0049] Based on this, after determining the vertex color value of the vertex, the vertex color value can be converted from the first number system to the second number system, and according to the correspondence between the second number system of the vertex color value and the index information of the material map, the first index information and the second index information corresponding to the vertex color value can be determined.
[0050] In summary, by converting the number system, the first index information and the second index information corresponding to the first area and the second area on both sides of the target point are determined.
[0051] In a specific implementation, the first number system is a decimal representation, and the second number system is a binary representation; After determining the target attribute information of the target point, the method further includes: Converting the numerical representation of the target attribute information from a decimal representation to a binary representation; The determining, according to the correspondence between the attribute information and the index information of the material map, the first index information and the second index information corresponding to the target attribute information comprises: According to the correspondence between the binary representation of the attribute information and the index information of the material map, first index information and second index information corresponding to the binary representation of the target attribute information are determined.
[0052] Specifically, the vertex color value of the vertex can be converted from decimal representation to binary representation, and the first index information and the second index information corresponding to the binary representation of the vertex color value can be determined based on the correspondence between the binary representation of the vertex color value and the index information of the material map. In practical applications, the correspondence between the binary representation of vertex color values and the index information of the material map can be understood as the correspondence between the index number of the material map and the binary representation obtained by binary conversion of the index number of the material map. For example, in the rendering field of a virtual game scene, the decimal representation of the vertex color value of the current channel of any vertex in the initial scene model can be obtained in the game engine as 35, and the vertex color value is converted to a base, and the binary representation of the vertex color value is calculated to be 00100011. According to the binary representation of the vertex color value, the binary representation corresponding to the first index information is calculated to be 0010, and the binary representation corresponding to the second index information is calculated to be 0011. Then, the first index information idx1 is equal to 0010, which is equal to 3, and the second index information idx2 is equal to 0011, which is equal to 2.
[0053] In one embodiment of the present specification, the determination of the first index information and the second index information can be implemented according to the following logic code. In the real-time rendering stage, in the shader, idx1 and idx2 can be calculated from the vertex color vc through a decoding algorithm. If idx1=idx2, it means that the current model (for example, there is only one type of terrain where the highway model is located) only needs to sample one map. If idx1≠idx2, it means that the current model (for example, the highway model is at the junction of two types of terrain) needs to sample and mix two maps to obtain the final pixel. The algorithm is as follows: idx1 = vc>>4; idx2 = vc&0x0F.
[0054] After that, the sampled textures can be mixed according to the actual mixing method to get the final pixel color. (For example, use the y component of the uv of the road model to mix, that is, mix the two texture colors along the direction of the road). The algorithm is as follows: c1 = SAMPLE_TEXTURE2D_ARRRY(texs, uv, idx1); c2 = SAMPLE_TEXTURE2D_ARRRY(texs,uv, idx2) c = lerp(c1,c2,uv.y).
[0055] In another embodiment of the present specification, the determination of the first index information and the second index information may be implemented according to the following logic code.
[0056] int idx1 = bit&15; int idx2 = (bit>>4); float blendMask = idx1 == idx2 ? 1.0 : saturate(uv0.y * 4); Specifically, the logic code uses the bitwise AND operation (&) to extract the lowest four bits of bit. Because 15 is 00001111 in binary, bit&15 will clear the upper four bits of bit and keep only the lower four bits. If bit is an 8-bit integer, this actually takes the last four bits of bit as idx1. After that, the right shift operation (>>) is used to move the upper four bits of bit to the lowest four bits. In this way, the upper four bits of bit are obtained as idx2. After that, the conditional expression is used to check whether idx1 is equal to idx2. If the two are equal, the value of blendMask is 1.0; if they are not equal, the value of blendMask is the result of uv0.y multiplied by 4 and processed by the saturate function. The saturate function is usually used to ensure that the value is between 0 and 1. In computer graphics, this function is often used for color and texture coordinates to avoid exceeding the valid range. saturate(x) is generally equivalent to max(0, min(x, 1)), that is, it returns 0 if x is less than 0, 1 if x is greater than 1, and x itself otherwise.
[0057] In other words, the logic of the logic code is: extract two 4-bit indexes idx1 (first index information) and idx2 (second index information) from bit. If idx1 and idx2 are equal, the value of blendMask is 1.0; otherwise, the value of blendMask is the saturated value of uv0.y multiplied by 4.
[0058] Furthermore, the correspondence between the decimal representation of the vertex color value and the index information can be directly calculated according to the above-mentioned base conversion, so that the first index information and the second index information corresponding to the vertex color value can be directly determined according to the correspondence between the decimal representation of the vertex color value and the index information, see Figure 4 , Figure 4 A schematic diagram showing the correspondence between vertex color values and index numbers in a scene processing method provided according to an embodiment of the present specification is shown. Figure 4 As shown, for example, when the vertex color value is 000, the corresponding index numbers are 00 and 00, which means that the first texture map and the second texture map are the same. When the vertex color value is 001, the corresponding index numbers are 00 and 01, and when the vertex color value is 002, the corresponding index numbers are 00 and 02.
[0059] Furthermore, in one embodiment of the present specification, the first texture map and the second texture map may be the same, and the first index information and the second index information are also the same. It is understandable that when the first texture map and the second texture map are the same, there is no need to mix the first texture map and the second texture map, and the first area and the second area in the initial scene model can be directly rendered according to the first texture map and the second texture map to obtain the target scene model.
[0060] For example, if the initial scene model is a highway model, and the terrain materials on both sides of the highway are black soil, the edge of the highway can sample the black soil texture with index number 4 (binary representation is 0100) in the texture set. Since there is only one material, the first index information of the first texture map and the index information of the second texture map are both 4. The binary representation of its vertex color value can be calculated as: 0100 0100, and the decimal representation is 68, that is, its vertex color value is 68.
[0061] In another embodiment of the present specification, the first material map and the second material map may be different, and then the first index information and the second index information are also different.
[0062] For example, if the initial scene model is a highway model, and the current highway is at the junction of two terrain materials, such as the transition between grass material and black soil material, the material at the edge of the highway should be a mixture of two maps: the grass map with the first index information of 1 and the black soil map with the second index information of 4. The binary representation of the first index information is 0001, and the binary representation of the second index information is 0100. Combining them into a decimal number 20 is the value of its vertex color.
[0063] Then, in the client's game engine, the vertex color value of the current vertex can be obtained, for example, 20. Through inverse operation, the first index information can be obtained as 1, and the second index information can be obtained as 4. The first material map corresponding to the first index information and the second material map corresponding to the second index information can be sampled according to the model UV mixture to achieve a gradual transition effect from grass to black soil.
[0064] In addition, the vertex color value of the vertex color may also be represented by other number systems, such as octal system, duodecimal system, etc., which is not limited in the embodiments of this specification.
[0065] In summary, by converting between decimal and binary, the correspondence between material maps, index information and vertex color values is realized, thereby ensuring the richness and efficiency of mixed sampling of material maps.
[0066] In practical applications, before determining the target attribute information of the target point, the method further includes: Determine a texture set including a plurality of material textures, and determine index information corresponding to each material texture in the texture set; The index information corresponding to any two material maps in the map set is converted into the first number system, and the corresponding relationship between the first number system and the index information of the any two material maps is recorded.
[0067] Specifically, before rendering the initial scene model, a texture set containing multiple material maps can be created in advance, the index information of the first material map in any two material maps can be converted into a binary representation, the index information of the second material map can be converted into a binary representation, the binary representation of the combination of the first material map and the second material map is determined, the binary representation of the combination is converted into decimal, the decimal representation is determined as the vertex color value obtained by the combination of the first material map and the second material map, and the correspondence between the decimal representation and the first index information and the second index information is recorded.
[0068] In practical applications, in the DCC baking model part, it can be achieved by a vertex color mark blending method of the model. The specific implementation is as follows: idx1 can be used to represent the index number of the first material map in the map collection, and idx2 can be used to represent the index number of the second material map in the map collection. If you want to blend two maps with index numbers 2 and 3, then idx=02, idx=03; the corresponding vertex color value calculation method is: convert idx1 into binary 0010, and idx2 into binary 0011. The binary representation of the combination of idx1 and idx2 is 00100011, which is converted into decimal as 35, that is, the single channel value of the vertex color should be set to 35.
[0069] Specifically, in the offline resource generation stage, all textures that need to be mixed can be merged into an atlas texs in a fixed order. Each texture has its corresponding index number in the atlas, and a maximum of 16 textures can be mixed, with index numbers from idx0 to idx15. In 3D software such as Houdini, open the corresponding scene terrain (, the model to be processed (road model), record the information of the mixed map according to its needs (in this case: the map of the terrain at the location), and find the two index numbers idx1 and idx2 corresponding to the map in the mixed atlas. There are two possibilities at this time. If idx1=idx2, it means that only one map needs to be calculated (in this case: it means that there is only one landform in the current terrain); if idx1≠idx2, two maps need to be calculated (for example, the current terrain is just at the intersection of two landforms), and the index numbers idx1 and idx2 corresponding to the maps are obtained respectively. Through the encoding algorithm, idx1 and idx2 are merged into one value, and it is saved as the value of the 8-bit single-channel vertex color in the vertex color channel of the model (road model). It can be implemented using the following algorithm: vc = idx1<<4 | idx2.
[0070] See also Figure 5 , Figure 5 FIG. 4 shows a schematic diagram of a texture set in a scene processing method provided according to an embodiment of the present specification, such as Figure 5 As shown, the map set may include 16 material maps, and their corresponding index numbers are 0, 1, 2, 3, 4, 5...15 respectively.
[0071] Then, determining the first index information and the second index information corresponding to the target attribute information according to the correspondence between the attribute information and the index information of the material map includes: According to the correspondence between the decimal representation of the attribute information and the index information of the material map, first index information and second index information corresponding to the binary representation of the target attribute information are determined.
[0072] In addition, the correspondence between the binary representation and the first index information and the second index information may also be recorded.
[0073] In summary, by creating a texture collection in advance and recording the correspondence between index information and vertex color values, it is possible to mix up to 16 material maps through one vertex color channel. Combining 16 material maps into an atlas reduces the number of sampling times. Using one texture collection to mix up to 16 material maps can achieve 256 texture mixing effects, thereby achieving a rich and free mixing effect of multiple material maps.
[0074] Step 206: Process the first region and the second region according to the first material map and the second material map to obtain a target scene model.
[0075] The target scene model may be understood as a three-dimensional scene model obtained by rendering according to the first texture map and the second texture map.
[0076] In a specific implementation, the first area and the second area are processed according to the first material map and the second material map to obtain a target scene model, including: Mixing the first texture map and the second texture map to obtain a mixed texture image; The first region and the second region are processed according to the mixed map image to obtain a target scene model.
[0077] Specifically, the first material map and the second material map are mixed to obtain a mixed map image, and the first area and the second area are rendered according to the mixed map image and the mask UV to obtain a target scene model.
[0078] In summary, by mixing the first material map and the second material map, the subsequent rendering and transition of the two terrain effects are achieved.
[0079] In addition, after obtaining the target scene model, the method further includes: Displaying the target scene model through the display interface; In response to a parameter adjustment instruction for the target scene model, the target scene model is adjusted.
[0080] The parameter adjustment instruction can be understood as an instruction to adjust the vertex color value of the target scene model. In actual application, the user can adjust the vertex color value by clicking the control and sliding the mouse, and the client can render and display the target scene model in real time in response to the operation.
[0081] Based on this, after obtaining the target scene model, the target scene model can be displayed through the display interface of the client, and in response to the user's operation of clicking and sliding the mouse on the control, the user's adjustment instruction for the vertex color value of the target scene model is determined, and according to the adjustment instruction, the vertex color value of the target scene model is adjusted, and the adjusted target scene model is displayed on the display interface.
[0082] In summary, by displaying and adjusting parameters of the target scene model, the target scene model generated by rendering can be further optimized and improved, thereby further ensuring the authenticity of the rendered virtual scene and being able to dynamically meet user needs.
[0083] To summarize, in the above method, by determining the target point between the first area and the second area in the initial scene model that needs to be rendered, the target attribute information of the target point is determined, and according to the correspondence between the attribute information and the material map, the first material map and the second material map corresponding to the target attribute information are determined. By setting the correspondence between the attribute information and the material map, the limitation on the number of material maps caused by the RGBA channel of the vertex color is avoided, so that the number of mixed material maps is greater, and the first area and the second area are processed according to the first material map and the second material map to complete the rendering of the initial scene model, obtain the target scene model, and ensure the authenticity and richness of the rendering of the target scene model.
[0084] The following combination Figure 6 , taking the application of the scene processing method provided in this specification in the game virtual screen as an example, the scene processing method is further explained. Figure 6 A processing flow chart of a scene processing method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0085] Step 602: Determine a texture set including a plurality of material textures, and determine index information corresponding to each material texture in the texture set.
[0086] Specifically, a texture set containing 16 texture maps may be determined, and index information of each texture map may be determined, for example, the index number of the first texture map is idx0, the index number of the second texture map is idx1, the index number of the third texture map is idx2, and so on.
[0087] Step 604: convert the index information corresponding to any two material maps in the map set into the first number system, and record the corresponding relationship between the first number system and the index information of any two material maps.
[0088] Specifically, any two material maps in the map set can be combined to obtain the vertex color value corresponding to the map combination, and the corresponding relationship between the index information of the two material maps and the vertex color value corresponding to the map combination is recorded.
[0089] Taking the first texture map and the second texture map as an example, it can be determined that the binary representation of the index number idx0 is 0010, the binary representation of the index number idx1 is 0011, and the binary representation of the combination of the first texture map and the second texture map is 00100011. The correspondence between the binary representation and the index number is recorded, and the binary representation of the combination can also be converted into a decimal representation of 35. The decimal representation is determined as the vertex color value obtained by the combination of the first texture map and the second texture map, and the correspondence between the decimal representation 35 and the index numbers idx0 and idx1 is recorded.
[0090] It can be understood that the process described in the above steps 602 to 604 is the preparation process before virtual scene rendering. In actual applications, the corresponding maps of all terrain materials, such as PBR materials, can be used in 3D production software (such as Houdini). The maps required are: base color map, roughness metal map, normal map, etc. Take the base color map as an example, the base color maps of all materials (grass, mud, stone ground and other different materials) are merged into a large square map (atlas) in a certain order, such as from left to right, from top to bottom, in n rows and n columns. n is an integer. If the number of materials is less than n*n, fill the empty space with black or white, and repeat the above operation for the maps of other channels. Export this atlas as an offline resource for later use in the game engine.
[0091] For details, see Figure 7 , Figure 7 A schematic diagram of an offline resource preparation stage in a scene processing method provided according to an embodiment of the present specification is shown, such as Figure 7 As shown, the terrain resources can be converted into all terrain maps, and all terrain maps are put into the terrain atlas and the map index table respectively. In the map index table, when it is judged that there are two terrain boundaries, the decimal index (idx0=0, idx1=1) and binary index (idx0=0000, idx1=0010) corresponding to the two terrain maps are determined, thereby determining the binary vertex color (0000 0010) and decimal vertex color (2) corresponding to the two terrain maps; when it is judged that there is only one terrain boundary, it can be determined that the two terrain maps correspond to the decimal index (idx0=idx1=4) and binary index (idx0=idx1=0100), thereby determining the binary vertex color (0100) corresponding to the two terrain maps. 0100) and decimal vertex color (68) to determine the encoded vertex color, and save the encoded vertex color to the model data as a model resource, while the terrain atlas is used as a texture resource. The model resource and texture resource can be used as export resources for rendering in subsequent game engines.
[0092] The process described in the following steps 606 to 614 is a rendering process of a virtual scene. The preparation process and the rendering process may be continuous or discontinuous, and this embodiment of the specification does not limit this.
[0093] Step 606: displaying the initial scene model through the display interface, and in response to a selection instruction for the initial scene model, determining a target point between the first area and the second area in the initial scene model.
[0094] Step 608: Determine the target attribute information of the target point, and convert the numerical representation of the target attribute information from decimal representation to binary representation.
[0095] Specifically, it can be determined that the decimal representation of the vertex color value (ie, target attribute information) of the target point is 35, and the decimal representation 35 can be converted into a binary representation 00100011.
[0096] Step 610: Determine first index information and second index information corresponding to the binary representation of the target attribute information according to the correspondence between the binary representation of the attribute information and the index information of the material map.
[0097] Specifically, the first index information idx0 and the second index information idx1 corresponding to the binary representation 00100011 may be determined according to the corresponding relationship recorded in step 604 .
[0098] Step 612: Determine a first material map corresponding to the first region according to the first index information, and determine a second material map corresponding to the second region according to the second index information.
[0099] Step 614: Mix the first material map and the second material map to obtain a mixed map image, and process the first area and the second area according to the mixed map image and the mask UV to obtain a target scene model.
[0100] In practical applications, in 3D production software (such as Houdini), the range of the initial scene model is calculated according to the terrain area of the art design (the specific expression of the range is a black and white picture covering the entire scene projected from the top of the scene, and the white represents the area affected by the current area). The scene model is located in this scene, so it is possible to know in which area each vertex of the scene model is located, and the index value of the texture of the area in the output texture set is encoded and saved in the vertex color channel of the vertex through the above method.
[0101] After that, the exported target model and texture set resources are imported into the game engine, and the position of the target model is restored in the game engine (assuming that the terrain resources of the scene have been imported into the engine). By obtaining the vertex color information of the target and decoding it, the area where the current vertex is located can be obtained. Then, according to the mixing effect of the two materials to be expressed, the corresponding algorithm is used, such as UV mixing, to achieve the final material mixing effect.
[0102] For details, see Figure 8 , Figure 8 FIG. 1 shows a schematic diagram of a real-time rendering stage in a scene processing method provided according to an embodiment of the present specification. Figure 8 As shown, in the game engine, the vertex color can be obtained according to the model resource. In the process of decoding the vertex color, for example, the decimal vertex color obtained is 2 and the binary vertex color is 0000 0010, then the corresponding decimal index is idx0=0, idx1=2, and the binary index is idx0=0000, idx1=0010, or, the decimal vertex color obtained is 68 and the binary vertex color is 0100 0100, then the corresponding decimal index is idx0=idx1=4, and the binary index is idx0=idx1=0100, then the corresponding two terrain maps can be obtained from the texture resource according to the decimal index or binary index. For example, when the decimal index is idx0=0 and idx1=2, texture 0 and texture 1 can be obtained. Figure 2 , for this map 0 and map Figure 2 Perform mixed sampling to obtain the rendering result, or when the decimal index is idx0=idx1=4, you can look up the texture to get the texture. Figure 4 , pair Figure 4 Direct sampling is performed to obtain rendering results, thereby realizing mixed map rendering.
[0103] To summarize, in the above method, by determining the target point between the first area and the second area in the initial scene model that needs to be rendered, the target attribute information of the target point is determined, and according to the correspondence between the attribute information and the material map, the first material map and the second material map corresponding to the target attribute information are determined. By setting the correspondence between the attribute information and the material map, the limitation on the number of material maps caused by the RGBA channel of the vertex color is avoided, so that the number of mixed material maps is greater, and the first area and the second area are processed according to the first material map and the second material map to complete the rendering of the initial scene model, obtain the target scene model, and ensure the authenticity and richness of the rendering of the target scene model.
[0104] Corresponding to the above method embodiment, this specification also provides a scene processing device embodiment, Fig. 9FIG. 1 is a schematic diagram showing the structure of a scene processing device provided by an embodiment of the present specification. Fig. 9 As shown, the device comprises: A first determination module 902 is configured to determine a target point between a first area and a second area in an initial scene model; The second determination module 904 is configured to determine target attribute information of the target point, and determine a first texture map and a second texture map corresponding to the target attribute information according to a correspondence between the attribute information and the texture map; The processing module 906 is configured to process the first area and the second area according to the first material map and the second material map to obtain a target scene model.
[0105] In an optional embodiment, the second determining module 904 is further configured to: Determine first index information and second index information corresponding to the target attribute information according to a correspondence between the attribute information and the index information of the material map; A first material map corresponding to the first area is determined according to the first index information, and a second material map corresponding to the second area is determined according to the second index information.
[0106] In an optional embodiment, the target attribute information is represented by a first number system; The second determining module 904 is further configured to: Converting the numerical representation of the target attribute information from a first numerical system to a second numerical system; According to the correspondence between the second number system of the attribute information and the index information of the material map, the first index information and the second index information corresponding to the second number system of the target attribute information are determined.
[0107] In an optional embodiment, the device further includes a recording module configured to: Determine a texture set including a plurality of material textures, and determine index information corresponding to each material texture in the texture set; The number system representation of the index information is set to the second number system, and the corresponding relationship between the second number system and the index information is recorded.
[0108] In an optional embodiment, the first number system is a decimal representation, and the second number system is a binary representation; The second determining module 904 is further configured to: Converting the numerical representation of the target attribute information from a decimal representation to a binary representation; The determining, according to the correspondence between the attribute information and the index information of the material map, the first index information and the second index information corresponding to the target attribute information comprises: According to the correspondence between the binary representation of the attribute information and the index information of the material map, first index information and second index information corresponding to the binary representation of the target attribute information are determined.
[0109] In an optional embodiment, the processing module 906 is further configured to: Mixing the first texture map and the second texture map to obtain a mixed texture image; The first region and the second region are processed according to the mixed map image to obtain a target scene model.
[0110] In an optional embodiment, the first determining module 902 is further configured to: Display the initial scene model through the display interface; In response to a point selection instruction for the initial scene model, a target point between a first area and a second area in the initial scene model is determined.
[0111] In an optional embodiment, the device further includes an adjustment module configured to: Displaying the target scene model through the display interface; In response to a parameter adjustment instruction for the target scene model, the target scene model is adjusted.
[0112] To summarize, in the above-mentioned device, by determining the target point between the first area and the second area in the initial scene model that needs to be rendered, the target attribute information of the target point is determined, and according to the correspondence between the attribute information and the material map, the first material map and the second material map corresponding to the target attribute information are determined. By setting the correspondence between the attribute information and the material map, the limitation on the number of material maps caused by the RGBA channel of the vertex color is avoided, so that the number of mixed material maps is greater, and the first area and the second area are processed according to the first material map and the second material map to complete the rendering of the initial scene model, obtain the target scene model, and ensure the authenticity and richness of the rendering of the target scene model.
[0113] The above is a schematic scheme of a scene processing device of this embodiment. It should be noted that the technical scheme of the scene processing device and the technical scheme of the above-mentioned scene processing method belong to the same concept, and the details not described in detail in the technical scheme of the scene processing device can be referred to the description of the technical scheme of the above-mentioned scene processing method.
[0114] Fig.10 The block diagram of a computing device 1000 according to an embodiment of the present specification is shown. The components of the computing device 1000 include but are not limited to a memory 1010 and a processor 1020. The processor 1020 is connected to the memory 1010 via a bus 1030, and the database 1050 is used to store data.
[0115] The computing device 1000 also includes an access device 1040 that enables the computing device 1000 to communicate via one or more networks 1060. Examples of these 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. The access device 1040 may include one or more of any type of network interface (e.g., a network interface card (NIC)) of wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide 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.
[0116] In one embodiment of the present application, the above components of the computing device 1000 and Fig.10 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Fig.10 The computing device structure block diagram shown is only for the purpose of illustration, 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.
[0117] The computing device 1000 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 1000 may also be a mobile or stationary server.
[0118] The processor 1020 is used to execute the following computer executable instructions, which, when executed by the processor, implement the steps of the above-mentioned scene processing method.
[0119] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the scene processing method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the scene processing method embodiment.
[0120] An embodiment of the present specification also provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned scene processing method when executed by a processor.
[0121] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the scene processing method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the scene processing method embodiment.
[0122] An embodiment of the present specification also provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned scene processing method when executed by a processor.
[0123] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned scene processing method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned scene processing method.
[0124] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0125] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0126] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0127] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0128] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. A scene processing method, characterized in that: include: Determine a target point between the first area and the second area in the initial scene model; Determine target attribute information of the target point, and determine a first texture map and a second texture map corresponding to the target attribute information according to a correspondence between the attribute information and the texture map; The first region and the second region are processed according to the first material map and the second material map to obtain a target scene model.
2. The scene processing method according to claim 1, characterized in that: The determining, according to the correspondence between the attribute information and the material map, the first material map and the second material map corresponding to the target attribute information comprises: Determine first index information and second index information corresponding to the target attribute information according to a correspondence between the attribute information and the index information of the material map; A first material map corresponding to the first area is determined according to the first index information, and a second material map corresponding to the second area is determined according to the second index information.
3. The scene processing method according to claim 2, characterized in that: The number system of the target attribute information is represented by the first number system; After determining the target attribute information of the target point, the method further includes: Converting the numerical representation of the target attribute information from a first numerical system to a second numerical system; The determining, according to the correspondence between the attribute information and the index information of the material map, the first index information and the second index information corresponding to the target attribute information comprises: According to the correspondence between the second number system of the attribute information and the index information of the material map, the first index information and the second index information corresponding to the second number system of the target attribute information are determined.
4. The scene processing method according to claim 3, characterized in that: Before determining the target attribute information of the target point, the method further includes: Determine a texture set including a plurality of material textures, and determine index information corresponding to each material texture in the texture set; The index information corresponding to any two material maps in the map set is converted into the first number system, and the corresponding relationship between the first number system and the index information of the any two material maps is recorded.
5. The scene processing method according to claim 3, characterized in that: The first number system is a decimal representation, and the second number system is a binary representation; After determining the target attribute information of the target point, the method further includes: Converting the numerical representation of the target attribute information from a decimal representation to a binary representation; The determining, according to the correspondence between the attribute information and the index information of the material map, the first index information and the second index information corresponding to the target attribute information comprises: According to the correspondence between the binary representation of the attribute information and the index information of the material map, first index information and second index information corresponding to the binary representation of the target attribute information are determined.
6. The scene processing method according to claim 1, characterized in that: The step of processing the first region and the second region according to the first material map and the second material map to obtain a target scene model includes: Mixing the first texture map and the second texture map to obtain a mixed texture image; The first region and the second region are processed according to the mixed map image to obtain a target scene model.
7. The scene processing method according to claim 1, characterized in that: The step of determining a target point between the first area and the second area in the initial scene model includes: Display the initial scene model through the display interface; In response to a point selection instruction for the initial scene model, a target point between a first area and a second area in the initial scene model is determined.
8. The scene processing method according to claim 7, characterized in that: After obtaining the target scene model, the method further includes: Displaying the target scene model through the display interface; In response to a parameter adjustment instruction for the target scene model, the target scene model is adjusted.
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, characterized in that: It stores a computer program / instruction, which implements the steps of the method described in any one of claims 1 to 8 when executed by a processor.
11. A computer program product, characterized in that The method comprises a computer program / instruction which, when executed by a processor, implements the steps of the method according to any one of claims 1 to 8.
