An image rendering method, apparatus, device, storage medium, and program product
By texture mapping and rendering material mapping of the texture images of virtual objects in the virtual scene, the resource waste problem caused by reference to the original texture images during the life cycle of the virtual object is solved, and resource saving and efficient rendering of virtual objects are achieved.
Patent Information
- Application Number
- CN202111664453.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2021-11-08
- Filing Date
- 2021-12-31
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2041-12-31
AI Technical Summary
The prior art requires reference to the original texture image throughout the life cycle of virtual objects in a virtual scene, resulting in waste of storage space and computing resources and affecting the user experience.
By obtaining multiple texture images of the virtual object to be rendered, performing texture mapping processing, obtaining the rendered target texture image, and mapping it into the rendering material, and image rendering processing is performed based on the mapped rendering material.
Effectively utilize rendering target texture images to save storage space and computing resources, and improve the display effect of virtual objects.
Smart Images

Figure CN114067042B_ABST
Abstract
Description
[0001] This application claims the priority of the application with the application number 202111313680.9, the application date of November 8, 2021, and the title: An Image Rendering Method, Device, Equipment, Storage Medium and Program Product. Technical Field
[0002] This application relates to computer graphics technology, and in particular to an image rendering method, device, electronic device, computer-readable storage medium and computer program product. Background Art
[0003] The display technology based on graphics processing hardware has expanded the channels for perceiving the environment and obtaining information. In particular, the display technology of virtual scenes can realize diverse interactions between virtual objects controlled by users or artificial intelligence according to actual application requirements, and has various typical application scenarios. For example, in virtual scenes such as games, it can simulate the real battle process between virtual objects.
[0004] In related technologies, virtual objects in a virtual scene are generated by loading textures. Therefore, it is necessary to directly set the texture parameters in the material parameters, and the original texture image needs to be referenced throughout the life cycle of the virtual object. This solution will waste a large amount of storage space and computing resources, thereby affecting the user experience. Summary of the Invention
[0005] Embodiments of this application provide an image rendering method, device, electronic device, computer-readable storage medium and computer program product, which can make full and effective use of the rendered target texture image and save relevant storage space and computing resources.
[0006] The technical solution of the embodiments of this application is implemented as follows:
[0007] Embodiments of this application provide an image rendering method, including:
[0008] Obtain multiple texture images of a virtual object to be rendered, where each of the texture images corresponds to at least one part of the virtual object to be rendered;
[0009] Perform texture mapping processing on the multiple texture images to obtain a rendered target texture image;
[0010] Map the rendered target texture image into a rendering material to obtain a mapped rendering material;
[0011] Perform image rendering processing on at least one part of the virtual object to be rendered based on the mapped rendering material to obtain a rendered virtual object.
[0012] Embodiments of this application provide an image rendering device, including:
[0013] An acquisition module, configured to acquire a plurality of texture images of a virtual object to be rendered, wherein each of the texture images corresponds to at least one part of the virtual object to be rendered;
[0014] A first mapping module, configured to perform texture mapping processing on the plurality of texture images to obtain a rendered target texture image;
[0015] A second mapping module, configured to map the rendered target texture image into a rendering material to obtain a mapped rendering material;
[0016] A rendering module, configured to perform image rendering processing on at least one part of the virtual object to be rendered based on the mapped rendering material to obtain a rendered virtual object.
[0017] In the above technical solution, the first mapping module is further configured to perform texture positioning processing on the plurality of texture images to obtain a baked material including texture parameters;
[0018] Through the baked material, perform texture baking processing on the plurality of texture images to obtain a rendered target texture image.
[0019] In the above technical solution, the first mapping module is further configured to determine the texture parameters based on the plurality of texture images;
[0020] Fill the plurality of texture images into the baked material according to the texture parameters to obtain a baked material including the texture parameters.
[0021] In the above technical solution, the baked material includes a plurality of texture units; the first mapping module is further configured to fill the plurality of texture images into corresponding texture units in the baked material to obtain a baked material including the texture parameters;
[0022] Wherein, at least one of the texture images is filled in the texture unit.
[0023] In the above technical solution, the first mapping module is further configured to determine a rendered texture image for texture baking;
[0024] Through the baked material, draw the plurality of texture images onto the rendered texture image to obtain the rendered target texture image.
[0025] In the above technical solution, the first mapping module is further configured to determine the rendering precision of the virtual object to be rendered;
[0026] Query a configuration file based on the rendering precision of the virtual object to be rendered to obtain a rendered texture image with a size corresponding to the rendering precision of the virtual object to be rendered;
[0027] Among them, the configuration file includes the association relationship between rendering textures of different rendering precisions and different sizes.
[0028] In the above technical solution, the first mapping module is further configured to obtain graphics processing performance parameters for image rendering;
[0029] Query the performance parameter configuration file based on the graphics processing performance parameters to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters;
[0030] Among them, the performance parameter configuration file includes the association relationship between different graphics processing performance parameters and different rendering precisions.
[0031] In the above technical solution, the graphics processing performance parameters include graphics processing hardware parameters, and the performance parameter configuration file includes the association relationship between different graphics processing hardware parameters and different rendering precisions;
[0032] The first mapping module is further configured to query the performance parameter configuration file based on the graphics processing hardware parameters before the end of the virtual scene operation to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters;
[0033] Among them, the graphics processing hardware parameters are queried according to the model of the electronic device for displaying the rendered virtual object, and include at least one of the following: processor model, memory capacity.
[0034] In the above technical solution, the graphics processing performance parameters include graphics processing software parameters, and the performance parameter configuration file includes the association relationship between different graphics processing software parameters and different rendering precisions;
[0035] The first mapping module is further configured to query the performance parameter configuration file based on the graphics processing software parameters during the virtual scene operation to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing software parameters during the virtual scene operation;
[0036] Among them, the graphics processing software parameters include at least one of the following: free memory capacity, idle computing power of the processor.
[0037] In the above technical solution, the texture images corresponding to at least one part include a base color texture image, a normal texture image, and a roughness texture image;
[0038] The first mapping module is further configured to perform the following processing on the texture images corresponding to at least one part:
[0039] Perform texture mapping processing on the base color texture image to obtain a rendered target texture image including base color texture parameters;
[0040] Perform texture mapping processing on the normal texture image to obtain a rendered target texture image including normal texture parameters;
[0041] Perform texture mapping processing on the roughness texture image to obtain a rendered target texture image including roughness texture parameters;
[0042] The second mapping module is further configured to map the rendered target texture image including base color texture parameters, the rendered target texture image including normal texture parameters, and the rendered target texture image including roughness texture parameters into a rendering material to obtain a mapped rendering material.
[0043] In the above technical solution, the obtaining module is further configured to obtain multiple texture images of the virtual object to be rendered from a cache space;
[0044] After performing texture mapping processing on the multiple texture images to obtain a rendered target texture image, release the multiple texture images of the virtual object to be rendered from the cache space.
[0045] In the above technical solution, the obtaining module is further configured to display multiple candidate display information, where the candidate display information is used to decorate at least one part of the virtual object to be rendered;
[0046] In response to a selection operation on the multiple candidate display information, use the selected candidate display information as target display information;
[0047] Use the texture image corresponding to the target display information as the texture image of the virtual object to be rendered.
[0048] In the above technical solution, the device further includes:
[0049] A processing module, configured to perform inverse mapping processing on the mapped rendering material when the display period of the rendered virtual object arrives to obtain the rendered target texture image;
[0050] Store the rendered target texture image in a storage space;
[0051] Wherein, the rendered target texture image is used to be read from the storage space when subsequently mapping the rendered target texture image.
[0052] An embodiment of the present application provides an electronic device for image rendering, and the electronic device includes:
[0053] A memory for storing executable instructions;
[0054] A processor, when executing the executable instructions stored in the memory, implements the image rendering method provided by the embodiments of the present application.
[0055] The embodiments of the present application provide a computer-readable storage medium storing executable instructions, which are used to cause a processor to implement the image rendering method provided by the embodiments of the present application when executed.
[0056] The embodiments of the present application provide a computer program product, including a computer program or instructions, characterized in that the computer program or instructions implement the image rendering method provided by the embodiments of the present application when executed by a processor.
[0057] The embodiments of the present application have the following beneficial effects:
[0058] By performing texture mapping on multiple texture images to obtain a rendered target texture image, and mapping the rendered target texture image into a rendering material, at least one part of a virtual object to be rendered is image-rendered based on the mapped rendering material, so as to make full and effective use of the rendered target texture image for image rendering, saving relevant storage space and computing resources, and thus improving the display effect of the virtual object. Description of the Drawings
[0059] Figure 1A - Figure 1B is a schematic diagram of an application mode of the image rendering method provided by the embodiments of the present application;
[0060] Figure 2 is a schematic diagram of the structure of an electronic device for image rendering provided by the embodiments of the present application;
[0061] Figures 3 - 5 is a schematic flowchart of the image rendering method provided by the embodiments of the present application;
[0062] Figure 6 is a schematic diagram of a virtual object to be rendered provided by the embodiments of the present application;
[0063] Figure 7 is a schematic diagram of display information provided by the embodiments of the present application;
[0064] Figures 8 - 9 is a schematic diagram of a rendered virtual object provided by the embodiments of the present application;
[0065] Figure 10 is a flowchart of an image rendering method provided by the related art;
[0066] Figure 11 is a schematic flowchart of the image rendering method provided by the embodiments of the present application;
[0067] Figure 12 It is a schematic flowchart of the image rendering method provided by an embodiment of the present application. Detailed implementation manners
[0068] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be construed as limitations on the present application. All other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the scope of protection of the present application.
[0069] In the following description, the terms "first / second" involved are only used to distinguish similar objects and do not represent a specific order for the objects. It can be understood that "first / second" can be interchanged with a specific order or sequence when permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0070] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.
[0071] Before further elaborating on the embodiments of the present application, the nouns and terms involved in the embodiments of the present application are described. The nouns and terms involved in the embodiments of the present application are subject to the following explanations.
[0072] 1) In response to: used to indicate the conditions or states on which the executed operations depend. When the dependent conditions or states are met, one or more executed operations can be real-time or can have a set delay; without special instructions, there is no limitation on the execution order of the multiple executed operations.
[0073] 2) Client: An application program running on a terminal for providing various services, such as a video playback client, a game client, etc.
[0074] 3) Virtual scene: A virtual scene displayed (or provided) when an application program runs on a terminal. The virtual scene can be a simulation environment of the real world, a semi-simulated and semi-fictional virtual environment, or a purely fictional virtual environment. The virtual scene can be any one of a two-dimensional virtual scene, a 2.5D virtual scene, or a three-dimensional virtual scene. The embodiments of the present application do not limit the dimension of the virtual scene. For example, the virtual scene can include the sky, land, ocean, etc. The land can include environmental elements such as deserts and cities, and users can control virtual objects to move in the virtual scene.
[0075] 4) Virtual objects: images of various people and objects that can interact in a virtual scene, or movable objects in a virtual scene. The movable objects can be virtual characters, virtual animals, cartoon characters, etc., such as characters and animals displayed in a virtual scene. The virtual object can be a virtual image in a virtual scene that represents a user. A virtual scene can include multiple virtual objects, each of which has its own shape and volume in the virtual scene and occupies a part of the space in the virtual scene.
[0076] 5) Scene data: characteristic data representing a virtual scene, such as the area of the construction area in the virtual scene, the current architectural style of the virtual scene, etc.; it may also include the location of the virtual building in the virtual scene, and the area occupied by the virtual building, etc.
[0077] 6) Display information: information used to modify at least one part of a virtual object, such as makeup used to modify the virtual character's face (e.g., lip shape, eye shadow, pupil, iris, etc.), and clothing used to modify the virtual character's limbs (e.g., ancient costumes, combat uniforms, etc.).
[0078] 7) Image baking: Using lightmap technology to bake objects is a technology that enhances the scene lighting effect, making the scene look more realistic, rich, and three-dimensional at a lower performance. Baking is to render the details on the high-precision model with a texture, and then paste the rendered texture onto the low-precision model, so that the low-precision model looks like the details of the high-precision model.
[0079] 8) Memory optimization: Improve memory usage efficiency, increase operating speed as much as possible, and reduce memory usage.
[0080] The embodiments of the present application provide an image rendering method, device, electronic device, computer-readable storage medium, and computer program product, which can fully and effectively utilize the rendering target texture image and save related storage space and computing resources. In order to facilitate easier understanding of the image rendering method provided by the embodiments of the present application, the exemplary implementation scenario of the image rendering method provided by the embodiments of the present application is first described. The virtual object in the image rendering method provided by the embodiments of the present application can be completely based on the terminal output, or based on the coordinated output of the terminal and the server.
[0081] In some embodiments, the virtual scene can be an environment for game characters to interact. For example, it can be an environment for game characters to fight in the virtual scene. By controlling the actions of the game characters, both parties can interact in the virtual scene, allowing users to relieve life stress during the game.
[0082] In one implementation scenario, see Figure 1A , Figure 1AIt is a schematic diagram of the application mode of the image rendering method provided by the embodiments of the present application, which is applicable to some application modes that can complete the relevant data calculation of the virtual scene 100 entirely relying on the graphic processing hardware computing power of the terminal 400. For example, in the single-player / offline mode games, the output of the virtual scene is completed through various types of terminals 400 such as smart phones, tablets, and virtual reality / augmented reality devices.
[0083] As an example, the types of graphic processing hardware include the central processing unit (CPU, Central Processing Unit) and the graphics processing unit (GPU, Graphics Processing Unit).
[0084] When forming the visual perception of the virtual scene 100, the terminal 400 calculates the data required for display through the graphic computing hardware, and completes the loading, parsing, and rendering of the display data. The graphic output hardware outputs video frames that can form a visual perception of the virtual scene. For example, two-dimensional video frames are presented on the display screen of a smart phone, or video frames that achieve three-dimensional display effects are projected on the lenses of augmented reality / virtual reality glasses; in addition, in order to enrich the perception effect, the terminal 400 can also use different hardware to form one or more of auditory perception, tactile perception, motion perception, and taste perception.
[0085] As an example, a client 410 (such as a single-player game application) runs on the terminal 400. During the operation of the client 410, a virtual scene including role-playing is output. The virtual scene can be an environment for game characters to interact, such as a plain, street, valley, etc. for game characters to fight; taking the display of the virtual scene 100 from the first-person perspective as an example, the rendered virtual object 101 is displayed in the virtual scene 100. The rendered virtual object 101 can be a game character controlled by a user (or player), and will operate in the virtual scene in response to the operation of the real user on the button (including joystick buttons, attack buttons, defense buttons, etc.). For example, when the real user moves the joystick button to the left, the virtual object will move to the left in the virtual scene, and can also stay still, jump, and use various functions (such as skills and props); the rendered virtual object 101 can also be an artificial intelligence (AI, Artificial Intelligence) set in the virtual scene battle through training; the rendered virtual object 101 can also be a non-player character (NPC, Non-Player Character) set in the virtual scene interaction; the rendered virtual object 101 can also be an immovable object or a movable object in the virtual scene 100.
[0086] For example, taking the display of the virtual scene 100 from the first-person perspective as an example, in the virtual scene 100, a virtual object to be rendered is displayed. Before the start of the battle game, the player customizes the virtual object to be rendered, such as configuring display information such as makeup (such as eyeshadow, blush, etc.), clothing, and headdress 102 for the virtual object to be rendered, and through an image rendering method, performs texture mapping processing on multiple texture images corresponding to the display information to obtain a rendered target texture image, maps the rendered target texture image into a rendering material to obtain a mapped rendering material, and performs image rendering processing on at least one part of the virtual object to be rendered based on the mapped rendering material, so as to modify the virtual object to be rendered through display information such as makeup and clothing, and perform human-computer interaction in the virtual scene based on the rendered virtual object 101, such as game confrontation. The player can adjust these display information to achieve the effect of customizing the virtual object, improving the playability and diversity of the game, and also improving the user experience.
[0087] In another implementation scenario, refer to Figure 1B , Figure 1B is a schematic diagram of the application mode of the image rendering method provided by the embodiment of the present application, which is applied to the terminal 400 and the server 200, and is applicable to the application mode that depends on the computing power of the server 200 to complete virtual scene calculation and output the virtual scene at the terminal 400.
[0088] Taking the formation of the visual perception of the virtual scene 100 as an example, the server 200 calculates the display data related to the virtual scene (such as scene data) and sends it to the terminal 400 through the network 300. The terminal 400 depends on the graphics computing hardware to complete the loading, parsing, and rendering of the calculated display data, and depends on the graphics output hardware to output the virtual scene to form visual perception. For example, a two-dimensional video frame can be presented on the display screen of a smart phone, or a video frame with a three-dimensional display effect can be projected on the lens of an augmented reality / virtual reality glasses; for the perception of the form of the virtual scene, it can be understood that it can be output by the corresponding hardware of the terminal 400, such as using a microphone to form auditory perception, using a vibrator to form tactile perception, and so on.
[0089] As an example, a client 410 (such as an online game application) runs on a terminal 400. By connecting to a server 200 (such as a game server), it interacts with other users in a game. The terminal 400 outputs a virtual scene 100 of the client 410. Taking the display of the virtual scene 100 from the first-person perspective as an example, a rendered virtual object 101 is displayed in the virtual scene 100. The rendered virtual object 101 can be a game character controlled by a user (or player). It will be operated in the virtual scene in response to the operations of a real user on buttons (including joystick buttons, attack buttons, defense buttons, etc.). For example, when the real user moves the joystick button to the left, the virtual object will move to the left in the virtual scene. It can also stay stationary, jump, and use various functions (such as skills and items); the rendered virtual object 101 can also be an artificial intelligence (AI) set in a virtual scene battle through training; the rendered virtual object 101 can also be a non-player character (NPC) set in a virtual scene interaction; the rendered virtual object 101 can also be an immovable object or a movable object in the virtual scene 100.
[0090] For example, taking the display of the virtual scene 100 from the first-person perspective as an example, a virtual object to be rendered is displayed in the virtual scene 100. During the process of a battle game, the player customizes and adjusts the virtual object to be rendered. For example, the player reconfigures display information such as makeup (such as eyeshadow, blush, etc.), clothing, and headdress 102 for the virtual object to be rendered, and through an image rendering method, performs texture mapping processing on multiple texture images corresponding to the reconfigured display information to obtain a rendered target texture image. The rendered target texture image is mapped into a rendering material to obtain a mapped rendering material. Based on the mapped rendering material, image rendering processing is performed on at least one part of the virtual object to be rendered to redecorate the virtual object to be rendered with display information such as makeup and clothing, and based on the re-rendered virtual object 101, human-computer interaction in the virtual scene is carried out, such as game confrontation. The player can adjust these display information at any time to achieve the effect of customizing the virtual object, improving the playability and diversity of the game, and also improving the user experience.
[0091] In some embodiments, the terminal 400 may implement the image rendering method provided in the embodiments of the present application by running a computer program. For example, the computer program may be a native program or software module in an operating system; it may be a native application (APP), that is, a program that needs to be installed in the operating system to run, such as a dressing-up game APP (i.e., the above-mentioned client 410); it may also be a mini-program, that is, a program that only needs to be downloaded to the browser environment to run; it may also be a game mini-program that can be embedded in any APP. In short, the above computer program may be any form of application program, module or plug-in.
[0092] Taking the computer program as an application program as an example, in actual implementation, the terminal 400 installs and runs an application program that supports virtual scenarios. The application program may be any one of a first-person shooting game (FPS, First-Person Shooting game), a third-person shooting game, a virtual reality application program, a three-dimensional map program, or a multiplayer gunfight survival game. The user uses the terminal 400 to operate virtual objects located in the virtual scenario to perform activities, and the activities include but are not limited to: adjusting the body posture, crawling, walking, running, cycling, jumping, driving, picking up, shooting, attacking, throwing, and building at least one of virtual buildings. Schematically, the virtual object may be a virtual character, such as a simulated character or an anime character.
[0093] In some embodiments, the embodiments of the present application may also be implemented by means of cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or a local area network to achieve data calculation, storage, processing, and sharing.
[0094] Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, and application technology based on the cloud computing business model. It can form a resource pool, be used on demand, and is flexible and convenient. Cloud computing technology will become an important support. The background services of the technical network system require a large amount of computing and storage resources.
[0095] Exemplarily, Figure 1BThe server 200 therein may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The terminal 400 may be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal 400 and the server 200 may be directly or indirectly connected through wired or wireless communication methods, which are not limited in the embodiments of the present application.
[0096] See Figure 2 , Figure 2 is a schematic structural diagram of an electronic device for image rendering provided by an embodiment of the present application. Taking the electronic device as the terminal 400 as an example for illustration, Figure 2 The electronic device 400 shown includes: at least one processor 420, a memory 460, at least one network interface 430, and a user interface 440. Each component in the terminal 400 is coupled together through a bus system 450. It can be understood that the bus system 450 is used to realize the connection and communication between these components. In addition to including a data bus, the bus system 450 also includes a power bus, a control bus, and a status signal bus. However, for the sake of clear illustration, in Figure 2 all kinds of buses are labeled as the bus system 450.
[0097] The processor 420 may be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP, Digital Signal Processor), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or any conventional processor, etc.
[0098] The user interface 440 includes one or more output devices 441 that enable the presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 440 also includes one or more input devices 442, including user interface components that facilitate user input, such as keyboards, mice, microphones, touch screen displays, cameras, and other input buttons and controls.
[0099] The memory 460 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memories, hard disk drives, optical disc drives, etc. The memory 460 optionally includes one or more storage devices that are physically located away from the processor 420.
[0100] The memory 460 includes volatile memory, non-volatile memory, or both volatile and non-volatile memory. The non-volatile memory can be a read-only memory (ROM), and the volatile memory can be a random access memory (RAM). The memory 460 described in the embodiments of the present application is intended to include any suitable type of memory.
[0101] In some embodiments, the memory 460 is capable of storing data to support various operations. Examples of such data include programs, modules, and data structures, or subsets or supersets thereof, which are exemplarily described below.
[0102] The operating system 461 includes system programs for processing various basic system services and performing hardware-related tasks, such as the framework layer, the core library layer, the driver layer, etc., for implementing various basic services and processing hardware-based tasks;
[0103] The network communication module 462 is used to reach other computing devices via one or more (wired or wireless) network interfaces 430. Exemplary network interfaces 430 include: Bluetooth, Wi-Fi (Wireless Fidelity), and USB (Universal Serial Bus), etc.;
[0104] The presentation module 463 is used to enable the presentation of information (such as a user interface for operating peripheral devices and displaying content and information) via one or more output devices 441 associated with the user interface 440 (such as a display screen, a speaker, etc.).
[0105] The input processing module 464 is used to detect and translate one or more user inputs or interactions from one of one or more input devices 442.
[0106] In some embodiments, the image rendering device provided in the embodiments of the present application can be implemented in software. Figure 2 Shown is an image rendering device 465 stored in the memory 460, which can be software in the form of programs and plugins, etc., including the following software modules: an acquisition module 4651, a first mapping module 4652, a second mapping module 4653, a rendering module 4654, and a processing module 4655. These modules are logical, and thus can be arbitrarily combined or further split according to the functions to be implemented.
[0107] In some other embodiments, the image rendering device provided by the embodiments of the present application may be implemented in a hardware manner. As an example, the image rendering device provided by the embodiments of the present application may be a processor in the form of a hardware decoding processor, which is programmed to execute the image rendering method provided by the embodiments of the present application. For example, a processor in the form of a hardware decoding processor may employ one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs), or other electronic components.
[0108] The image rendering method provided by the embodiments of the present application will be specifically described below in conjunction with the accompanying drawings. The image rendering method provided by the embodiments of the present application can be executed independently by the Figure 1A terminal 400 in Figure 1B or can be executed collaboratively by the
[0109] terminal 400 and the server 200 in Figure 1A Below, taking the example that the image rendering method provided by the embodiments of the present application is executed independently by the Figure 3 terminal 400 in Figure 3 as an example for illustration. Refer to Figure 3 which is a schematic flowchart of the image rendering method provided by the embodiments of the present application, and the steps shown in
[0110] It should be noted that Figure 3 the method shown in
[0111] In step 101, a plurality of texture images of the virtual object to be rendered are obtained, where each texture image corresponds to at least one part of the virtual object to be rendered.
[0112] It should be noted that the texture image of the virtual object to be rendered is a texture image corresponding to the display information, where the display information is used to decorate at least one part of the virtual object to be rendered. For example, it is used to decorate the makeup on the face of the virtual character (such as lip shape, eye shadow, pupil, iris, blush, etc.), and the clothing on the limbs of the virtual character (such as ancient costumes, combat uniforms, etc.). Among them, the virtual object to be rendered does not include the display information. For example, asFigure 6 The virtual object 601 to be rendered as shown is a base object model, and decorations such as makeup and clothing need to be added to the base object model.
[0113] In some embodiments, obtaining multiple texture images of the virtual object to be rendered includes: displaying multiple candidate display information, where the candidate display information is used to decorate at least one part of the virtual object to be rendered; in response to a selection operation on the multiple candidate display information, using the selected candidate display information as the target display information; and using the texture image corresponding to the target display information as the texture image of the virtual object to be rendered.
[0114] As Figure 7 shown, multiple candidate display information such as clothing 1, clothing 2, clothing 3, etc. are displayed on the human-computer interaction interface. When clothing 1 is selected, the texture image corresponding to clothing 1 is used as the texture image of the virtual object 601 to be rendered, so that clothing 1 can be added to the body part of the virtual object 601 to be rendered subsequently, thus vividly dressing the virtual object 601 to be rendered with clothing 1.
[0115] In step 102, performing texture mapping processing on the multiple texture images to obtain a rendered target texture image.
[0116] For example, each texture image corresponds to at least one part of the virtual object to be rendered. Performing texture mapping processing on the multiple texture images to obtain a rendered target texture image, so that in subsequent rendering processes, only this one rendered target texture image needs to be referenced, and then the original texture resources (such as texture images corresponding to lip shapes, eye shadows, pupils, irises, etc.) can be released to achieve the effect of reducing the usage amount of storage space (such as memory).
[0117] See Figure 4 , Figure 4 is an optional flowchart of the image rendering method provided by an embodiment of the present application. Figure 4 showing Figure 3 Step 102 in
[0118] can be implemented through steps 1021 - 1022: In step 1021, performing texture positioning processing on the multiple texture images to obtain a baked material including texture parameters; in step 1022, through the baked material, performing texture baking processing on the multiple texture images to obtain a rendered target texture image.
[0119] It should be noted that the baking material is a tool for processing texture images, and the baking material has two functions: 1) carrying the original texture image, and placing the original texture image in order into the baking material according to the set texture parameters (the function is similar to a kind of temporary photo frame); 2) drawing (copying) the processed texture image exactly as it is onto the rendering target texture image (a tool function).
[0120] As an example, the texture image is similar to the sub - picture blocks in a 9 - grid puzzle (such as the sub - picture blocks corresponding to display information such as eyebrows, blushes, eyeshadows, etc.). The baking material is used to carry the sub - picture blocks, can place the sub - picture blocks into the baking material (similar to a temporary photo frame), and draw (copy) the assembled sub - picture blocks exactly as they are onto the canvas (i.e., the rendering target texture image).
[0121] In some embodiments, performing texture positioning processing on multiple texture images to obtain a baking material including texture parameters includes: determining texture parameters based on the multiple texture images; and filling the multiple texture images into the baking material according to the texture parameters to obtain a baking material including texture parameters.
[0122] For example, determining the corresponding texture parameters based on the attributes of the texture images, and placing the multiple texture images into the baking material according to the texture parameters to obtain a baking material including texture parameters. For example, if texture image 1 corresponds to the lips and texture image 2 corresponds to the cheeks, then based on texture image 1, determining the corresponding texture parameter as parameter 1, based on texture image 2, determining the corresponding texture parameter as parameter 2, and filling texture image 1 and texture image 2 into the corresponding positions in the order of parameter 1 and parameter 2 to obtain a baking material including texture parameters.
[0123] As an example, the texture image is similar to the sub - picture blocks in a 9 - grid puzzle (such as the sub - picture blocks corresponding to display information such as eyebrows, blushes, eyeshadows, etc.), and the texture parameters are similar to the order of the sub - picture blocks. The baking material is used to carry the sub - picture blocks and place the sub - picture blocks into the baking material according to the order of the sub - picture blocks.
[0124] In some embodiments, the baking material includes multiple texture units; filling the multiple texture images into the baking material to obtain a baking material including texture parameters includes: filling the multiple texture images into the corresponding texture units in the baking material to obtain a baking material including texture parameters; wherein, at least one texture image is filled in the texture unit.
[0125] For example, if more texture units are required for partitioning character makeup areas, more texture units are needed. For example, OpenGL guarantees at least 16 texture units are available, which means texture units can be selected from GL_TEXTURE0 to GL_TEXTURE15 for input. However, when the 17th texture unit is to be used, OpenGL does not fail to support it. Using the DrawMaterialToRenderTarget function can cleverly merge the texture images that need to input certain texture units and output a single image, and use the merged output texture image as the input of the texture unit, thereby indirectly achieving the purpose of more texture input units.
[0126] In some embodiments, performing texture baking on multiple texture images to obtain a rendered target texture image includes: determining a rendered texture image for texture baking; and drawing the multiple texture images onto the rendered texture image through a baking material to obtain the rendered target texture image.
[0127] For example, after determining the rendered texture image for texture baking, draw the multiple texture images onto the rendered texture image through a baking material to obtain the rendered target texture image.
[0128] As an example, the texture image is similar to the sub - image blocks in a 9 - grid jigsaw puzzle (such as sub - image blocks corresponding to the display information of eyebrows, blushes, eyeshadows, etc.), the texture parameters are similar to the order of the sub - image blocks, and the rendered texture image is similar to a canvas, which ultimately needs to be placed in a frame for display. The baking material is used to carry the sub - image blocks. According to the order of the sub - image blocks, the sub - image blocks are placed into the baking material, and the merged sub - image blocks are drawn onto the canvas exactly as they are through the baking material.
[0129] In some embodiments, determining a rendered texture image for texture baking includes: determining the rendering precision of a virtual object to be rendered; querying a configuration file based on the rendering precision of the virtual object to be rendered to obtain a rendered texture image with a size corresponding to the rendering precision of the virtual object to be rendered; where the configuration file includes the association relationship between different rendering precisions and different - sized rendered texture images.
[0130] For example, virtual objects with different rendering precisions correspond to different - sized rendered texture images. For example, a high - precision game character model corresponds to a large - sized rendered texture image, and a low - precision game model corresponds to a small - sized rendered texture image. Thus, through a finer - grained partitioning of the rendered texture image, storage space and computing resources are fully utilized, and further, the display effect of the virtual object is improved.
[0131] As an example, the models of in-game characters are divided into two types. One is a high-precision model (high rendering precision), which is a high-definition model used to display detailed character information. The other is a third-party low-precision model in the game (low rendering precision). The distinction between high and low precision models lies not only in the difference in model vertices and faces, but also in size. For low-precision models, using a rendering texture image of 1024*1024 far exceeds its precision requirements, so a rendering texture image of 258*258 can be used instead, thus saving storage space and computing resources.
[0132] In some embodiments, determining the rendering precision of a virtual object to be rendered includes: obtaining a graphics processing performance parameter for image rendering; querying a performance parameter configuration file based on the graphics processing performance parameter to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter; wherein, the performance parameter configuration file includes the association relationship between different graphics processing performance parameters and different rendering precisions.
[0133] For example, the association relationship between different graphics processing performance parameters and different rendering precisions is pre-configured and saved in the performance parameter configuration file. After obtaining the graphics processing performance parameter for image rendering, query the association relationship between different graphics processing performance parameters and different rendering precisions included in the performance parameter configuration file based on the graphics processing performance parameter for image rendering, so as to query the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter. Subsequently, query the configuration file based on the rendering precision of the virtual object to be rendered to obtain the rendering texture image of the size corresponding to the rendering precision of the virtual object to be rendered.
[0134] As an example, if the graphics processing performance parameter for image rendering is strong performance, query the performance parameter configuration file based on the graphics processing performance parameter for image rendering, and the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter is a high-precision model; if the graphics processing performance parameter for image rendering is weak performance, query the performance parameter configuration file based on the graphics processing performance parameter for image rendering, and the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter is a low-precision model.
[0135] In some embodiments, the graphics processing performance parameter includes a graphics processing hardware parameter, and the performance parameter profile includes the association relationship between different graphics processing hardware parameters and different rendering precisions; querying the performance parameter profile based on the graphics processing performance parameter to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter includes: before the virtual scene runs to an end, querying the performance parameter profile based on the graphics processing hardware parameter to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter; wherein, the graphics processing hardware parameter is queried according to the model of the electronic device that displays the rendered virtual object, and includes at least one of the following: processor model, memory capacity.
[0136] For example, the processor includes a central processing unit, a graphics processing unit, etc. Processors of different models and memories of different capacities have different software running speeds. When the virtual scene starts running or during the running of the virtual scene, query the performance parameter profile based on the graphics processing hardware parameter of the virtual scene to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter. For example, when the memory capacity of the electronic device that displays the virtual scene is large and the processor capability is strong, the model precision of the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter is high.
[0137] In some embodiments, the graphics processing performance parameter includes a graphics processing software parameter, and the performance parameter profile includes the association relationship between different graphics processing software parameters and different rendering precisions; querying the performance parameter profile based on the graphics processing performance parameter to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameter includes: querying the performance parameter profile based on the graphics processing software parameter during the running of the virtual scene to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing software parameter during the running of the virtual scene; wherein, the graphics processing software parameter includes at least one of the following: free memory capacity, free computing power of the processor.
[0138] For example, the processor includes a central processing unit, a graphics processing unit, etc. After the electronic device runs software, its software running speed is different. During the running of the virtual scene, query the performance parameter profile based on the graphics processing software parameter of the virtual scene to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing software parameter during the running of the virtual scene. For example, when the free memory capacity of the electronic device that displays the virtual scene is large and the free computing power of the processor is strong, the model precision of the rendering precision of the virtual object corresponding to the graphics processing hardware parameter of the virtual scene is high. Among them, the computing power depends on the number of cores, the frequency of the cores, the single clock cycle of the cores, etc.
[0139] In some embodiments, obtaining multiple texture images of a virtual object to be rendered includes: obtaining multiple texture images of the virtual object to be rendered from a cache space; after performing texture mapping processing on the multiple texture images to obtain a rendered target texture image, releasing the multiple texture images of the virtual object to be rendered from the cache space.
[0140] For example, after obtaining multiple texture images of a virtual object to be rendered from a cache space and performing texture mapping processing on the multiple texture images to obtain a rendered target texture image, the original texture image resources are released, and only the rendered target texture image is referenced during the life cycle of the virtual object, so as to reduce memory occupancy.
[0141] In step 103, the rendered target texture image is mapped into a rendering material to obtain a mapped rendering material.
[0142] For example, the rendering material is the material that is ultimately actually used to display the virtual object. The rendered target texture image is drawn into the rendering material to obtain a mapped rendering material, and subsequent image rendering is performed based on the mapped rendering material to present the rendered virtual object.
[0143] As an example, the rendering material is similar to a photo frame, and a canvas needs to be filled into the photo frame. The rendered texture image is similar to the canvas, and this canvas ultimately needs to be placed in the photo frame for display. After the merged sub-tiles are drawn onto the canvas as they are by the baking material, the canvas is filled into the photo frame.
[0144] See Figure 5 , Figure 5 is an optional process schematic diagram of the image rendering method provided by the embodiments of the present application, Figure 5 showing Figure 3 Step 102 in can be implemented through steps 1023 - 1025: The texture images corresponding to at least one part include a base color texture image, a normal texture image, and a roughness texture image; in step 1023, the following processing is performed on the texture images corresponding to at least one part: performing texture mapping processing on the base color texture image to obtain a rendered target texture image including base color texture parameters; in step 1024, performing texture mapping processing on the normal texture image to obtain a rendered target texture image including normal texture parameters; in step 1025, performing texture mapping processing on the roughness texture image to obtain a rendered target texture image including roughness texture parameters; Figure 5 showing Figure 3 Step 103 in can be implemented through step 1031: Mapping the rendered target texture image including base color texture parameters, the rendered target texture image including normal texture parameters, and the rendered target texture image including roughness texture parameters into the rendering material to obtain a mapped rendering material.
[0145] For example, to precisely express the display information of a virtual object, information such as the base color (BaseColor), normal (Normal), and roughness (Rougness) of the corresponding part of the virtual object needs to be provided. Therefore, a total of 3 render target texture images (TextureRenderTarget2D) need to be generated, namely BaseColor, Normal, and Roughness. The virtual object is finally sampled and rendered by these three texture maps. Since three TextureRenderTaraget2D are required to express the part information of the virtual object, 3 baking materials are needed to separately draw BaseColor, Normal, and Rougness. Based on the base color texture image, normal texture image, and roughness texture image, a render target texture image including base color texture parameters, a render target texture image including normal texture parameters, and a render target texture image including roughness texture parameters are respectively generated, and the render target texture image including base color texture parameters, the render target texture image including normal texture parameters, and the render target texture image including roughness texture parameters are mapped into the render material to obtain the mapped render material, thereby precisely expressing the virtual object.
[0146] In step 104, based on the mapped render material, image rendering processing is performed on at least one part of the virtual object to be rendered, and the rendered virtual object is obtained.
[0147] For example, after obtaining the mapped render material, image rendering is performed on at least one part of the virtual object to be rendered based on the mapped render material to present the rendered virtual object, so that players can achieve the function of customizing the virtual object by adjusting some parameters, such as adding makeup such as eyeshadow and blush to the game character, thereby attracting a specific user group to increase the basic user number of the game and improve the playability and diversity of the game.
[0148] As an example, multiple candidate display information is displayed on the human-computer interaction interface, such as Clothing 1, Clothing 2, Clothing 3, etc. When Clothing 1 is selected, the texture image corresponding to Clothing 1 is used as the texture image of the virtual object 601 to be rendered, as Figure 8 shown. The texture image of the virtual object 601 to be rendered is subjected to texture mapping processing to obtain a render target texture image. The render target texture image is mapped into the render material to obtain the mapped render material. Based on the mapped render material, image rendering processing is performed on the body part of the virtual object 601 to be rendered, and the rendered virtual object 602 is obtained. Clothing 1 is added to the body part of the rendered virtual object 602, thereby vividly dressing the virtual object 601 with Clothing 1.
[0149] As an example, multiple candidate display information, such as eyelashes, mouth, eyeshadow, hair, etc., are displayed on the human-computer interaction interface. When the lips and eyeshadow are selected, the texture images corresponding to the lips and eyeshadow are used as the texture images of the virtual object 601 to be rendered. As Figure 9 shown, the texture image of the virtual object 601 to be rendered is subjected to texture mapping processing to obtain a rendered target texture image. The rendered target texture image is mapped into the rendering material to obtain a mapped rendering material. Based on the mapped rendering material, image rendering processing is performed on the mouth and eye parts of the virtual object 601 to be rendered, and a rendered virtual object is obtained. Eyeshadow is added to the eye part of the rendered virtual object, and lips are added to the mouth part.
[0150] In some embodiments, when the display period of the rendered virtual object arrives, an inverse mapping process is performed on the mapped rendering material to obtain a rendered target texture image; the rendered target texture image is stored in a storage space; wherein, the rendered target texture image is used to be read from the storage space when the rendered target texture image is mapped subsequently.
[0151] For example, when the rendered virtual object changes the display information again or the rendered virtual object is defeated and cannot be displayed in the virtual scene, the rendered target texture image is restored from the mapped rendering material, that is, the rendered target texture image is recycled, and the rendered target texture image is stored in the storage space, so that when the rendered target texture image is mapped again subsequently, the rendered target texture image is read from the storage space, thereby realizing the function of reusing the rendered target texture image and releasing the rendering material to reduce memory occupancy.
[0152] Next, an exemplary application of the embodiments of the present application in an actual application scenario will be described.
[0153] The embodiments of the present application can be applied to games with functions such as adjusting the facial makeup of characters, such as products that have a fine control requirement for the character's face and high requirements for game quality and performance. Players can adjust some parameters through the game panel to achieve the function of customizing the character, such as adding makeup such as eyeshadow and blush to the game character, thereby attracting a specific user group to increase the basic user number of the game and improve the playability and diversity of the game.
[0154] Next, taking the virtual scene as a game as an example for description:
[0155] In the related art, by directly setting the texture of the Material, without intermediate layer operations, the texture is loaded when the in-game character is generated, and the texture is recycled and released when the character is destroyed. As Figure 10As shown in the figure: 1) Load the character; 2) After the character loading is completed, load the textures required for the character; 3) If the character loading is not completed, wait for the loading; 4) Set the material texture parameters; 5) When the character needs to be destroyed, recycle the textures; 6) When the character does not need to be destroyed, wait for the character to be destroyed.
[0156] Therefore, the related technologies have the following problems: 1) It is impossible to make accurate distinctions in the textures of some game characters. All game characters have the same texture accuracy. When the game characters are too far away, only texture mapping techniques (such as mipmap) can be relied on for rendering acceleration, but this way will increase the additional memory usage; 2) Memory is uncontrollable. When there are too many game characters, each game character needs to hold the original texture reference during its life cycle, resulting in a large amount of memory waste; 3) The reference relationships of multiple characters increase the complexity of the texture recycling system design.
[0157] To solve the above problems, the embodiments of the present application provide an image rendering method, which provides a method for games with makeup logic and requiring memory optimization, and can achieve the maximum reduction in the memory occupancy of makeup, with good implementation effects, adjustable memory occupancy, and a better optimization point between performance and memory.
[0158] It should be noted that for game characters, especially third-party characters (characters controlled by third-party players), due to the limitation of the mobile phone screen size, there is little visual difference between using high-precision textures and low-precision textures. Therefore, the memory can be limited by reducing the texture size. In addition, in the embodiments of the present application, the textures of all the makeup of the game characters are drawn onto a rendered target texture image (TextureRenderTarget2D) through an intermediate baking material, and then this TextureRenderTarget2D is used as the base material input of the mesh (Mesh) and then output to the screen. The whole process only needs to retain the TextureRenderTarget2D during the life cycle of the game character, and then the original makeup texture resources (such as lip shapes, eyeshadows, pupils, irises, etc.) can be released, thus achieving the effect of reducing the memory usage.
[0159] The following combines Figure 11 Specifically illustrate the image rendering method provided by the embodiments of the present application:
[0160] Step 11: Load the game character.
[0161] Step 12: After the game character loading is completed, load the textures required for the game character.
[0162] It should be noted that the textures required for the character are the textures corresponding to the makeup (such as eyebrows, blushes, eyeshadows).
[0163] Step 13: If the game character has not been fully loaded, wait for the loading to complete.
[0164] Step 14: Set the texture parameters of the baking material.
[0165] It should be noted that the bake material is a tool for processing the original makeup texture resources. The bake material has two functions: 1) To carry the original makeup texture resources and place the original makeup texture resources in order on the bake material according to the set texture parameters (the function is similar to a kind of temporary photo frame); 2) To draw (copy) the processed makeup texture resources exactly as they are onto the TextureRenderTarget2D (the tool function).
[0166] Step 15: Generate a render texture image for baking (the initial TextureRenderTarget2D).
[0167] Step 16: Draw the render texture image.
[0168] It should be noted that through the tool function of the baking material, the processed makeup texture resources are drawn exactly as they are onto the initial TextureRenderTarget2D to obtain the rendered render target texture image (the TextureRenderTarget2D can be set to different sizes, and the high, medium, and low configurations of the computer determine the size of the TextureRenderTarget2D).
[0169] Step 17: Set the render target texture image to the material used for actual rendering.
[0170] It should be noted that the material for actual rendering is the material ultimately used to display the game character. The drawn render texture image (i.e., the render target texture image) is set to the material used for actual rendering.
[0171] Step 18: When the game character needs to be destroyed, recycle the texture.
[0172] It should be noted that texture recycling means taking out the render target texture image from the material for actual rendering and using it next time. Among them, texture recycling is a sub-step of destroying the character.
[0173] Step 19: When the game character does not need to be destroyed, wait for the character to be destroyed.
[0174] Therefore, the image rendering method provided by the embodiments of the present application requires two sets of materials, namely Material 1 and Material 2. The following specifically describes Material 1 and Material 2:
[0175] Material 1: Baking material, which is used to set the original texture modified by the user and other material parameters except the original texture to Material 1, and then call the DrawMaterialToRenderTarget function to output the material content to a temporary render target texture image (TextureRenderTarget2D).
[0176] Material 2: The material actually used for the target rendered character. The TextureRenderTarget2D output by Material 1 is used as the input of Material 2 and is finally rendered onto the screen.
[0177] It should be noted that TextureRenderTaraget2D is used to receive the rendering result of Material 1, and the rendering result is transmitted to Material 2 through an intermediate baking medium. During the life cycle of the target character, this TextureRenderTarget2D should be held all the time and recycled and released at the end of the life cycle.
[0178] If you want to express the character's facial information in detail, you need to provide information such as the base color (BaseColor), normal (Normal), and roughness (Rougness) of the character's face. Therefore, Figure 5 In the process shown from loading the texture to texture recycling, a total of 3 TextureRenderTarget2D need to be generated, namely BaseColor, Normal, and Roughness. The character is finally sampled and rendered by these three texture maps. Since three TextureRenderTaraget2D are required to express the facial information, 3 materials are needed to draw BaseColor, Normal, and Roughness respectively. In the above figure, the process from loading the character texture to texture recycling is more finely divided as Figure 12 shown Figure 11 Step 12 in is finely divided into loading the base color texture, loading the normal texture, and loading the roughness texture; Figure 11 Step 14 in is finely divided into setting the base color texture parameters, setting the normal texture parameters, and setting the roughness texture parameters; Figure 11 Step 15 in is finely divided into generating the render texture image of the base color (RT(BaseColor)), generating the render texture image of the normal (RT(Normal)), and generating the render texture image of the roughness (RT(Rougness)); Figure 11Step 16 in is refined into a render target texture image for drawing the base color (DrawRT(BaseColor)), a render target texture image for drawing the normal (DrawRT(Normal)), and a render target texture image for drawing the roughness (DrawRT(Roughness)); Figure 11 Step 17 in is to set DrawRT(BaseColor), DrawRT(Normal), and DrawRT(Roughness) to the materials used for actual rendering respectively; Figure 5 Step 18 in is refined into recycling the base color texture, the normal texture, and the roughness texture.
[0179] It should be noted that the embodiments of this application can perform granularity division on TextureRenderTarget2D. There are two types of models of in-game characters. One is a high-precision model, a high-definition model used to display detailed character information, and the other is a third-party low-precision model in the game. The distinction between high-precision and low-precision models lies not only in the difference in model vertices and faces, but also in the difference in size. For low-precision models, using a texture map of 1024*1024 size far exceeds its precision requirements, and the more scene characters there are, the more memory is occupied. For characters with different precisions, in Figure 11 Step 15 in has a finer-grained size division for TextureRenderTarget2D, as shown in Table 1.
[0180] Table 1
[0181] High - definition model Third - party low - precision model BaseColor 1024*1024 256*256 Normal 1024*1024 128*128 Rougness 1024*1024 128*128
[0182] It should be noted that if there are more divisions of character makeup parts, more texture input units are required. For example, OpenGL ensures at least 16 texture units are available, that is, texture units can be arbitrarily selected from GL_TEXTURE0 to GL_TEXTURE15 for input. However, when the 17th texture unit is to be used, OpenGL does not support it. Only some hardware manufacturers open more texture units. Using the DrawMaterialToRenderTarget function can cleverly merge some texture units and output them to one image, and then use the merged output as the input of the texture unit, thus indirectly achieving the purpose of more texture input units.
[0183] In summary, the method for optimizing the in-game character makeup memory provided by the embodiments of this application has the following beneficial effects:
[0184] 1) It is not necessary to maintain the initial texture input throughout the character's life cycle. These textures can be released immediately after the effect of Material 1 is completed, achieving the purpose of deleting them after use. The content of these textures is output to TextureRenderTarget2D, and only this one TextureRenderTarget2D needs to be maintained, greatly reducing the design complexity.
[0185] 2) The size of TextureRenderTarget2D can be customized. For certain types of characters with higher precision requirements (such as those at a closer distance), a larger size can be used to improve precision. For different models or different application scenarios, different strategies can also be dynamically selected through configuration, greatly increasing the controllability of the software.
[0186] So far, the exemplary applications and implementations of the terminal provided in the embodiments of the present application have been combined to illustrate the image rendering method provided in the embodiments of the present application. Next, the cooperation of each module in the image rendering device 465 provided in the embodiments of the present application to implement the image rendering solution will be described.
[0187] An acquisition module 4651 is configured to acquire multiple texture images of a virtual object to be rendered, where each of the texture images corresponds to at least one part of the virtual object to be rendered; a first mapping module 4652 is configured to perform texture mapping processing on the multiple texture images to obtain a rendered target texture image; a second mapping module 4653 is configured to map the rendered target texture image into a rendering material to obtain a mapped rendering material; a rendering module 4654 is configured to perform image rendering processing on at least one part of the virtual object to be rendered based on the mapped rendering material to obtain a rendered virtual object.
[0188] In some embodiments, the first mapping module 4652 is further configured to perform texture positioning processing on the multiple texture images to obtain a baking material including texture parameters; through the baking material, perform texture baking processing on the multiple texture images to obtain a rendered target texture image.
[0189] In some embodiments, the first mapping module 4652 is further configured to determine the texture parameters based on the multiple texture images; fill the multiple texture images into the baking material according to the texture parameters to obtain a baking material including the texture parameters.
[0190] In some embodiments, the baking material includes multiple texture units; the first mapping module 4652 is further configured to fill the multiple texture images into corresponding texture units in the baking material to obtain a baking material including the texture parameters; where at least one of the texture images is filled in the texture unit.
[0191] In some embodiments, the first mapping module 4652 is further configured to determine a rendered texture image for texture baking; and draw the plurality of texture images to the rendered texture image through the baking material to obtain the rendered target texture image.
[0192] In some embodiments, the first mapping module 4652 is further configured to determine the rendering precision of the virtual object to be rendered; query a configuration file based on the rendering precision of the virtual object to be rendered, and obtain a rendered texture image with a size corresponding to the rendering precision of the virtual object to be rendered; wherein, the configuration file includes the association relationship between different rendering precisions and different sizes of rendered texture images.
[0193] In some embodiments, the first mapping module 4652 is further configured to obtain graphics processing performance parameters for image rendering; query a performance parameter configuration file based on the graphics processing performance parameters, and obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters; wherein, the performance parameter configuration file includes the association relationship between different graphics processing performance parameters and different rendering precisions.
[0194] In some embodiments, the graphics processing performance parameters include graphics processing hardware parameters, and the performance parameter configuration file includes the association relationship between different graphics processing hardware parameters and different rendering precisions; the first mapping module 4652 is further configured to query the performance parameter configuration file based on the graphics processing hardware parameters before the virtual scene runs to an end, and obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters; wherein, the graphics processing hardware parameters are queried according to the model of the electronic device for displaying the rendered virtual object, and include at least one of the following: processor model, memory capacity.
[0195] In some embodiments, the graphics processing performance parameters include graphics processing software parameters, and the performance parameter configuration file includes the association relationship between different graphics processing software parameters and different rendering precisions; the first mapping module 4652 is further configured to query the performance parameter configuration file based on the graphics processing software parameters during the running of the virtual scene, and obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing software parameters during the running of the virtual scene; wherein, the graphics processing software parameters include at least one of the following: free memory capacity, idle computing power of the processor.
[0196] In some embodiments, the texture images corresponding to at least one part include a base color texture image, a normal texture image, and a roughness texture image; the first mapping module 4652 is further configured to perform the following processing on the texture images corresponding to at least one part: perform texture mapping processing on the base color texture image to obtain a rendered target texture image including base color texture parameters; perform texture mapping processing on the normal texture image to obtain a rendered target texture image including normal texture parameters; perform texture mapping processing on the roughness texture image to obtain a rendered target texture image including roughness texture parameters; the second mapping module 4653 is further configured to map the rendered target texture image including base color texture parameters, the rendered target texture image including normal texture parameters, and the rendered target texture image including roughness texture parameters into a rendering material to obtain a mapped rendering material.
[0197] In some embodiments, the obtaining module 4651 is further configured to obtain multiple texture images of the virtual object to be rendered from a cache space; after performing texture mapping processing on the multiple texture images to obtain a rendered target texture image, release the multiple texture images of the virtual object to be rendered from the cache space.
[0198] In some embodiments, the obtaining module 4651 is further configured to display multiple candidate display information, where the candidate display information is used to decorate at least one part of the virtual object to be rendered; in response to a selection operation on the multiple candidate display information, use the selected candidate display information as target display information; use the texture image corresponding to the target display information as the texture image of the virtual object to be rendered.
[0199] In some embodiments, the device further includes: a processing module 4655, configured to, when the display period of the rendered virtual object arrives, perform inverse mapping processing on the mapped rendering material to obtain the rendered target texture image; store the rendered target texture image in a storage space; where the rendered target texture image is used to be read from the storage space when subsequently mapping the rendered target texture image.
[0200] An embodiment of the present application provides a computer program product or a computer program, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the image rendering method described above in the embodiments of the present application.
[0201] An embodiment of the present application provides a computer-readable storage medium storing executable instructions, where the executable instructions, when executed by a processor, cause the processor to execute the image rendering method provided by the embodiment of the present application. For example, as Figures 3 - 5 shown in the image rendering method.
[0202] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface memory, optical disc, or CD-ROM; or may be various devices including one or any combination of the above memories.
[0203] In some embodiments, the executable instructions may be in the form of a program, software, software module, script, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including being deployed as an independent program or being deployed as a module, component, subroutine, or other unit suitable for use in a computing environment.
[0204] As an example, the executable instructions may or may not correspond to a file in the file system, and may be stored as part of a file storing other programs or data. For example, stored in one or more scripts in a Hyper Text Markup Language (HTML) document, stored in a single file dedicated to the program under discussion, or stored in multiple cooperating files (for example, files storing one or more modules, subroutines, or code portions).
[0205] As an example, the executable instructions may be deployed to execute on one computing device, or on multiple computing devices located at one location, or on multiple computing devices distributed at multiple locations and interconnected by a communication network.
[0206] As described above, the above are only embodiments of the present application and are not intended to limit the protection scope of the present application. Any modifications, equivalent replacements, and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.
Claims
1. An image rendering method, characterized in that, The method includes: Obtaining a plurality of texture images of a virtual object to be rendered from a cache space, where each of the texture images corresponds to at least one part of the virtual object to be rendered; Based on the plurality of texture images, determining texture parameters, and filling the plurality of texture images into a baking material according to the texture parameters to obtain a baking material including the texture parameters; Performing texture baking processing on the plurality of texture images through the baking material to obtain a rendered target texture image, and releasing the plurality of texture images from the cache space; Mapping the rendered target texture image into a rendering material to obtain a mapped rendering material; Performing image rendering processing on at least one part of the virtual object to be rendered based on the mapped rendering material to obtain a rendered virtual object.
2. The method according to claim 1, wherein: The baking material includes a plurality of texture units; The step of filling the plurality of texture images into a baking material to obtain a baking material including the texture parameters includes: Filling the plurality of texture images into corresponding texture units in the baking material to obtain a baking material including the texture parameters; Wherein, at least one of the texture images is filled in the texture unit.
3. The method according to claim 1, characterized in that, The step of performing texture baking processing on the plurality of texture images to obtain a rendered target texture image includes: Determining a rendering texture image for texture baking; Drawing the plurality of texture images onto the rendering texture image through the baking material to obtain the rendered target texture image.
4. The method according to claim 3, characterized in that, The step of determining a rendering texture image for texture baking includes: Determining the rendering precision of the virtual object to be rendered; Querying a configuration file based on the rendering precision of the virtual object to be rendered to obtain a rendering texture image with a size corresponding to the rendering precision of the virtual object to be rendered; Wherein, the configuration file includes an association relationship between different rendering precisions and rendering texture images of different sizes.
5. The method according to claim 4, characterized in that, The step of determining the rendering precision of the virtual object to be rendered includes: Obtaining graphics processing performance parameters for image rendering; Querying a performance parameter configuration file based on the graphics processing performance parameters to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters; Wherein, the performance parameter configuration file includes an association relationship between different graphics processing performance parameters and different rendering precisions.
6. The method according to claim 5, wherein: The graphics processing performance parameters include graphics processing hardware parameters, and the performance parameter configuration file includes an association relationship between different graphics processing hardware parameters and different rendering precisions; The step of querying a performance parameter configuration file based on the graphics processing performance parameters to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters includes: Before the end of the virtual scene operation, querying the performance parameter configuration file based on the graphics processing hardware parameters to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters; Among them, the graphics processing hardware parameters are queried according to the model of the electronic device that displays the rendered virtual object, and include at least one of the following: processor model, memory capacity.
7. The method according to claim 5, wherein the graphics processing performance parameters include graphics processing software parameters, and the performance parameter profile includes the association relationship between different graphics processing software parameters and different rendering precisions; the querying the performance parameter profile based on the graphics processing performance parameters to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing performance parameters includes: querying the performance parameter profile based on the graphics processing software parameters during the operation of the virtual scene to obtain the rendering precision of the virtual object to be rendered corresponding to the graphics processing software parameters during the operation of the virtual scene; wherein, the graphics processing software parameters include at least one of the following: free memory capacity, idle computing power of the processor.
8. The method according to claim 1, wherein when the texture images corresponding to at least one part include a base color texture image, a normal texture image, and a roughness texture image, the method further includes: performing the following processing on the texture images corresponding to at least one part: performing texture mapping processing on the base color texture image to obtain a rendered target texture image including base color texture parameters; performing texture mapping processing on the normal texture image to obtain a rendered target texture image including normal texture parameters; performing texture mapping processing on the roughness texture image to obtain a rendered target texture image including roughness texture parameters; the mapping the rendered target texture image into a rendering material to obtain the mapped rendering material includes: mapping the rendered target texture image including base color texture parameters, the rendered target texture image including normal texture parameters, and the rendered target texture image including roughness texture parameters into a rendering material to obtain the mapped rendering material.
9. The method according to claim 1, wherein The obtaining the multiple texture images of the virtual object to be rendered from the cache space includes: displaying a plurality of candidate display information, wherein the candidate display information is used to decorate at least one part of the virtual object to be rendered; responding to a selection operation on the plurality of candidate display information, and taking the selected candidate display information as the target display information; taking the texture image corresponding to the target display information in the cache space as the texture image of the virtual object to be rendered.
10. The method according to claim 1, wherein The method further includes: when the display period of the rendered virtual object arrives, performing inverse mapping processing on the mapped rendering material to obtain the rendered target texture image; storing the rendered target texture image in a storage space; wherein the rendered target texture image is used to be read from the storage space when subsequently mapping the rendered target texture image.
11. An image rendering device, characterized in that, The device includes: an obtaining module, configured to obtain multiple texture images of a virtual object to be rendered from a cache space, wherein each texture image corresponds to at least one part of the virtual object to be rendered; The first mapping module is configured to determine texture parameters based on the multiple texture images; fill the multiple texture images into a baking material according to the texture parameters to obtain a baking material including the texture parameters; perform texture baking processing on the multiple texture images through the baking material to obtain a rendered target texture image, and release the multiple texture images from the cache space; The second mapping module is configured to map the rendered target texture image into a rendering material to obtain a mapped rendering material; The rendering module is configured to perform image rendering processing on at least one part of the virtual object to be rendered based on the mapped rendering material to obtain a rendered virtual object.
12. An electronic device, characterized in that, The electronic device includes: A memory for storing executable instructions; A processor, when executing the executable instructions stored in the memory, implements the image rendering method according to any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, Stored with executable instructions, which when executed by a processor implement the image rendering method according to any one of claims 1 to 10.
14. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, the image rendering method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Virtual model rendering method and device, storage medium and electronic equipment
CN111583379A