Method, device and storage medium for generating target object based on virtual three-dimensional model
By controlling a virtual camera to capture images of a virtual 3D model from multiple directions within a virtual scene, acquiring and offsetting positional information to determine the target volume area, and directly generating volumetric rendering objects within the game engine, the problems of high resource consumption, low efficiency, and poor visual effects in existing technologies are solved, achieving efficient rendering and good visual performance.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-03-08
- Publication Date
- 2026-06-09
AI Technical Summary
In existing technologies, generating virtual objects with volume effects requires the use of third-party software or plugins, which results in high resource consumption, low efficiency, and poor visual performance during the rendering process, and makes it impossible to achieve a gradual transition from the center to the edge of the volume.
By controlling a virtual camera to capture images of a virtual 3D model from multiple directions, world location information is obtained. After offset processing, the target volume region is determined, and a volumetric space rendering object is generated within that region. The target object is then generated directly using the game engine.
It improves the generation efficiency and visual performance of volumetric space rendering objects, while reducing rendering resource consumption, thus solving the problems of high resource consumption and low efficiency caused by relying on third-party software or plugins.
Smart Images

Figure CN116342841B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a method, apparatus, and storage medium for generating target objects based on virtual 3D models. Background Technology
[0002] In virtual scenes, rendering virtual objects with volumetric effects is one of the important methods to enhance scene performance. For example, virtual clouds with volumetric effects (also known as volumetric clouds) can enhance the weather or sky effects in virtual scenes.
[0003] In related technologies, technicians typically create virtual objects with different volume shapes using noise maps of varying forms. For example, a virtual model is imported into 3D computer graphics software (such as Houdini) to convert it into volume data and output as a volume map. This volume map is then imported into a game engine (such as Unreal Engine, UE) to generate a corresponding volumetric cloud. Another example is using existing plugins to convert the model into a volume map and then importing it into the game engine to generate a corresponding volumetric cloud. However, the drawbacks of these methods are: they require third-party software or plugins to generate volume maps to support the game engine in generating corresponding virtual objects; each virtual model corresponds to one volume map, so multiple volume maps are needed when generating virtual objects with volume effects for multiple models; when adjusting the shape of a virtual object, the virtual model must be adjusted first, then the volume map must be regenerated using third-party software or plugins, and finally the game engine must be used to generate the adjusted virtual object again, resulting in a complex process and low modification efficiency; the generated virtual objects cannot achieve a smooth transition from the center to the edge of the volume, resulting in poor visual effects.
[0004] There is currently no effective solution to the above problems.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this application, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] At least some embodiments of this application provide a method, apparatus and storage medium for generating target objects based on virtual 3D models, so as to at least solve the technical problems in the related art that the generation of volume space rendering objects by volume textures generated by third-party software or plug-ins results in high resource consumption, low efficiency and poor visual performance of rendering results.
[0007] According to one embodiment of this application, a method for generating a target object based on a virtual 3D model is provided, comprising: controlling a virtual camera set in a virtual scene to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to multiple directions, wherein the multiple directions include multiple sets of relative directions, and the information carried in the target images includes: first-world position information; performing offset processing on the first-world position information corresponding to the multiple directions to obtain second-world position information corresponding to the multiple directions; obtaining a target volume region based on the second-world position information corresponding to the multiple directions, wherein the target volume region is a volume region that matches the virtual 3D model; and generating a target object using the target volume region, wherein the target object is a volume space rendering object.
[0008] According to one embodiment of this application, an apparatus for generating a target object based on a virtual 3D model is also provided, comprising: a shooting module for controlling a virtual camera set in a virtual scene to shoot the virtual 3D model from multiple directions to obtain target images corresponding to multiple directions, wherein the multiple directions include multiple sets of relative directions, and the information carried in the target images includes: first-world position information; an offset module for offsetting the first-world position information corresponding to multiple directions to obtain second-world position information corresponding to multiple directions; an acquisition module for acquiring a target volume region based on the second-world position information corresponding to multiple directions, wherein the target volume region is a volume region that matches the virtual 3D model; and a generation module for generating a target object using the target volume region, wherein the target object is a volume space rendering object.
[0009] According to one embodiment of this application, a computer-readable storage medium is also provided, in which a computer program is stored, wherein the computer program is configured to execute the method for generating a target object based on a virtual three-dimensional model as described above when running.
[0010] According to one embodiment of this application, an electronic device is also provided, comprising: a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to perform the method for generating a target object based on a virtual three-dimensional model as described above.
[0011] In at least some embodiments of this application, a virtual camera set in a virtual scene is controlled to capture images of a virtual 3D model from multiple directions, obtaining target images corresponding to multiple directions respectively. These multiple directions include multiple sets of relative directions. The information carried in the target images includes first-world position information. Then, the first-world position information corresponding to the multiple directions is offset to obtain second-world position information corresponding to the multiple directions. Further, based on the second-world position information corresponding to the multiple directions, a target volume region is obtained, where the target volume region is a volume region that matches the virtual 3D model. A target object is generated using the target volume region, where the target object is a volumetric space rendering object. Thus, this application achieves the goal of determining a target volume region based on the world position information of the virtual 3D model in multiple directions and generating a volumetric space rendering object within that target volume region. This achieves the technical effect of improving the generation efficiency and visual performance of volumetric space rendering objects while reducing rendering resource consumption. It also solves the technical problems in related technologies where the generation of volumetric space rendering objects based on volumetric textures generated by third-party software or plugins results in high resource consumption, low efficiency, and poor visual performance of the rendering results. Attached Figure Description
[0012] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0013] Figure 1 This is a schematic diagram of a volumetric cloud rendering effect based on existing technology;
[0014] Figure 2 This is a schematic diagram of a volumetric texture based on existing technology;
[0015] Figure 3 This is a schematic diagram illustrating the rendering effect of a virtual head volume model based on existing technology;
[0016] Figure 4 This is a schematic diagram of another volumetric texture based on existing technology;
[0017] Figure 5 This is a hardware structure block diagram of a mobile terminal according to one embodiment of the present application of a method for generating target objects based on a virtual three-dimensional model;
[0018] Figure 6 This is a flowchart of a method for generating a target object based on a virtual 3D model according to one embodiment of this application;
[0019] Figure 7This is a schematic diagram of the distribution of an optional virtual camera in world space according to one embodiment of this application;
[0020] Figure 8 This is a schematic diagram of an optional target image according to one embodiment of this application;
[0021] Figure 9 This is a schematic diagram of another optional target image according to one embodiment of this application;
[0022] Figure 10 This is a schematic diagram of first-world position information of an optional sphere model according to one embodiment of this application;
[0023] Figure 11 This is a schematic diagram of second-world location information for an optional sphere model according to one embodiment of this application;
[0024] Figure 12 This is a schematic diagram of second-world location information for another optional sphere model according to one embodiment of this application;
[0025] Figure 13 This is a schematic diagram of an optional inversion result according to one embodiment of this application;
[0026] Figure 14 This is a schematic diagram of an optional calculation result according to one embodiment of this application;
[0027] Figure 15 This is a schematic diagram of an optional processing result according to one embodiment of this application;
[0028] Figure 16 This is a schematic diagram of the second-world location information of another optional sphere model according to one embodiment of this application;
[0029] Figure 17 This is a schematic diagram of the second-world location information of another optional sphere model according to one embodiment of this application;
[0030] Figure 18 This is a schematic diagram of a gradient region corresponding to an optional sphere model according to one embodiment of this application;
[0031] Figure 19 This is a schematic diagram of the gradient result corresponding to an optional sphere model according to one embodiment of this application;
[0032] Figure 20 This is a schematic diagram of the gradient result corresponding to another optional sphere model according to one embodiment of this application;
[0033] Figure 21This is a schematic diagram of the gradient result corresponding to another optional sphere model according to one embodiment of this application;
[0034] Figure 22 This is a schematic diagram of an optional first volume parameter adjustment area according to one embodiment of this application;
[0035] Figure 23 This is a schematic diagram of an optional second volume parameter adjustment area according to one embodiment of this application;
[0036] Figure 24 This is a schematic diagram of an optional linear interpolation process according to one embodiment of this application;
[0037] Figure 25 This is a schematic diagram of an optional virtual three-dimensional model according to one embodiment of this application;
[0038] Figure 26 This is a schematic diagram of the distribution of another optional virtual camera in world space according to one embodiment of this application;
[0039] Figure 27 This is a schematic diagram of another optional target image according to one embodiment of this application;
[0040] Figure 28 This is a schematic diagram of another optional target image according to one embodiment of this application;
[0041] Figure 29 This is a schematic diagram of an optional first volume region determination process according to one embodiment of this application;
[0042] Figure 30 This is a schematic diagram of an optional target volume region determination process according to one embodiment of this application;
[0043] Figure 31 This is a schematic diagram of an optional process for generating a target object based on a linear interpolation method according to one embodiment of this application;
[0044] Figure 32 This is a schematic diagram of an optional target object according to one embodiment of this application;
[0045] Figure 33 This is a schematic diagram of another optional target object according to one embodiment of this application;
[0046] Figure 34 This is a schematic diagram of another optional target object according to one embodiment of this application;
[0047] Figure 35This is a structural block diagram of an apparatus for generating target objects based on a virtual three-dimensional model according to one embodiment of this application;
[0048] Figure 36 This is a structural block diagram of an optional apparatus for generating target objects based on a virtual 3D model according to one embodiment of this application;
[0049] Figure 37 This is a structural block diagram of another optional apparatus for generating target objects based on a virtual 3D model according to one embodiment of this application;
[0050] Figure 38 This is a structural block diagram of another optional apparatus for generating target objects based on a virtual three-dimensional model according to one embodiment of this application;
[0051] Figure 39 This is a schematic diagram of an electronic device according to one embodiment of the present application. Detailed Implementation
[0052] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0053] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0054] It should be noted that, in the specification of this application, the word "for example" is used to mean "used as an example, illustration, or description." Any embodiment described as "for example" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. In the following description, details are set forth for purposes of explanation. It should be understood that those skilled in the art will recognize that this application can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid unnecessarily obscuring the description of this application. Therefore, this application is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.
[0055] In the description of the embodiments of this application, some nouns or terms appearing shall be interpreted as follows:
[0056] Volumetric textures are textures that are arranged and displayed sequentially as a series of frames, showing different facets of a 3D model. A volumetric texture is actually still a 2D texture.
[0057] In virtual scenes, rendering virtual objects with volumetric effects is one of the important methods to enhance scene performance. For example, virtual clouds with volumetric effects (also known as volumetric clouds) can enhance the weather or sky effects in virtual scenes.
[0058] In related technologies, technicians typically employ the following two methods to render virtual objects with volumetric effects in virtual scenes.
[0059] The first method involves importing the virtual model into 3D computer graphics software (such as Houdini) to convert it into volume data and output it as a volume texture. Then, the volume screenshot is imported into a game engine (such as UE) to generate a volume cloud of the corresponding shape. Figure 1 This is a schematic diagram of a volumetric cloud rendering effect based on existing technology. Figure 2 This is a schematic diagram of a volumetric texture based on existing technology, which will be as follows: Figure 1 The virtual dolphin model shown above is imported into Houdini, converted into volumetric data in Houdini, and output as follows. Figure 2 The volumetric texture shown, then... Figure 2 Import the volumetric texture shown into the UE to generate a texture like this. Figure 1 The volumetric cloud in the shape of a dolphin is shown below.
[0060] The second method involves using existing plugins to convert the model into a volumetric texture and then importing it into the game engine to generate a volumetric cloud of the corresponding shape. Figure 3 This is a schematic diagram illustrating the rendering effect of a virtual head volume model based on existing technology. Figure 4This is a schematic diagram of another volumetric texture based on existing technology, using existing plugins to achieve the following: Figure 3 The virtual head model shown (left) is converted to... Figure 4 The volumetric texture shown will then be applied as follows: Figure 4 Import the volumetric texture shown into the UE to generate a texture like this. Figure 3 The virtual head volume model shown on the right.
[0061] However, the two methods provided by the relevant technologies have the following drawbacks: they require the use of third-party software or plugins to generate volumetric textures, which then support the game engine in generating corresponding virtual objects; each virtual model corresponds to one volumetric texture, and when multiple models need to be generated to create virtual objects with volumetric effects, multiple volumetric textures need to be created; when the shape of the virtual object needs to be adjusted, the virtual model needs to be adjusted first, and then the volumetric texture needs to be regenerated using third-party software or third-party illustrations, and then the game engine needs to be used to generate the adjusted virtual object again, which is a complex process with low modification efficiency; the generated virtual objects cannot achieve a gradual transition from the center of the volume to the edge of the volume, resulting in poor visual effects.
[0062] In one possible implementation of this application, the inventors, after practice and careful research, found that the commonly used method in computer technology and computer graphics fields, which involves generating volumetric rendering objects based on virtual 3D models and then importing them into a game engine to generate target objects, still suffers from technical problems such as high resource consumption, low efficiency, and poor visual performance of the rendering results. Therefore, the application scenarios of this application can be virtual exhibition halls, virtual conference rooms, and virtual game scenes that require rendering volumetric rendering objects (such as volumetric clouds, volumetric smoke, volumetric props, etc.), especially video game scenes that require volumetric rendering objects to enhance the visual performance of the sky or weather. The game type targeted by this video game scene can be action, adventure, simulation, role-playing, and casual games, etc.
[0063] This application proposes a method for generating target objects based on virtual 3D models. It adopts the technical concept of determining the target volume region based on the world position information of the virtual 3D model in multiple directions and generating a volumetric space rendering object within the target volume region. This achieves the technical effect of improving the generation efficiency and visual performance of volumetric space rendering objects while reducing rendering resource consumption. It solves the technical problem in related technologies that the generation of volumetric space rendering objects by relying on volumetric textures generated by third-party software or plugins results in high resource consumption, low efficiency, and poor visual performance of rendering results.
[0064] The methods described in this application can be executed in a terminal device (e.g., a mobile terminal, a computer terminal, or a similar computing device). Taking a mobile terminal as an example, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, game console, or other terminal device.
[0065] Figure 5 This is a hardware structure block diagram of a mobile terminal according to one embodiment of the present application, which describes a method for generating a target object based on a virtual 3D model. Figure 5 As shown, a mobile terminal may include one or more ( Figure 5 (Only one is shown) Processor 502, memory 504, transmission device 506, input / output device 508, and display device 510. Taking the method of generating target objects based on virtual 3D models and applying it to a video game scene through this mobile terminal as an example, processor 502 calls and runs the computer program stored in memory 504 to execute the method of generating target objects based on virtual 3D models. The generated volumetric space rendering object in the video game scene is transmitted to input / output device 508 and / or display device 510 through transmission device 506, and then the volumetric space rendering object is provided to the player.
[0066] Still as Figure 5 As shown, processor 502 may include, but is not limited to, processing devices such as: central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), field programmable gate array (FPGA), neural network processing unit (NPU), tensor processing unit (TPU), artificial intelligence (AI) type processor, etc.
[0067] Those skilled in the art will understand that Figure 5 The structure shown is for illustrative purposes only and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may also include components that are more... Figure 5 The more or fewer components shown, or having the same Figure 5 The different configurations shown.
[0068] In some optional embodiments primarily focused on gaming scenarios, the aforementioned terminal device may also provide a human-computer interaction interface with a touch-sensitive surface. This interface can sense finger contact and / or gestures to interact with a graphical user interface (GUI). The human-computer interaction functions may include the following: creating web pages, drawing, word processing, creating electronic documents, playing games, video conferencing, instant messaging, sending and receiving emails, call interfaces, playing digital videos, playing digital music, and / or web browsing, etc. Executable instructions for performing the aforementioned human-computer interaction functions are configured / stored in one or more processor-executable computer program products or readable storage media.
[0069] The methods described in this application can also be executed on a server. The server can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. Taking the method of generating target objects based on virtual 3D models applied to a video game scene via a video game server as an example, the video game server can generate a volumetric space rendering object in the video game scene based on this method and provide the volumetric space rendering object to the player (e.g., it can be rendered and displayed on the player's terminal screen, or provided to the player through holographic projection, etc.).
[0070] According to one embodiment of this application, an embodiment of a method for generating a target object based on a virtual three-dimensional model is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0071] This embodiment provides a method for generating target objects based on a virtual 3D model, which runs on the aforementioned mobile terminal. Figure 6 This is a flowchart illustrating a method for generating a target object based on a virtual 3D model according to one embodiment of this application, such as... Figure 6 As shown, the method includes the following steps:
[0072] Step S61: Control the virtual camera set in the virtual scene to take pictures of the virtual 3D model from multiple directions to obtain target images corresponding to multiple directions. The multiple directions include multiple sets of relative directions. The information carried in the target images includes: first-world location information.
[0073] The aforementioned virtual scene can be a video game scene involving the generation of volumetric space rendering objects. The game type corresponding to this video game scene can be: action games (e.g., first-person or third-person shooter games, 2D or 3D fighting games, war action games, and sports action games), adventure games (e.g., exploration games, collection games, puzzle games), simulation games (e.g., sandbox simulation games, simulation games, strategy simulation games, city building simulation games, business simulation games), role-playing games, and casual games (e.g., board games, casual competitive games, music rhythm games, dress-up simulation games, etc.).
[0074] The aforementioned virtual 3D model is the original 3D model corresponding to the volumetric space rendering object to be generated in the aforementioned virtual scene. For example, when generating a "cat-shaped" volumetric cloud in a video game scene, the aforementioned virtual 3D model can be a 3D virtual cat model pre-made by the artist as the prototype of the "cat-shaped" volumetric cloud.
[0075] The aforementioned virtual camera can be at least one pre-set virtual camera used to capture virtual 3D models. The aforementioned multiple directions include multiple sets of relative directions, where each set of relative directions includes two opposite directions on the same straight line. For example, the aforementioned multiple sets of relative directions could be three sets of relative directions in 3D space: the positive and negative X-axis directions, the positive and negative Y-axis directions, and the positive and negative Z-axis directions.
[0076] In step S61 above, the specific implementation of controlling a virtual camera set in the virtual scene to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to each direction can be: controlling one virtual camera set in the virtual scene to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to each direction in the multiple directions; or controlling multiple virtual cameras set in the virtual scene to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to each direction in the multiple directions, wherein the shooting direction of each virtual camera in the multiple virtual cameras corresponds to each of the multiple directions.
[0077] The target images corresponding to the aforementioned multiple directions each carry the first world position information of the aforementioned virtual 3D model. Specifically, the target image corresponding to each direction carries the first world position information of the aforementioned virtual 3D model captured from that direction, wherein the first world position information includes the initial position coordinates of the model vertices of the virtual 3D model in the world space coordinate system.
[0078] Step S62: Offset the first world position information corresponding to multiple directions to obtain the second world position information corresponding to multiple directions.
[0079] In step S62 above, the first world positions corresponding to the above multiple directions are offset according to the preset offset rules to obtain the second world position information corresponding to the above multiple directions. The preset offset rules are the world position offset rules corresponding to the current application scenario requirements, and the second world position information is the world position information of the virtual three-dimensional model after offset processing. The second world position information is used to determine the volume area to be rendered of the volume space rendering object corresponding to the virtual three-dimensional model.
[0080] Specifically, the first-world position information corresponding to the aforementioned multiple directions is offset, that is, the first-world position information carried by the target image corresponding to each direction is offset to obtain the aforementioned second-world position information corresponding to that direction. The offset processing of the first-world position information can be performed by using an offset calculation method to calculate the offset of the initial position coordinates of the model vertices of the virtual 3D model in the first-world position information, thereby obtaining the offset position coordinates of the model vertices of the virtual 3D model.
[0081] Specifically, the above-mentioned offset processing of the first world position information corresponding to multiple directions to obtain the second world position information may also include other methods and steps, which can be referred to in the further description of the embodiments of this application below, and will not be repeated here.
[0082] Step S63: Based on the second-world position information corresponding to multiple directions, obtain the target volume region, wherein the target volume region is the volume region that matches the virtual 3D model;
[0083] In step S63 above, based on the second world position information corresponding to the above multiple directions, a target volume region matching the above virtual model is obtained. That is, based on the second world position information obtained by offset processing of the virtual three-dimensional model in each direction, a volume region matching the virtual three-dimensional model is determined according to the matching rules. The matching rules are used to describe the matching conditions between the volume region and the virtual three-dimensional model. The volume region is the volume region to be rendered of the volume space rendering object corresponding to the virtual three-dimensional model.
[0084] Specifically, the above-mentioned acquisition of the target volume region based on the second world location information corresponding to multiple directions may also include other methods and steps, which can be referred to in the further description of the embodiments of this application below, and will not be repeated here.
[0085] Step S64: Generate a target object using the target volume region, wherein the target object is a volume space rendering object.
[0086] In step S64 above, a volumetric space rendering object (i.e., the target object) corresponding to the virtual 3D model is generated using the target volume region. The process of generating the target object can be completed by a game engine (such as UE). It is readily apparent that the method provided in this application determines the target volume region corresponding to the volumetric space rendering object and then directly generates the volumetric space rendering object using a game engine. This process does not rely on volumetric textures of the virtual 3D model generated by third-party software or plugins.
[0087] Specifically, the above-mentioned method of generating a target object using a target volume region may also include other methods and steps, which can be referred to in the further description of the embodiments of this application below, and will not be repeated here.
[0088] According to steps S61 to S64 of the embodiments of this application, a virtual camera set in a virtual scene is controlled to capture images of a virtual 3D model from multiple directions to obtain target images corresponding to multiple directions. The multiple directions include multiple sets of relative directions, and the information carried in the target images includes first-world position information. Then, the first-world position information corresponding to the multiple directions is offset to obtain second-world position information corresponding to the multiple directions. Further, based on the second-world position information corresponding to the multiple directions, a target volume region is obtained, where the target volume region is a volume region that matches the virtual 3D model. A target object is generated using the target volume region, where the target object is a volumetric space rendering object. Thus, this application achieves the goal of determining a target volume region based on the world position information of the virtual 3D model in multiple directions and generating a volumetric space rendering object within that target volume region. This achieves the technical effect of improving the generation efficiency and visual performance of volumetric space rendering objects while reducing rendering resource consumption. It also solves the technical problem in related technologies where the generation of volumetric space rendering objects based on volumetric textures generated by third-party software or plugins results in high resource consumption, low efficiency, and poor visual performance of the rendering results.
[0089] The methods described in the embodiments of this application will be further described below.
[0090] Optionally, in the above method for generating target objects based on virtual 3D models, the target object includes: volumetric cloud.
[0091] In one alternative implementation, the volumetric cloud described above can be a cloud model with volumetric effects in a video game scene, virtual exhibition hall, or virtual live streaming room. The shape of the volumetric cloud can be specified by technicians according to scene requirements or determined according to scene constraints.
[0092] Optionally, in the above method for generating target objects based on virtual 3D models, the line of sight of the virtual camera is focused on the same world position in multiple directions, the shooting mode of the virtual camera adopts orthogonal view mode, and the target image adopts a preset frame size.
[0093] In the above optional embodiments, in order to ensure that the virtual camera can acquire target images of the same size in the above multiple directions so as to determine the target volume region based on the target image, the virtual camera created in the virtual scene needs to meet the following two conditions.
[0094] Condition 1: The virtual camera's line of sight must be focused on the same world location in multiple directions. If a single virtual camera is used to capture images of a virtual 3D model from multiple directions, it must be ensured that the virtual camera's line of sight is focused on the same world location in each of the multiple directions. If multiple virtual cameras are used to capture images of a virtual 3D model from multiple directions, it must be ensured that the line of sight of each of the multiple virtual cameras is focused on the same world location.
[0095] For example, Figure 7 This is a schematic diagram of the distribution of an optional virtual camera in world space according to one embodiment of this application, such as... Figure 7 As shown, a virtual camera is created in each of the positive and negative directions of the X, Y, and Z axes: the positions of the two virtual cameras on the X-axis are (1000,0,0) and (-1000,0,0), respectively; the positions of the two virtual cameras on the Y-axis are (0,1000,0) and (0,-1000,0), respectively; and the positions of the two virtual cameras on the Z-axis are (0,0,1000) and (0,0,-1000), respectively. All six virtual cameras face the world center point (0,0,0), meaning that the lines of sight of the six virtual cameras are focused on the world center point (0,0,0).
[0096] It should be noted that in the above example, 1000 and -1000 are used to ensure that the distribution of virtual cameras is symmetrical in all directions. In application scenarios, this can be uniformly adjusted according to the model size. In particular, when the position of the virtual cameras needs to be moved, each virtual camera should be adaptively adjusted simultaneously to meet condition 1 above.
[0097] Condition 2: All virtual cameras use orthographic shooting mode, and the target image uses a preset aspect ratio. To ensure that the target images captured by the virtual cameras are of consistent size and to avoid perspective effects, the shooting mode of each virtual camera is set to orthographic, and the orthographic width of each virtual camera is set to a uniform preset aspect ratio (e.g., 256×256). The orthographic model refers to the shooting direction of each virtual camera being consistent with one of the coordinate axes of the model space (i.e., one of +X, -X, +Y, -Y, +Z, and -Z).
[0098] It should be noted that, to further ensure that the captured target image can be displayed at the usual display size, the preset image size (e.g., 256cm × 256cm) is transformed to the screen UV space size. The display size of the screen UV space is U(0,1) and V(0,1), both in cm. Therefore, the preset image size corresponding to the target image is divided by 256 for display.
[0099] Optionally, the above method for generating target objects based on virtual 3D models may further include the following execution steps:
[0100] Step S651: Create a target material, wherein the material mode of the target material is set to an unlit material, and the emission color attribute of the target material is used to record first-world location information;
[0101] Step S652: Assign the target material to the virtual 3D model.
[0102] In the above optional embodiments, the material mode of the created target material is an unlit material, and the emissive color attribute of the target material is used to record the first world location information. That is to say, the target material is a material with world location information.
[0103] For example, the aforementioned first-world location information includes the X, Y, and Z coordinates of a point in the world space coordinate system (the origin coordinates are X=0, Y=0, Z=0, in cm). In the game engine, this first-world location information is linked to the glow color attribute of the target material, where the R, G, and B values of the glow color represent the X, Y, and Z coordinates in world space, respectively.
[0104] Taking the generation of a spherical volumetric cloud in a video game scene as an example, the specific implementation of assigning the above target material to the above virtual 3D model can be as follows: Use the game engine to create a spherical model (equivalent to the above virtual 3D model), place the center of the sphere model at the origin of the world space coordinate system (i.e., X=0, Y=0, Z=0), assign the above target material to the sphere model, then the R, G, and B values of the luminous color of the sphere model can respectively represent the X, Y, and Z coordinates of the sphere model in world space.
[0105] Optionally, in step S61, controlling a virtual camera set in the virtual scene to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to each direction may include the following execution steps:
[0106] Step S611: Set the virtual 3D model as the capture object of the virtual camera, and set the remaining display objects in the virtual scene other than the virtual 3D model to a hidden state to obtain the setting result;
[0107] Step S612: Based on the settings, control the virtual camera to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to each direction.
[0108] Continuing with the example of generating a spherical volumetric cloud in a video game scene, considering the symmetry of the spherical volumetric cloud, this example uses two virtual cameras, one in the positive X direction and one in the negative X direction. The virtual camera in the positive X direction is denoted as SceneCapture2D_+X, and the virtual camera in the negative X direction is denoted as SceneCapture2D_-X. According to step S611 above, the virtual cameras SceneCapture2D_+X and SceneCapture2D_-X are configured as follows: the spherical model is set as the capture object of these two virtual cameras, and other display objects in the virtual scene besides the spherical model (such as other object models, sky models, etc.) are set to a hidden state. It is easy to understand that through the above virtual camera settings, interference from other display objects in the virtual scene can be eliminated when capturing the spherical model.
[0109] Based on the settings of the virtual cameras SceneCapture2D_+X and SceneCapture2D_-X, control the two virtual cameras to capture images of the sphere model, obtaining target images in the positive X direction and the negative X direction, denoted as P1_+X and P1_-X respectively.
[0110] Figure 8 This is a schematic diagram of an optional target image according to one embodiment of this application, such as... Figure 8As shown, the target image P1_+X (left) and the target image P1_-X (right) captured by the virtual camera SceneCapture2D_+X on the sphere model are both circles with different display colors according to their X, Y, and Z coordinates. Figure 8 As shown, the RGB values of the displayed color are denoted as (R,G,B). For example, in the first quadrant of the world space coordinate system corresponding to the target image P1_+X (left), the displayed color is white (255,255,255).
[0111] Figure 9 This is a schematic diagram of another optional target image according to one embodiment of this application. Because, as... Figure 8 The target images P1_+X (left) and P1_-X (right) shown are both images captured by a virtual camera along the X-axis. Therefore, by taking the X-axis values of the corresponding coordinates of target images P1_+X and P1_-X (that is, setting the Y and Z coordinates to 0), we obtain the following: Figure 9 The target images shown are denoted as P2_+X and P2_-X. For ease of display, the absolute values of the negative coordinates in the target image P2_-X are taken and displayed as shown below. Figure 9 As shown on the right.
[0112] Optionally, in step S611, setting the virtual 3D model as the capture object of the virtual camera may include the following steps:
[0113] Step S6111: Create a first blueprint node and a second blueprint node within the preset game engine. The first blueprint node is used to distinguish different virtual 3D models in the virtual scene, and the second blueprint node is used to capture the target image.
[0114] Step S6112: Use the second blueprint node to traverse the first blueprint nodes corresponding to different virtual 3D models in the virtual scene, and add the traversed first blueprint nodes to the display list corresponding to the virtual camera.
[0115] Step S6113: Based on the display list, set the virtual 3D model as the capture object of the virtual camera.
[0116] In the above optional embodiments, the first Blueprint node created within the aforementioned preset game engine (such as UE) is a Blueprint node used to distinguish different virtual 3D models in the virtual scene. The types of different virtual 3D models include: virtual 3D models to be converted into volumetric space rendering objects and other virtual 3D models. The second Blueprint node created within the aforementioned preset game engine is a Blueprint node used to capture target images.
[0117] Specifically, the specific implementation of creating the first blueprint node can be as follows: construct a blueprint node BP_CustomMeshCloud_01 (i.e., the first blueprint node mentioned above) in the UE, and insert an Object variable in the Construction Script function under the BP_CustomMeshCloud_01 node, and set the Object variable as a replaceable variable (Instance Enable) so that the virtual 3D model can be quickly replaced in subsequent processes.
[0118] Furthermore, after constructing the blueprint node BP_Capture (i.e., the second blueprint node mentioned above) in the UE, the construction script function under this BP_Capture node iterates through the BP_CustomMeshCloud_01 nodes in the virtual scene (including the first blueprint node corresponding to each virtual 3D model in the different virtual 3D models mentioned above), adding the BP_CustomMeshCloud_01 node corresponding to each virtual 3D model to be converted into a volumetric space rendering object to the virtual camera's display list (Show Only Actors list). Based on the virtual camera's display list, each virtual 3D model to be converted into a volumetric space rendering object is set as the virtual camera's capture object.
[0119] It is easy to understand that through the above steps S6111 to S6113, the Blueprint nodes in the preset game engine can be used to automatically identify at least one virtual 3D model in the virtual scene that needs to be converted into a volumetric space rendering object, and automatically set the at least one virtual 3D model as the capture object of at least one virtual camera. Therefore, when multiple virtual 3D models need to be converted into volumetric space rendering objects in the application scenario, they can be automatically converted conveniently and quickly without having to add, convert and output multiple virtual 3D models one by one. In addition, by using the Object variable inserted in the first Blueprint node, the virtual 3D model can be quickly replaced in the subsequent modification process. The above process of setting the capture object for the virtual camera has a high degree of automation and can improve the generation efficiency of the entire volumetric space rendering object.
[0120] Optionally, in step S63, the multiple sets of relative directions include: a first direction and a second direction. Based on the second world position information corresponding to the multiple directions, the target volume region is obtained, which may include the following execution steps:
[0121] Step S631: Obtain the second world position information corresponding to the first direction and the second world position information corresponding to the second direction, respectively;
[0122] Step S632: Based on the second world position information corresponding to the first direction and the second world position information corresponding to the second direction, determine the first volume regions corresponding to multiple sets of relative directions respectively;
[0123] Step S633: Obtain the target volume region by utilizing multiple sets of first volume regions corresponding to relative directions.
[0124] Taking the generation of spherical volumetric clouds in a video game scene as an example, the first direction is the +X direction, the second direction is the -X direction, and the +X direction and the -X direction are a pair of relative directions. Figure 10 This is a schematic diagram illustrating the first-world position information of an optional sphere model according to one embodiment of this application. The target material of the sphere model carries the first-world position information, and the size (256×256) of the target image of the sphere model captured by the virtual camera has been mapped to the screen UV space size (0 to 1), offsetting the first-world position information of the sphere model. For example... Figure 10 As shown, the radius of the sphere model is 1. Along the X-axis, the X-coordinate value of the center point of the target image captured by the virtual camera SceneCapture2D_+X in the +X direction is the largest (1), the X-coordinate value of the edge point of the target image is the smallest (0), and the X-coordinate value of the point half the distance from the edge (referring to the edge point on the X-axis) to the center (referring to the center point on the X-axis) is 0.5.
[0125] Furthermore, the world position of the target image P2_+X captured by the virtual camera SceneCapture2D_+X in the +X direction after offset is denoted as X(A), and the world position of the target image P2_-X captured by the virtual camera SceneCapture2D_-X in the -X direction after offset is denoted as X(B). Figure 11 This is a schematic diagram of second-world location information for an optional sphere model according to one embodiment of this application. Figure 12 This is a schematic diagram illustrating second-world position information for another optional sphere model according to one embodiment of this application. For example... Figure 11 The diagram shows the distribution of X(A) in the world space coordinate system. Figure 12 The diagram shows the distribution of X(B) in the world space coordinate system.
[0126] Furthermore, since the example of generating a spherical volumetric cloud only considers one set of relative directions (i.e., the +X direction and the -X direction), based on the second world position information X(A) corresponding to the first direction and the second world position information X(B) corresponding to the second direction, a first volumetric region corresponding to a set of relative directions in the X-axis direction is determined. This first volumetric region corresponding to the +X direction and the -X direction can be used as the aforementioned target volumetric region. This target volumetric region is used to generate the volumetric cloud corresponding to the spherical model.
[0127] It should be noted that the virtual 3D models used to generate volumetric rendering objects in application scenarios are usually of various shapes. Therefore, in the process of generating the corresponding volumetric rendering objects, virtual cameras need to be set up in three sets of relative directions (or even more sets of relative directions) in the X, Y, and Z directions to capture images of the virtual 3D model. At this time, the first volume region corresponding to each set of relative directions is determined according to the method provided in the embodiments of this application. Then, the target volume region is obtained by using the first volume region corresponding to each set of relative directions. For example, the target volume region is obtained by multiplying the first volume regions corresponding to each set of relative directions.
[0128] Optionally, in step S632, determining the first volume regions corresponding to multiple sets of relative directions based on the second world position information corresponding to the first direction and the second world position information corresponding to the second direction may include the following execution steps:
[0129] Step S6321: Invert the second world position information corresponding to the first direction to obtain the inverted result;
[0130] Step S6322: Multiply the inverted result with the second world position information corresponding to the second direction to obtain the calculation result. The calculation result includes: multiple first values and multiple second values. The multiple first values belong to a first numerical range, and the multiple second values belong to a second numerical range.
[0131] Step S6323: In response to multiple first values being greater than a preset threshold, the multiple first values are uniformly set to a third value; and in response to multiple second values being less than a preset threshold, the multiple second values are uniformly set to a fourth value, thereby obtaining the processing result.
[0132] Step S6324: Based on the processing results, determine the first volume regions corresponding to multiple sets of relative directions.
[0133] Taking the generation of spherical volumetric clouds in a video game scene as an example, the second world position information X(A) corresponding to the first direction is inverted to obtain the inverted result. Figure 13This is a schematic diagram of an optional inversion result according to one embodiment of this application, such as... Figure 13 As shown, after reversing X(A), the resulting inverted X(A) is -X(A). It is easy to see that the coordinate regions corresponding to the +X values in -X(A) correspond to the coordinate regions corresponding to the -X values in X(A), and the coordinate regions corresponding to the -X values in -X(A) correspond to the coordinate regions corresponding to the +X values in X(A).
[0134] Figure 14 This is a schematic diagram illustrating an optional calculation result according to one embodiment of this application, such as... Figure 14 As shown, the inverted result -X(A) is multiplied by the second world position information X(B) corresponding to the second direction to obtain the calculation result. It is easy to see that the calculation result contains a closed circular region. This region contains the coordinate region corresponding to the +X value, and the region outside this region contains the coordinate region corresponding to the -X value. The aforementioned first numerical range refers to the range of X coordinate values greater than 0, and the aforementioned second numerical range refers to the range of X coordinate values less than 0. The aforementioned multiple first values are multiple X coordinate values within the coordinate region corresponding to the +X value, and the aforementioned multiple second values are multiple X coordinate values within the coordinate region corresponding to the -X value.
[0135] Figure 15 This is a schematic diagram illustrating an optional processing result according to one embodiment of this application, such as... Figure 15 As shown, the preset threshold is set to 0, the third value is set to 1, and the fourth value is set to 0. After determining the coordinate region corresponding to the +X value (i.e., as shown...), Figure 14 If multiple X-coordinates within the circular inner region (as shown) are greater than 0, then all X-coordinates within the circular inner region are set to 1; after determining the coordinate region corresponding to the -X value (i.e., as shown) Figure 14 If multiple X-coordinate values within the circular outer region (as shown) are less than 0, then all X-coordinate values within the circular outer region are set to 0. Thus, the following is obtained: Figure 15 The processing results are shown. Locations with an X-coordinate value of 1 are displayed in white (i.e., the inner area of the circle), and locations with an X-coordinate value of 0 are displayed in black (i.e., the outer area of the circle). Based on... Figure 15 The processing result shown defines the volume region corresponding to the inner region of the circle (white region) as the first volume region corresponding to the +X direction and the -X direction (i.e., a set of relative directions on the X-axis).
[0136] However, as Figure 15As shown, the edge of the determined first volume region is a hard edge (i.e., there is no transition effect), and consequently, the edge of the target volume region determined by the first volume region corresponding to each of the multiple sets of relative directions is also a hard edge. Such a target volume region still cannot represent the gradient effect from the volume edge to the volume center of the volume space rendering object. In this regard, the embodiments of this application propose the following method to further optimize the method of generating target objects based on virtual 3D models.
[0137] Optionally, in step S62, offsetting the first world position information corresponding to multiple directions to obtain the second world position information corresponding to multiple directions may include the following steps:
[0138] Step S621: Offset the first-world position information corresponding to multiple directions to obtain third-world position information;
[0139] Step S622: Based on the third-world location information and the preset gradient value, obtain the second-world location information.
[0140] In the above optional embodiments, during the offset processing of the first world position information corresponding to multiple directions, the first world position information corresponding to each direction in the multiple directions is first offset to obtain the third world position information, and then the second world position information is obtained based on the third world position information and the preset gradient value, wherein the preset gradient value is used to perform gradient processing on a portion of the world position information in the third world position information.
[0141] It is easy to understand that through the above steps S621 to S622, the second world position information obtained by offsetting the first world position information corresponding to multiple directions can contain the gradient effect from the volume edge to the volume center, so that the target volume space determined based on the second world position has a gradient effect, thereby enabling the target object generated by the game engine in the target volume space to have a gradient effect, enhancing the visual performance effect (such as the edge gradient of the volume cloud can represent the soft effect of the cloud).
[0142] Optionally, in step S622, the multiple sets of relative directions include: a first direction and a second direction. The second world location information is obtained based on third-world location information and a preset gradient value, and may include the following execution steps:
[0143] Step S6221: Subtract the third-world position information corresponding to the first direction from the preset gradient value to obtain the second-world position information corresponding to the first direction; and add the third-world position information corresponding to the second direction to the preset gradient value to obtain the second-world position information corresponding to the second direction.
[0144] In the above optional embodiments, the preset gradient value is used to determine the proportion of the world location information to be gradient-processed within the third-world location information. A larger preset gradient value results in a larger area undergoing gradient processing. For example, a larger preset gradient value results in a larger edge area for gradient processing of the sphere model.
[0145] Taking the generation of spherical volumetric clouds in a video game scene as an example, the first direction is the +X direction, the second direction is the -X direction, and the +X direction and the -X direction are a pair of relative directions. Figure 16 This is a schematic diagram of the second-world position information of another optional sphere model according to one embodiment of this application, such as... Figure 16 As shown, the solid line represents the world position X(A) of the target image P2_+X captured by the virtual camera SceneCapture2D_+X in the +X direction after offset (equivalent to the third world position information corresponding to the first direction mentioned above). Subtracting the preset gradient value F from the world position X(A) represented by the solid line yields the following result: Figure 16 The dashed line shown represents the second-world position information of the sphere model corresponding to the +X direction. Figure 17 This is a schematic diagram of the second world position information of an optional sphere model according to one embodiment of this application. The solid line represents the world position X(B) of the target image P2_-X captured by the virtual camera SceneCapture2D_-X in the -X direction after offset (equivalent to the third world position information corresponding to the second direction mentioned above). Adding a preset gradient value F to the world position X(A) represented by the solid line, we obtain the following: Figure 17 The dashed line shown represents the second-world position information of the sphere model corresponding to the -X direction.
[0146] Optionally, the above method for generating target objects based on virtual 3D models may further include the following execution steps:
[0147] Step S661: Determine the gradient region using third-world location information corresponding to multiple directions and second-world location information corresponding to multiple directions respectively;
[0148] Step S662: Perform a remapping operation on the world location information within the gradient region to obtain the gradient result.
[0149] Taking the generation of spherical volumetric clouds in a video game scene as an example, we utilize third-world location information along the X-axis (such as...) Figure 16 He Ru Figure 17 (as shown by the solid line) and second-world position information in the X-axis direction (such as...) Figure 16 He Ru Figure 17 The dashed lines shown in the diagram define the gradient area. Figure 18This is a schematic diagram of a gradient region corresponding to an optional sphere model according to one embodiment of this application, such as... Figure 18 As shown, the product of the third-world position information along the X-axis and the second-world position information along the X-axis is calculated to obtain the following: Figure 18 The gradient region shown is the area between the closed solid circular line and the closed dashed cocoon-shaped line.
[0150] Furthermore, the world location information within the gradient region is remapped to obtain the gradient result. The remapping operation is used to remap the offset world location information to a preset numerical range. For example, it can map the information to a numerical range of 0 to 1, or to a numerical range other than the numerical range of 0 to 1. Figure 19 This is a schematic diagram of the gradient result corresponding to an optional sphere model according to one embodiment of this application, such as... Figure 19 As shown, it will be as follows Figure 16 The region between the solid and dashed lines shown is remapped. Specifically, a preset remap value is used to remap the world position information between the solid and dashed lines to a value between 0 and 1, resulting in the following: Figure 19 The gradient result is shown. Similarly, Figure 20 This is a schematic diagram of the gradient result corresponding to another optional sphere model according to one embodiment of this application, such as... Figure 20 As shown, it will be as follows Figure 17 The region between the solid and dashed lines shown is remapped. Specifically, a preset remap value is used to remap the world position information between the solid and dashed lines to a value between 0 and 1, resulting in the following: Figure 20 The gradient result shown.
[0151] Figure 21 This is a schematic diagram showing the gradient result corresponding to another optional sphere model according to one embodiment of this application. (The diagram is intended to illustrate the gradient effect.) Figure 19 He Ru Figure 20 The product of the gradient results shown is calculated to obtain the following: Figure 21 The illustration shows a spherical volume region with edge transition effects. Therefore, this embodiment of the application can determine a target volume region with edge transition effects, thereby enabling the volumetric space rendering object corresponding to the virtual 3D model generated by the game engine within that target volume region to have edge transition effects, enhancing the visual performance of the volumetric space rendering object.
[0152] Optionally, in step S64, generating the target object using the target volume region may include the following steps:
[0153] Step S641: Perform linear interpolation on the first volume parameter, the second volume parameter, and the target volume region to generate the target object. The first volume parameter is used to adjust the edge region of the target volume region, and the second volume parameter is used to adjust the internal region of the target volume region.
[0154] Taking the generation of spherical volumetric clouds in a video game scene as an example again, Figure 22 This is a schematic diagram of an optional first volume parameter adjustment region according to one embodiment of this application, such as... Figure 22 As shown, the first volume parameter is used to adjust the edge region of the target volume region, which is a partially gradient region at the edge of the sphere region. Figure 23 This is a schematic diagram of an optional second volume parameter adjustment region according to one embodiment of this application, such as... Figure 23 As shown, the second volume parameter is used to adjust the internal region of the target volume region, which is the internal region of the sphere region excluding the edge region.
[0155] Figure 24 This is a schematic diagram of an optional linear interpolation process according to one embodiment of this application, as shown below. Figure 24 As shown, the target object is generated by using linear interpolation nodes (Lerp nodes) in the game engine to perform linear interpolation on the first volume parameter, the second volume parameter, and the target volume region.
[0156] Optionally, the above method for generating target objects based on virtual 3D models may further include the following execution steps:
[0157] Step S67: Perform linear interpolation on the first noise parameter, the second noise parameter, and the target volume region to generate the target object. The first noise parameter and the second noise parameter are used to blend and adjust the shape of the target object.
[0158] In the above optional embodiments, the first noise parameter and the second noise parameter are used to blend and adjust the shape of the target object. Both the first noise parameter and the second noise parameter can be cloud noise. The target object is generated by linearly interpolating the first noise parameter and the second noise parameter using a linear interpolation node (Lerp node) in the game engine.
[0159] In summary, according to the above-described optional embodiments of this application, three sets of virtual cameras positioned along the X, Y, and Z axes acquire images of the virtual 3D model containing world position information. Then, by offsetting the world position information in these images, the offset result is used to determine the 3D volume region of the volumetric rendering object to be generated. Thus, the game engine can generate the volumetric rendering object corresponding to the aforementioned virtual 3D model within this 3D volume region. Furthermore, by offsetting the world position using preset values, the values between the overall offset result and the original world position are mapped to 0 to 1, thereby obtaining the gradient effect of the volumetric rendering object from the volume center to the volume edge.
[0160] In application scenarios, especially in the field of video games where virtual objects such as volumetric clouds and volumetric fog are generated, it is often necessary to generate volumetric clouds with special shapes according to the needs of the scenario. For example, a "cat-shaped" volumetric cloud generated based on a virtual 3D cat model. The following uses this scenario as an example to further illustrate the above-mentioned technical solution of this application.
[0161] Figure 25 This is a schematic diagram of an optional virtual 3D model according to one embodiment of this application, such as... Figure 25 As shown, based on the virtual 3D cat model, the above-described method steps provided in the embodiments of this application can generate a corresponding "cat-shaped" volumetric cloud without relying on volumetric textures.
[0162] Figure 26 This is a schematic diagram of the distribution of another optional virtual camera in world space according to one embodiment of this application, such as... Figure 26 Virtual cameras are created in multiple directions (+X, -X, +Y, -Y, +Z, and -Z). The +X and -X directions form one pair of relative directions, the +Y and -Y directions another, and the +Z and -Z directions yet another. The lines of view corresponding to these six virtual cameras are focused on the same world location in multiple directions. All six virtual cameras use an orthographic view mode, and the target images captured by these six virtual cameras are at a preset frame size.
[0163] Figure 27 This is a schematic diagram of another optional target image according to one embodiment of this application, such as... Figure 27 As shown, the above six virtual cameras set in the virtual scene are controlled to take pictures of the virtual 3D cat model from multiple directions, and the target images corresponding to multiple directions are obtained. The target images include: +X image, -X image, +Y image, -Y image, +Z image and -Z image. The information carried in each target image includes: first world position information.
[0164] Still as Figure 27 As shown, since the virtual 3D cat model is assigned a target material, the material mode of the target material is set to an unlit material, and the emission color attribute of the target material is used to record the first-world position information. Therefore, each target image captured by the above 6 virtual cameras contains color blocks with different display colors, and the distribution of these color blocks is related to the coordinate quadrant of the world space coordinate system.
[0165] Figure 28 This is a schematic diagram of another optional target image according to one embodiment of this application, such as... Figure 28 As shown, for Figure 27 The +X and -X images in the target image shown take the X value, for example... Figure 27 The +Y and -Y images in the target image shown take the Y value, for example... Figure 27 The +Z and -Z images of the target image shown are obtained by taking the Z value, as shown below. Figure 28 The target image shown.
[0166] Furthermore, for the +X and -X directions, the second-world position information corresponding to the +X direction and the second-world position information corresponding to the -X direction are obtained respectively; based on the second-world position information corresponding to the +X and -X directions, the first volume regions corresponding to the +X and -X directions are determined. Similarly, the first volume regions corresponding to the +Y and -Y directions, as well as the first volume regions corresponding to the +Z and -Z directions, are determined.
[0167] Figure 29 This is a schematic diagram illustrating an optional first volume region determination process according to one embodiment of this application, as shown below. Figure 29 As shown, taking a set of relative directions along the X-axis (+X direction and -X direction) as an example, in the preset game engine, specifically, when determining the corresponding first volume region, the second world position information corresponding to the first direction (such as the positive direction, +X direction, +Y direction, and +Z direction) is reversed to obtain a reversed result; the reversed result is multiplied with the second world position information corresponding to the second direction (such as the negative direction, -X direction, -Y direction, and -Z direction) to obtain a calculation result, wherein the calculation result includes: multiple first values and multiple second values, the multiple first values belong to a first numerical range, and the multiple second values belong to a second numerical range; in response to multiple first values being greater than a preset threshold, the multiple first values are uniformly set to a third value, and in response to multiple second values being less than a preset threshold, the multiple second values are uniformly set to a fourth value, to obtain a processing result; based on the processing result, the first volume regions corresponding to multiple sets of relative directions are determined respectively.
[0168] Figure 30This is a schematic diagram illustrating an optional target volume region determination process according to one embodiment of this application, as shown below. Figure 30 As shown, volume 1 represents the first volume region corresponding to the +X and -X directions, volume 2 represents the first volume region corresponding to the +Y and -Y directions, and volume 3 represents the first volume region corresponding to the +Z and -Z directions. Multiplying volumes 1, 2, and 3 yields the target volume region. This target volume region is the volume region to be generated for the "cat-shaped" volumetric cloud.
[0169] Figure 31 This is a schematic diagram illustrating an optional process for generating a target object based on a linear interpolation method according to one embodiment of this application, such as... Figure 31 As shown, in the game engine, linear interpolation is performed using Lerp nodes based on blend color 1, blend color 2, and the target volume region to obtain linear interpolation result 1; linear interpolation is performed using Lerp nodes based on cloud noise 1, cloud noise 2, and the target volume region to obtain linear interpolation result 2; and a "cat-shaped" volumetric cloud is generated based on linear interpolation result 1 and linear interpolation result 2.
[0170] Figure 32 This is a schematic diagram of an optional target object according to one embodiment of this application. Figure 33 This is a schematic diagram of another optional target object according to one embodiment of this application. Figure 34 This is a schematic diagram of another optional target object according to one embodiment of this application. For example... Figure 32 , Figure 33 and Figure 34 As shown, through the above-described method steps provided in the embodiments of this application, in the process of generating a "cat-shaped" volumetric cloud, it is possible to generate volumetric clouds with different visual effects by controlling multiple parameters (such as preset gradient values, first volume parameters, second volume parameters, cloud noise 1, cloud noise 2, and mixed color 1, mixed color 2, etc.), thereby meeting the needs of various scenarios in application scenarios.
[0171] Furthermore, according to the aforementioned method of the embodiments of this application, multiple volumetric clouds of different shapes can be automatically generated simultaneously by creating a first blueprint node and a second blueprint node. The multiple volumetric clouds of different shapes generated can also be freely and quickly modified and replaced, etc., which will not be elaborated in this embodiment.
[0172] It is easy to understand that the method provided by the embodiments of this application can support the real-time conversion of virtual models into corresponding virtual objects with volume effects (such as volumetric clouds) in the game engine without relying on third-party software or third-party plugins; the generation process of virtual objects does not rely on volumetric textures, so adding virtual models in the virtual scene will not increase the number of textures, the rendering resource consumption is small, and it is device-friendly; the generated virtual objects are easy to modify, and can achieve a gradual transition from the volume center to the volume edge of the virtual object, with good visual effects (such as being able to represent the soft effect of virtual clouds).
[0173] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as a magnetic disk or optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0174] This embodiment also provides an apparatus for generating target objects based on a virtual 3D model. This apparatus is used to implement the above embodiments and preferred embodiments, and details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0175] Figure 35 This is a structural block diagram of an apparatus for generating target objects based on a virtual 3D model according to one embodiment of this application, such as... Figure 35 As shown, the device includes: a shooting module 3501, used to control a virtual camera set in a virtual scene to shoot at a virtual 3D model from multiple directions to obtain target images corresponding to multiple directions, wherein the multiple directions include multiple sets of relative directions, and the information carried in the target images includes: first-world position information; an offset module 3502, used to offset the first-world position information corresponding to multiple directions to obtain second-world position information corresponding to multiple directions; an acquisition module 3503, used to acquire a target volume region based on the second-world position information corresponding to multiple directions, wherein the target volume region is a volume region that matches the virtual 3D model; and a generation module 3504, used to generate a target object using the target volume region, wherein the target object is a volume space rendering object.
[0176] Optionally, in the above-mentioned device for generating target objects based on virtual 3D models, the line of sight of the virtual camera is focused on the same world position in multiple directions, the shooting mode of the virtual camera adopts orthogonal view mode, and the target image adopts a preset frame size.
[0177] Optionally, Figure 36 This is a structural block diagram of an optional apparatus for generating target objects based on a virtual 3D model according to one embodiment of this application, such as... Figure 36 As shown, the device includes, in addition to Figure 35 In addition to all the modules shown, it also includes: Material Module 3505, which is used to create a target material, wherein the material mode of the target material is set to an unlit material, and the emission color attribute of the target material is used to record first-world location information; and the target material is assigned to the virtual 3D model.
[0178] Optionally, the above-mentioned shooting module 3501 is further configured to: set the virtual 3D model as the capture object of the virtual camera, and set the other display objects in the virtual scene other than the virtual 3D model to a hidden state, thereby obtaining a setting result; and control the virtual camera to shoot the virtual 3D model from multiple directions based on the setting result, thereby obtaining target images corresponding to multiple directions respectively.
[0179] Optionally, the aforementioned shooting module 3501 is further configured to: create a first blueprint node and a second blueprint node within a preset game engine, wherein the first blueprint node is used to distinguish different virtual 3D models in the virtual scene, and the second blueprint node is used to capture target images; traverse the first blueprint nodes corresponding to different virtual 3D models in the virtual scene using the second blueprint node, and add the traversed first blueprint nodes to the display list corresponding to the virtual camera; and set the virtual 3D model as the capture object of the virtual camera based on the display list.
[0180] Optionally, the acquisition module 3503 is further configured to: acquire second world position information corresponding to the first direction and second world position information corresponding to the second direction respectively; determine first volume regions corresponding to multiple sets of relative directions based on the second world position information corresponding to the first direction and second world position information corresponding to the second direction respectively; and acquire target volume regions using the first volume regions corresponding to multiple sets of relative directions respectively.
[0181] Optionally, the acquisition module 3503 is further configured to: invert the second world position information corresponding to the first direction to obtain an inverted result; multiply the inverted result with the second world position information corresponding to the second direction to obtain a calculation result, wherein the calculation result includes: multiple first values and multiple second values, the multiple first values belonging to a first numerical range, and the multiple second values belonging to a second numerical range; in response to multiple first values being greater than a preset threshold, uniformly setting multiple first values to a third value, and in response to multiple second values being less than a preset threshold, uniformly setting multiple second values to a fourth value, to obtain a processing result; and based on the processing result, determine the first volume regions corresponding to multiple sets of relative directions respectively.
[0182] Optionally, the offset module 3502 is further configured to: perform offset processing on the first world position information corresponding to multiple directions respectively to obtain the third world position information; and obtain the second world position information based on the third world position information and the preset gradient value.
[0183] Optionally, the offset module 3502 is further configured to: subtract the third-world position information corresponding to the first direction from the preset gradient value to obtain the second-world position information corresponding to the first direction, and add the third-world position information corresponding to the second direction to the preset gradient value to obtain the second-world position information corresponding to the second direction.
[0184] Optionally, Figure 37 This is a structural block diagram of another optional apparatus for generating target objects based on a virtual 3D model according to one embodiment of this application, such as... Figure 37 As shown, the device includes, in addition to Figure 36 In addition to all the modules shown, it also includes: a gradient module 3506, which is used to determine the gradient region by using third-world position information corresponding to multiple directions and second-world position information corresponding to multiple directions; and to perform a remapping operation on the world position information within the gradient region to obtain the gradient result.
[0185] Optionally, the generation module 3504 is further configured to: perform linear interpolation processing on the first volume parameter, the second volume parameter, and the target volume region to generate a target object, wherein the first volume parameter is used to adjust the edge region of the target volume region, and the second volume parameter is used to adjust the internal region of the target volume region.
[0186] Optionally, Figure 38 This is a structural block diagram of another optional apparatus for generating target objects based on a virtual 3D model according to one embodiment of this application, such as... Figure 38 As shown, the device includes, in addition to Figure 37In addition to all the modules shown, it also includes: a processing module 3507, which is used to perform linear interpolation processing on the first noise parameter, the second noise parameter and the target volume region to generate a target object, wherein the first noise parameter and the second noise parameter are used to mix and adjust the shape of the target object.
[0187] Optionally, in the above-mentioned apparatus for generating target objects based on virtual 3D models, the target object includes: volumetric cloud.
[0188] It should be noted that the above modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but are not limited to: all the above modules are located in the same processor; or, the above modules are located in different processors in any combination.
[0189] Embodiments of this application also provide a computer-readable storage medium storing a computer program, wherein the computer program is configured to execute the steps in any of the above method embodiments when run.
[0190] Optionally, in this embodiment, the computer-readable storage medium may include, but is not limited to, various media capable of storing computer programs, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0191] Optionally, in this embodiment, the computer-readable storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0192] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0193] S1, control the virtual camera set in the virtual scene to take pictures of the virtual 3D model from multiple directions to obtain target images corresponding to multiple directions respectively. The multiple directions include: multiple sets of relative directions. The information carried in the target images includes: first-world location information.
[0194] S2, offset the first world position information corresponding to multiple directions respectively to obtain the second world position information corresponding to multiple directions respectively;
[0195] S3, based on the second-world position information corresponding to multiple directions, obtain the target volume region, where the target volume region is the volume region that matches the virtual 3D model;
[0196] S4 generates a target object using the target volume region, where the target object is a volume space rendering object.
[0197] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: the virtual camera's line of sight is focused on the same world position in multiple directions, the virtual camera's shooting mode adopts an orthographic view mode, and the target image adopts a preset frame size.
[0198] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: creating a target material, wherein the material mode of the target material is set to an unlit material, and the luminous color attribute of the target material is used to record first-world location information; and assigning the target material to a virtual 3D model.
[0199] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: setting the virtual 3D model as the capture object of the virtual camera, and setting the remaining display objects in the virtual scene other than the virtual 3D model to a hidden state, thereby obtaining a setting result; and controlling the virtual camera to capture images of the virtual 3D model from multiple directions based on the setting result, thereby obtaining target images corresponding to multiple directions respectively.
[0200] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: creating a first blueprint node and a second blueprint node within a preset game engine, wherein the first blueprint node is used to distinguish different virtual 3D models in a virtual scene, and the second blueprint node is used to capture target images; traversing the first blueprint nodes corresponding to different virtual 3D models in the virtual scene using the second blueprint node, and adding the traversed first blueprint nodes to the display list corresponding to the virtual camera; and setting the virtual 3D model as the capture object of the virtual camera based on the display list.
[0201] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: acquiring second world position information corresponding to a first direction and second world position information corresponding to a second direction respectively; determining first volume regions corresponding to multiple sets of relative directions based on the second world position information corresponding to the first direction and second world position information corresponding to the second direction respectively; and acquiring a target volume region using the first volume regions corresponding to multiple sets of relative directions respectively.
[0202] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: inverting the second world position information corresponding to the first direction to obtain an inverted result; multiplying the inverted result with the second world position information corresponding to the second direction to obtain a calculation result, wherein the calculation result includes: multiple first values and multiple second values, the multiple first values belonging to a first numerical range, and the multiple second values belonging to a second numerical range; in response to multiple first values being greater than a preset threshold, uniformly setting the multiple first values to a third value, and in response to multiple second values being less than a preset threshold, uniformly setting the multiple second values to a fourth value, to obtain a processing result; and based on the processing result, determining multiple sets of first volume regions corresponding to the relative directions respectively.
[0203] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: offsetting the first-world position information corresponding to multiple directions to obtain third-world position information; and obtaining second-world position information based on the third-world position information and a preset gradient value.
[0204] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: subtracting the third-world position information corresponding to the first direction from the preset gradient value to obtain the second-world position information corresponding to the first direction, and adding the third-world position information corresponding to the second direction to the preset gradient value to obtain the second-world position information corresponding to the second direction.
[0205] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a gradient region using third-world location information corresponding to multiple directions and second-world location information corresponding to multiple directions; and performing a remapping operation on the world location information within the gradient region to obtain a gradient result.
[0206] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: performing linear interpolation on a first volume parameter, a second volume parameter, and a target volume region to generate a target object, wherein the first volume parameter is used to adjust the edge region of the target volume region, and the second volume parameter is used to adjust the internal region of the target volume region.
[0207] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: performing linear interpolation processing on a first noise parameter, a second noise parameter, and a target volume region to generate a target object, wherein the first noise parameter and the second noise parameter are used to blend and adjust the shape of the target object.
[0208] Optionally, the aforementioned computer-readable storage medium is also configured to store program code for performing the following steps: the target object includes: a volumetric cloud.
[0209] In the computer-readable storage medium of the above embodiments, a technical solution is provided for a method of generating a target object based on a virtual 3D model. By controlling a virtual camera set in a virtual scene to capture images of the virtual 3D model from multiple directions, target images corresponding to multiple directions are obtained. These multiple directions include multiple sets of relative directions. The information carried in the target images includes first-world position information. Then, the first-world position information corresponding to the multiple directions is offset to obtain second-world position information corresponding to the multiple directions. Further, based on the second-world position information corresponding to the multiple directions, a target volume region is obtained, wherein the target volume region is a volume region that matches the virtual 3D model. A target object is generated using the target volume region, wherein the target object is a volumetric space rendering object. Thus, this application achieves the purpose of determining a target volume region based on the world position information of the virtual 3D model in multiple directions and generating a volumetric space rendering object within that target volume region. This achieves the technical effect of improving the generation efficiency and visual performance of volumetric space rendering objects while reducing rendering resource consumption. It also solves the technical problems in related technologies where the generation of volumetric space rendering objects based on volumetric textures generated by third-party software or plugins results in high resource consumption, low efficiency, and poor visual performance of the rendering results.
[0210] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a computer-readable storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, terminal device, or network device, etc.) to execute the methods according to the embodiments of this application.
[0211] In exemplary embodiments of this application, a computer-readable storage medium stores a program product capable of implementing the methods described above in this embodiment. In some possible implementations, various aspects of the embodiments of this application may also be implemented as a program product including program code, which, when the program product is run on a terminal device, causes the terminal device to perform the steps described in the "Exemplary Methods" section of this embodiment according to various exemplary embodiments of this application.
[0212] The program product for implementing the above-described method according to embodiments of this application may employ a portable compact disc read-only memory (CD-ROM) and include program code, and may run on a terminal device, such as a personal computer. However, the program product of the embodiments of this application is not limited thereto. In the embodiments of this application, the computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in conjunction with an instruction execution system, apparatus, or device.
[0213] The aforementioned program product may take the form of any combination of one or more computer-readable media. Such computer-readable storage media may be, for example, but not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatuses, or devices, or any combination thereof. More specific examples (not exhaustive) of computer-readable storage media include: electrical connections having one or more wires, portable disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0214] It should be noted that the program code contained on the computer-readable storage medium can be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, radio frequency (RF), or any suitable combination thereof.
[0215] Embodiments of this application also provide an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the steps in any of the above method embodiments.
[0216] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0217] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0218] S1, control the virtual camera set in the virtual scene to take pictures of the virtual 3D model from multiple directions to obtain target images corresponding to multiple directions respectively. The multiple directions include: multiple sets of relative directions. The information carried in the target images includes: first-world location information.
[0219] S2, offset the first world position information corresponding to multiple directions respectively to obtain the second world position information corresponding to multiple directions respectively;
[0220] S3, based on the second-world position information corresponding to multiple directions, obtain the target volume region, where the target volume region is the volume region that matches the virtual 3D model;
[0221] S4 generates a target object using the target volume region, where the target object is a volume space rendering object.
[0222] Optionally, the processor can also be configured to perform the following steps via a computer program: the virtual camera's line of sight focuses on the same world position in multiple directions, the virtual camera's shooting mode adopts orthographic view mode, and the target image adopts a preset frame size.
[0223] Optionally, the processor described above can also be configured to perform the following steps via a computer program: creating a target material, wherein the material mode of the target material is set to an unlit material, and the luminous color attribute of the target material is used to record first-world location information; and assigning the target material to a virtual 3D model.
[0224] Optionally, the processor may also be configured to perform the following steps via a computer program: setting the virtual 3D model as the capture object of the virtual camera, and setting the remaining display objects in the virtual scene other than the virtual 3D model to a hidden state, thereby obtaining the setting result; and controlling the virtual camera to capture images of the virtual 3D model from multiple directions based on the setting result, thereby obtaining target images corresponding to multiple directions respectively.
[0225] Optionally, the processor may also be configured to perform the following steps via a computer program: creating a first blueprint node and a second blueprint node within a preset game engine, wherein the first blueprint node is used to distinguish different virtual 3D models in the virtual scene, and the second blueprint node is used to capture target images; using the second blueprint node to traverse the first blueprint nodes corresponding to different virtual 3D models in the virtual scene, and adding the traversed first blueprint nodes to the display list corresponding to the virtual camera; based on the display list, setting the virtual 3D model as the capture object of the virtual camera.
[0226] Optionally, the processor may also be configured to perform the following steps via a computer program: acquiring second world position information corresponding to a first direction and second world position information corresponding to a second direction respectively; determining first volume regions corresponding to multiple sets of relative directions based on the second world position information corresponding to the first direction and second world position information respectively; and acquiring a target volume region using the first volume regions corresponding to multiple sets of relative directions respectively.
[0227] Optionally, the processor may also be configured to perform the following steps via a computer program: inverting the second world position information corresponding to the first direction to obtain an inverted result; multiplying the inverted result with the second world position information corresponding to the second direction to obtain a calculation result, wherein the calculation result includes: multiple first values and multiple second values, the multiple first values belonging to a first numerical range and the multiple second values belonging to a second numerical range; in response to multiple first values being greater than a preset threshold, uniformly setting the multiple first values to a third value, and in response to multiple second values being less than a preset threshold, uniformly setting the multiple second values to a fourth value, to obtain a processing result; and based on the processing result, determining multiple sets of first volume regions corresponding to the relative directions respectively.
[0228] Optionally, the processor may also be configured to perform the following steps via a computer program: offsetting the first-world position information corresponding to multiple directions to obtain third-world position information; and obtaining second-world position information based on the third-world position information and a preset gradient value.
[0229] Optionally, the processor may also be configured to perform the following steps via a computer program: subtracting the third-world position information corresponding to the first direction from the preset gradient value to obtain the second-world position information corresponding to the first direction, and adding the third-world position information corresponding to the second direction to the preset gradient value to obtain the second-world position information corresponding to the second direction.
[0230] Optionally, the processor described above can also be configured to perform the following steps via a computer program: determine the gradient region using third-world location information corresponding to multiple directions and second-world location information corresponding to multiple directions; and perform a remapping operation on the world location information within the gradient region to obtain the gradient result.
[0231] Optionally, the processor may also be configured to perform the following steps via a computer program: perform linear interpolation on the first volume parameter, the second volume parameter, and the target volume region to generate a target object, wherein the first volume parameter is used to adjust the edge region of the target volume region, and the second volume parameter is used to adjust the internal region of the target volume region.
[0232] Optionally, the processor may also be configured to perform the following steps via a computer program: perform linear interpolation on a first noise parameter, a second noise parameter, and a target volume region to generate a target object, wherein the first noise parameter and the second noise parameter are used to blend and adjust the shape of the target object.
[0233] Optionally, the processor described above may also be configured to perform the following steps via a computer program: the target object includes: a volumetric cloud.
[0234] In the electronic device described in the above embodiments, a technical solution is provided for a method to generate a target object based on a virtual 3D model. By controlling a virtual camera set in a virtual scene to capture images of the virtual 3D model from multiple directions, target images corresponding to multiple directions are obtained. These multiple directions include multiple sets of relative directions. The information carried in the target images includes first-world position information. Then, the first-world position information corresponding to the multiple directions is offset to obtain second-world position information corresponding to the multiple directions. Further, based on the second-world position information corresponding to the multiple directions, a target volume region is obtained, where the target volume region is a volume region that matches the virtual 3D model. A target object is generated using the target volume region, where the target object is a volumetric space rendering object. Thus, this application achieves the purpose of determining a target volume region based on the world position information of the virtual 3D model in multiple directions and generating a volumetric space rendering object within that target volume region. This achieves the technical effect of improving the generation efficiency and visual performance of volumetric space rendering objects while reducing rendering resource consumption. It also solves the technical problems in related technologies where the generation of volumetric space rendering objects based on volumetric textures generated by third-party software or plugins results in high resource consumption, low efficiency, and poor visual performance of the rendering results.
[0235] Figure 39 This is a schematic diagram of an electronic device according to one embodiment of this application. Figure 39 As shown, the electronic device 3900 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0236] like Figure 39 As shown, the electronic device 3900 is presented in the form of a general-purpose computing device. The components of the electronic device 3900 may include, but are not limited to: at least one processor 3910, at least one memory 3920, a bus 3930 connecting different system components (including memory 3920 and processor 3910), and a display 3940.
[0237] The memory 3920 stores program code that can be executed by the processor 3910, causing the processor 3910 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this application.
[0238] The memory 3920 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 39201 and / or cache memory 39202, and may further include read-only memory (ROM) 39203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0239] In some instances, memory 3920 may also include programs / utilities 39204 having a set (at least one) of program modules 39205, including but not limited to: an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Memory 3920 may further include memory remotely located relative to processor 3910, which can be connected to electronic device 3900 via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0240] Bus 3930 can represent one or more of several types of bus structures, including a memory cell bus or memory cell controller, peripheral bus, graphics acceleration port, processor 3910, or a local bus using any of the various bus structures.
[0241] The display 3940 may be, for example, a touch-screen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 3900.
[0242] Optionally, the electronic device 3900 can also communicate with one or more external devices 4000 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 3900, and / or any device that enables the electronic device 3900 to communicate with one or more other computing devices (e.g., router, modem, etc.). This communication can be performed via the input / output (I / O) interface 3950. Furthermore, the electronic device 3900 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via the network adapter 3960. Figure 39 As shown, network adapter 3960 communicates with other modules of electronic device 3900 via bus 3930. It should be understood that, although... Figure 39As not shown, other hardware and / or software modules may be used in conjunction with electronic device 3900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, Redundant Arrays of Independent Disks (RAID) systems, tape drives, and data backup storage systems.
[0243] The aforementioned electronic device 3900 may further include: a keyboard, a cursor control device (such as a mouse), an input / output interface (I / O interface), a network interface, a power supply, and / or a camera.
[0244] Those skilled in the art will understand that Figure 39 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, electronic device 3900 may also include... Figure 39 The more or fewer components shown, or having the same Figure 39 Different configurations are shown. The memory 3920 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the method for generating a target object based on a virtual 3D model in this embodiment. The processor 3910 executes various functional applications and data processing by running the computer program stored in the memory 3920, thereby realizing the aforementioned method for generating a target object based on a virtual 3D model.
[0245] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0246] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0247] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0248] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0249] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0250] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0251] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for generating target objects based on virtual 3D models, characterized in that, include: The virtual camera set in the virtual scene is controlled to capture images of the virtual 3D model from multiple directions to obtain target images corresponding to the multiple directions respectively. The multiple directions include multiple sets of relative directions, and the information carried in the target images includes: first-world location information. The first world position information corresponding to the multiple directions is offset to obtain the third world position information; Based on the third-world location information and the preset gradient value, the second-world location information corresponding to the multiple directions is obtained respectively; Based on the second world position information corresponding to the multiple directions, a target volume region is obtained, wherein the target volume region is a volume region that matches the virtual three-dimensional model; A target object is generated using the target volume region, wherein the target object is a volume space rendering object.
2. The method according to claim 1, characterized in that, The virtual camera's line of sight focuses on the same world position in multiple directions. The virtual camera's shooting mode adopts an orthographic view mode, and the target image adopts a preset frame size.
3. The method according to claim 1, characterized in that, The method further includes: Create a target material, wherein the material mode of the target material is set to an unlit material, and the emission color attribute of the target material is used to record the first world location information; The target material is applied to the virtual 3D model.
4. The method according to claim 1, characterized in that, Controlling the virtual camera set in the virtual scene to capture images of the virtual 3D model from multiple directions to obtain the target images corresponding to each of the multiple directions includes: The virtual 3D model is set as the capture object of the virtual camera, and all other display objects in the virtual scene except the virtual 3D model are set to a hidden state to obtain the setting result; Based on the settings, the virtual camera is controlled to capture images of the virtual 3D model from the multiple directions, thereby obtaining the target images corresponding to the multiple directions respectively.
5. The method according to claim 4, characterized in that, Setting the virtual 3D model as the capture object of the virtual camera includes: A first blueprint node and a second blueprint node are created within a preset game engine. The first blueprint node is used to distinguish different virtual 3D models in the virtual scene, and the second blueprint node is used to capture the target image. The second blueprint node is used to traverse the first blueprint nodes corresponding to different virtual 3D models in the virtual scene, and the traversed first blueprint nodes are added to the display list corresponding to the virtual camera. Based on the displayed list, the virtual 3D model is set as the capture object of the virtual camera.
6. The method according to claim 1, characterized in that, The multiple sets of relative directions include: a first direction and a second direction. Based on the second world position information corresponding to each of the multiple directions, obtaining the target volume region includes: Obtain the second world location information corresponding to the first direction and the second world location information corresponding to the second direction, respectively; Based on the second world position information corresponding to the first direction and the second world position information corresponding to the second direction, the first volume regions corresponding to the multiple sets of relative directions are determined respectively. The target volume region is obtained by utilizing the first volume regions corresponding to the multiple sets of relative directions.
7. The method according to claim 6, characterized in that, Based on the second world location information corresponding to the first direction and the second world location information corresponding to the second direction, the first volume regions corresponding to the multiple sets of relative directions are determined as follows: The second world position information corresponding to the first direction is reversed to obtain the reversed result; The product of the inversion result and the second world position information corresponding to the second direction is calculated to obtain a calculation result, wherein the calculation result includes: multiple first values and multiple second values, the multiple first values belonging to a first numerical range, and the multiple second values belonging to a second numerical range; In response to the plurality of first values being greater than a preset threshold, the plurality of first values are uniformly set to a third value; and in response to the plurality of second values being less than the preset threshold, the plurality of second values are uniformly set to a fourth value, thereby obtaining a processing result. Based on the processing results, the first volume regions corresponding to the multiple sets of relative directions are determined.
8. The method according to claim 1, characterized in that, The multiple sets of relative directions include: a first direction and a second direction. Based on the third-world location information and the preset gradient value, the second-world location information is obtained as follows: Subtract the preset gradient value from the third-world position information corresponding to the first direction to obtain the second-world position information corresponding to the first direction, and add the preset gradient value to the third-world position information corresponding to the second direction to obtain the second-world position information corresponding to the second direction.
9. The method according to claim 8, characterized in that, The method further includes: The gradient region is determined by using the third-world location information corresponding to the multiple directions and the second-world location information corresponding to the multiple directions respectively; A remapping operation is performed on the world location information within the gradient region to obtain the gradient result.
10. The method according to claim 1, characterized in that, Generating the target object using the target volume region includes: The target object is generated by performing linear interpolation on the first volume parameter, the second volume parameter, and the target volume region. The first volume parameter is used to adjust the edge region of the target volume region, and the second volume parameter is used to adjust the internal region of the target volume region.
11. The method according to claim 1, characterized in that, The method further includes: The first noise parameter, the second noise parameter, and the target volume region are linearly interpolated to generate the target object, wherein the first noise parameter and the second noise parameter are used to blend and adjust the shape of the target object.
12. The method according to claim 1, characterized in that, The target object includes: volumetric cloud.
13. A device for generating target objects based on virtual three-dimensional models, characterized in that, include: The shooting module is used to control the virtual camera set in the virtual scene to shoot the virtual 3D model from multiple directions to obtain target images corresponding to the multiple directions respectively. The multiple directions include multiple sets of relative directions, and the information carried in the target image includes: first-world position information. The offset module is used to offset the first world position information corresponding to the multiple directions respectively to obtain third world position information; and to obtain second world position information corresponding to the multiple directions based on the third world position information and a preset gradient value. The acquisition module is used to acquire a target volume region based on the second world position information corresponding to the multiple directions, wherein the target volume region is a volume region that matches the virtual three-dimensional model; A generation module is used to generate a target object using the target volume region, wherein the target object is a volume space rendering object.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to be executed by a processor to perform the method for generating a target object based on a virtual three-dimensional model as described in any one of claims 1 to 12.
15. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the method for generating a target object based on a virtual three-dimensional model as described in any one of claims 1 to 12.