Information processing method and apparatus, storage medium, and electronic device
By dividing the virtual scene into sub-scene regions and generating depth maps, shadow maps were created, solving the problem of inconsistent shadow representation between virtual characters and objects, and achieving high-precision shadow effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2022-10-20
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies cannot achieve the non-physical realism of virtual characters casting shadows on objects while objects do not cast shadows in virtual scenes, and there is also the problem of loss of accuracy.
By determining the scene area of the virtual scene and the outline information of the virtual character, the scene is divided into multiple sub-scene areas. Depth maps are generated through baking, and shadow maps are created to render and display shadow effects on the virtual character.
It achieves shadow effects that meet the requirements of the virtual scene, ensuring the accuracy of the depth map while avoiding casting shadows on other objects in the scene.
Smart Images

Figure CN115761106B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computers, and more specifically, to an information processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] In related technologies, shadows in virtual scenes can be implemented using Unreal Engine, for example, through the CastShadow switch built into Unreal Engine 4 (UE4). However, this method can only achieve the effect of all objects in the virtual scene casting shadows on each other, and cannot achieve the unrealistic effect of objects casting shadows on virtual characters while virtual characters do not cast shadows on objects. Furthermore, there is a loss of precision, resulting in the technical problem of not being able to achieve shadow effects that meet the requirements of virtual scenes.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] At least some embodiments of this application provide an information processing method, apparatus, storage medium, and electronic device to at least solve the technical problem of failing to achieve shadow effects that meet the requirements of virtual scenes.
[0005] According to one embodiment of this application, an information processing method is provided. The method includes: determining a scene region of a virtual scene and the outline information of a virtual character in the virtual scene; dividing the scene region based on the outline information to obtain multiple sub-scene regions, wherein the outline of each sub-scene region is larger than the outline of the virtual character; baking a first virtual object contained in the sub-scene region to obtain a first depth map of the first virtual object; creating a first shadow map using the first depth map; and rendering and displaying a first target shadow representation on the virtual character based on the first shadow map, wherein the first target shadow representation is the shadow cast by the first virtual object on the virtual character.
[0006] According to one embodiment of this application, an information processing apparatus is also provided. The apparatus includes: a determining unit, configured to determine a scene region of a virtual scene and outline information of a virtual character in the virtual scene; a dividing unit, configured to divide the scene region based on the outline information to obtain multiple sub-scene regions, wherein the outline of each sub-scene region is larger than the outline of the virtual character; a baking unit, configured to bake a first virtual object contained in the sub-scene regions to obtain a first depth map of the first virtual object; a creating unit, configured to create a first shadow map using the first depth map; and a rendering unit, configured to render and display a first target shadow representation on the virtual character based on the first shadow map, wherein the first target shadow representation is the shadow cast by the first virtual object on the virtual character.
[0007] According to one embodiment of this application, a computer-readable storage medium is also provided, which stores a computer program, wherein the computer program, when run by a processor, controls the device where the computer-readable storage medium is located to execute the information processing method of the embodiment of this application.
[0008] According to one embodiment of this application, an electronic device is also provided, 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 information processing method described in any of the preceding claims.
[0009] In at least some embodiments of this application, the scene area of the virtual scene and the outline information of the virtual character in the virtual scene are determined; the scene area is divided based on the outline information to obtain multiple sub-scene areas; a first virtual object contained in the sub-scene area is baked to obtain a first depth map of the first virtual object; a first shadow map is created using the first depth map; and a first target shadow effect is rendered and displayed on the virtual character based on the first shadow map. In other words, the embodiments of this application implement a method for dividing a scene area. By dividing the scene area into multiple sub-scene areas, a depth map can be baked and generated for the virtual character in the virtual scene using the sub-scene areas, and a shadow map can be created based on the depth map. The corresponding shadow map is then used to render and display the shadow effect on the virtual character, achieving the goal of ensuring the accuracy requirements of the depth map without causing shadows to other scene objects. This solves the technical problem of not being able to achieve a shadow effect that meets the requirements of the virtual scene, and achieves the technical effect of achieving a shadow effect that meets the requirements of the virtual scene. Attached Figure Description
[0010] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments of this application and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0011] Figure 1 This is a hardware structure block diagram of a mobile terminal for an information processing method according to an embodiment of this application.
[0012] Figure 2 This is a flowchart of an information processing method according to an embodiment of this application;
[0013] Figure 3(a) is a schematic diagram of a shadow effect according to an embodiment of this application;
[0014] Figure 3(b) is a schematic diagram of another implementation of the shadow effect according to an embodiment of this application;
[0015] Figure 4This is a schematic diagram of a regional baking operation interface according to an embodiment of this application;
[0016] Figure 5 This is a schematic diagram of the depth map corresponding to each region in a virtual scene according to an embodiment of this application;
[0017] Figure 6 This is a schematic diagram of an information processing apparatus according to an embodiment of this application;
[0018] Figure 7 This is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0019] 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.
[0020] 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.
[0021] First, some nouns or terms that appear in the description of the embodiments of this application are to be interpreted as follows:
[0022] Unreal Engine 4 (UE4) is a graphics engine used for developing 3D software and games.
[0023] The Blueprint system, the business logic control layer of the UE4 engine, allows gameplay logic and parameter values to be written to the material system;
[0024] The material system (Shader) is the rendering system of the UE4 engine, which allows you to write the rendering effects of objects using the shader language;
[0025] ShadowMask is a method of statically baking shadow maps offline, which can be applied to character shaders to create shadows.
[0026] A render target (RT) is used to record information about objects in the scene being drawn, such as depth.
[0027] A depth camera (Scene Capture 2D) is used in conjunction with a real-time camera (RT) to capture the depth of objects in a scene onto the RT.
[0028] Capture refers to the act of capturing the depth of a scene onto a depth camera (RT).
[0029] A static mesh is an object in a virtual scene that does not move or change.
[0030] A game character is an object that moves within a virtual environment.
[0031] Ortho Projection Width (camera shooting area width), Capture camera shooting area width;
[0032] A region (Cell) is a region that divides a specified virtual scene. Each Cell represents a small cuboid region.
[0033] According to one embodiment of this application, an embodiment of an information processing method 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.
[0034] The methods described in this application can be executed on a mobile terminal, computer terminal, or similar computing device. For example, when running on a mobile terminal, the mobile terminal can be a smartphone, tablet computer, PDA, mobile internet device, PAD, game console, or other terminal device. Figure 1 This is a hardware structure block diagram of a mobile terminal according to an embodiment of the information processing method of this application. For example... Figure 1 As shown, a mobile terminal may include one or more ( Figure 1Only one is shown in the image. Processor 102 (processor 102 may include, but is not limited to, a central processing unit (CPU), graphics processing unit (GPU), digital signal processing (DSP) chip, microprocessor (MCU), programmable logic device (FPGA), neural network processor (NPU), tensor processor (TPU), artificial intelligence (AI) type processor, etc.) and memory 104 for storing data. In one embodiment of this application, it may also include: input / output device 108 and display device.
[0035] In some optional embodiments primarily focused on gaming scenarios, the aforementioned 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.
[0036] Those skilled in the art will understand that Figure 1 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 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown.
[0037] According to one embodiment of this application, an embodiment of an information processing method 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.
[0038] In one possible implementation, embodiments of this application provide an information processing method. Figure 2 This is a flowchart of an information processing method according to an embodiment of this application, such as... Figure 2 As shown, the method includes the following steps:
[0039] Step S202: Determine the scene area of the virtual scene and the outline information of the virtual characters in the virtual scene.
[0040] In the technical solution provided by step S202 of this application, the scene area of the virtual scene and the outline information of the virtual character in the virtual scene are determined. The virtual scene can be a game scene, the scene area can be the area in the virtual scene that needs to be baked with a depth map, and the virtual character can be a virtual game character controlled by the player through a terminal device in the virtual scene, that is, a controlled virtual object in the virtual scene. The outline information can be used to represent the geometric space surrounding the virtual character, such as a bounding box, which is not specifically limited here.
[0041] Step S204: Divide the scene region based on the contour information to obtain multiple sub-scene regions.
[0042] In the technical solution provided in step S204 of this application, the division parameters can be obtained by dividing the volume of the scene area of the virtual scene by the outline information of the virtual character and rounding it down. Then, the scene area is divided using the division parameters to obtain multiple sub-scene areas. The sub-scene areas can be partitioned areas of the virtual scene, such as small cuboid areas (cells).
[0043] Optionally, the outline of each sub-scene area is larger than the outline of the virtual character. That is, the volume of each sub-scene area obtained after dividing the scene area can be larger than the volume of the virtual character, so as to avoid the situation where the boundary of the sub-scene area passes through the body of the virtual character. For example, the upper body of the virtual character cannot be in area A of the scene area and the lower body cannot be in area B of the scene area.
[0044] Optionally, the outline information of the virtual character can be adjusted according to the range of motion of the virtual character in the virtual scene. For example, the side length of the bounding box of the virtual character can be adjusted to obtain the side length of the bounding box of the sub-scene region. The side length of the bounding box of the sub-scene region is determined as the division parameter, and then the scene region is divided using the division parameter to obtain multiple sub-scene regions.
[0045] Optionally, after dividing the scene area according to the division parameters to obtain multiple sub-scene areas, the location of each sub-scene area in the virtual scene, the location of the depth camera corresponding to each sub-scene area, and the identifier of each sub-scene area can be further determined. For example, the identifier can be an ID (Identity document, or simply Id), where the location of each sub-scene area is uniquely identified by the Id, and the location of the corresponding sub-scene area can be determined by the Id.
[0046] Optionally, the correspondence between the ID of a sub-scene area and the virtual objects contained in the sub-scene area can be stored as a list of data in the form of key-value pairs. The corresponding virtual object can be retrieved directly from the list of data by using the ID of the sub-scene area.
[0047] Step S206: Bake the first virtual object contained in the sub-scene area to obtain the first depth map of the first virtual object.
[0048] In the technical solution provided in step S206 of this application, the first virtual objects contained in the sub-scene area are baked by a depth camera to obtain a first depth map of multiple first virtual objects. The shadow effect of the virtual character in the virtual scene is achieved by the multiple first depth maps. The first virtual object can be an object that generates shadows for the virtual character in the sub-scene area, or it can be an object that is stationary in the sub-scene area, such as a window or a vase. This is only an example and is not specifically limited.
[0049] Optionally, the shooting area of the depth camera for the sub-scene region can be determined based on the volume of the bounding box of the sub-scene region. To ensure that the virtual character does not exceed the boundary of the sub-scene region while in motion, the shooting area of the depth camera needs to be larger than the volume of the bounding box of the virtual character in the sub-scene region. That is, the sub-scene region needs to be located within the shooting area of the depth camera. For example, the volume of the bounding box of the sub-scene region can be... The volume of √2 is defined as the shooting area of the depth camera in the virtual scene. This is only an example and is not specifically limited.
[0050] Optionally, if a dynamic object appears in the sub-scene area, the first virtual object can be directly retrieved from the list data by the ID of the sub-scene area. This allows the depth camera to capture only the depth maps of the first virtual object and the dynamic object in the shooting area, and create a shadow map from this depth map. The shadow map is then rendered and displayed based on the shadow map, showing the shadows generated by the dynamic object and the first virtual object on the virtual character. This achieves the goal of the dynamic object only casting shadows on the virtual character, but not on other scene objects (e.g., the floor).
[0051] Step S208: Create a first shadow map using the first depth map.
[0052] In the technical solution provided in step S208 of this application, a first shadow map is created based on the first depth map obtained by the depth camera capturing the first virtual object in the sub-scene area. The first shadow map can be used to render and display the shadow generated by the first virtual object on the virtual character.
[0053] Step S210: Render and display the shadow representation of the first target on the virtual character based on the first shadow map.
[0054] In the technical solution provided by step S210 of this application, the first target shadow effect is rendered and displayed on the virtual character by the created first shadow map. The first target shadow effect can be the shadow display effect formed by the first virtual object on the virtual character, such as the shadow display effect generated by the window on the virtual character.
[0055] Through steps S202 to S210 of this application, the scene area of the virtual scene and the outline information of the virtual character in the virtual scene are determined; the scene area is divided based on the outline information to obtain multiple sub-scene areas, wherein the outline of each sub-scene area is larger than the outline of the virtual character; a first virtual object contained in the sub-scene area is baked to obtain a first depth map of the first virtual object; a first shadow map is created using the first depth map; and a first target shadow is rendered and displayed on the virtual character based on the first shadow map, wherein the first target shadow is the shadow formed by the first virtual object on the virtual character. In other words, the embodiments of this application implement a method for dividing a scene area. By dividing the scene area into multiple sub-scene areas, a depth map can be baked and generated for the virtual character in the virtual scene in the form of sub-scene areas, and a shadow map can be created based on the depth map. The corresponding shadow map is then rendered and displayed on the virtual character to achieve the purpose of ensuring the accuracy requirements of the depth map without causing shadows to other scene objects. This solves the technical problem of not being able to achieve a shadow effect that meets the requirements of the virtual scene and achieves the technical effect of achieving a shadow effect that meets the requirements of the virtual scene.
[0056] The method described above in this embodiment will be further described below.
[0057] As an optional implementation, step S204 involves dividing the scene area based on the contour information to obtain multiple sub-scene areas, including: determining the division parameters based on the contour information of the virtual character; and dividing the scene area according to the division parameters to obtain multiple sub-scene areas.
[0058] In this embodiment, the partitioning parameters can be obtained by dividing the volume of the scene area of the virtual scene by the outline information of the virtual character and rounding it down. The scene area can then be divided (Split) using the partitioning parameters to obtain multiple sub-scene areas. The partitioning parameters can be partitioning values, that is, the number of partitions to be divided into for the scene area of the virtual scene.
[0059] Optionally, the partitioning parameters are obtained by dividing the volume of the bounding box of the scene region of the virtual scene by the volume of the bounding box of the virtual character and rounding down. The scene region is then divided (Split) using the partitioning parameters to obtain multiple sub-scene regions. The partitioning parameters can be the subdivision values of each axis of the bounding box of the scene region of the virtual scene.
[0060] As an optional implementation, the method may further include determining segmentation parameters based on the outline information of the virtual character, including: determining a first bounding box of the virtual character; and determining the side length of the sub-scene region based on the side length of the first bounding box.
[0061] In this embodiment, to avoid the boundary of a sub-scene area passing through the body of the virtual character, the volume of each sub-scene area obtained after dividing the scene area needs to be larger than the volume of the virtual character. In other words, the boundary of the sub-scene area cannot pass through the body of the virtual character. Therefore, the first bounding box of the virtual character can be determined first, and then the side length of the first bounding box can be adjusted. The adjusted side length is determined as the side length of the sub-scene area, that is, the side length of the bounding box of the sub-scene area. The first bounding box is used to represent the outline information of the area occupied by the virtual character in the virtual scene.
[0062] As an optional implementation, the method may further include determining the side length of the sub-scene region based on the side length of the first bounding box, including: determining the side length of the sub-scene region as the result of adjusting the side length of the first bounding box by the target coefficient.
[0063] In this embodiment, to ensure that the side length of the sub-scene region is greater than the movement range of the virtual character in the virtual scene, the side length of the first bounding box can be adjusted using a target coefficient, and the adjusted side length is determined as the side length of the sub-scene region. The target coefficient can be determined by the movement range of the virtual character, and can be a magnification factor of the side length of the first bounding box. For example, if the target coefficient is √2, then the side length of the first bounding box will be... The length of the square root of 2 is determined as the side length of the sub-scene region. This is only an example and is not a specific limitation.
[0064] As an optional implementation, the method may further include determining partitioning parameters based on the outline information of the virtual character, including: determining a first bounding box of the virtual character and a second bounding box of the scene region; and determining partitioning parameters based on the first bounding box and the second bounding box.
[0065] In this embodiment, the division parameter can also be determined by dividing the volume of the second bounding box of the scene area by the volume of the first bounding box of the virtual character and taking the integer value. The second bounding box is used to represent the outline information of the scene area, and the first bounding box is used to represent the outline information of the area occupied by the virtual character in the virtual scene.
[0066] As an optional implementation, step S204 involves dividing the scene area according to the division parameters to obtain multiple sub-scene areas, including: determining at least one of the following for each sub-scene area according to the division parameters: area location, the location of the corresponding depth camera, and area identifier.
[0067] In this embodiment, after determining the segmentation parameters based on the contour information of the virtual character, the scene area is divided according to the segmentation parameters to obtain the region position of each sub-scene area, the position of the depth camera corresponding to each sub-scene area, and the region identifier of each sub-scene area. The region position can be the position of each sub-scene area in the scene area of the virtual scene, and the region position can be represented by three-dimensional coordinates, such as (1, 2, 2). The depth camera can be used to capture the depth map of the sub-scene area, and the region identifier can be the ID of the sub-scene area.
[0068] Optionally, the location of each sub-scene region is uniquely identified by an Id. For example, the minimum location and maximum location of the bounding box of the scene region are gradually increased from the minimum location to the maximum location. Following the order of increasing along each axis (ZYX), the Id is incremented by 1 to obtain the location and Id of each sub-scene region. For example, if a scene region is divided into 8 sub-scene regions, the Id and the location of the scene region can be represented as: 1: (0, 0, 0), 2: (0, 0, 1), 3: (0, 1, 0), 4: (0, 1, 1), 5: (1, 0, 0), 6: (1, 0, 1), 7: (1, 1, 0), 8: (1, 1, 1). This is only an example and is not a specific limitation.
[0069] As an optional implementation, step S206, baking the first virtual object contained in the sub-scene region to obtain a first depth map, includes: determining the shooting area of the depth camera on the virtual scene based on the sub-scene region; and obtaining the first depth map captured by the depth camera on the shooting area.
[0070] In this embodiment, the shooting area of the depth camera for the virtual scene is determined according to the volume of the sub-scene area, and a first depth map of the corresponding sub-scene area is captured by the depth camera. The first depth map can be used to characterize the distance between the virtual character in the sub-scene area and the depth camera.
[0071] Optionally, the sub-scene area can be located within the shooting area, so that there is overlap between different sub-scene areas. That is to say, the depth map of each sub-scene area will have some overlap, so that even if the virtual character is in motion, such as running and jumping, it will not exceed the boundary of the sub-scene area.
[0072] Optionally, the area captured by the depth camera of the virtual scene can be larger than the bounding box volume of the virtual character in the sub-scene region; for example, the bounding box volume of the sub-scene region can be used. The size of the square root of 2 is used as the shooting area of the depth camera, and no specific limitation is made here.
[0073] As an optional implementation, the method may further include that the first depth maps corresponding to two adjacent sub-scene regions respectively include the depth maps of the same portion of the first virtual object.
[0074] In this embodiment, since the sub-scene area is located within the shooting area of the depth camera, the first depth map obtained by the depth camera in two adjacent sub-scene areas includes the depth map portion of the same first virtual object. Thus, when the virtual character enters different sub-scene areas, it can seamlessly switch to load the first depth map of that sub-scene area.
[0075] As an optional implementation, the method may further include: in response to the second virtual object moving to a sub-scene region, acquiring a second depth map of the first virtual object and the second virtual object captured by a depth camera in the shooting area; creating a second shadow map from the second depth map; and rendering and displaying the shadow representation of the second target on the virtual character based on the second shadow map.
[0076] In this embodiment, if a dynamic object appears in the sub-scene area, that is, when the second virtual object moves to the sub-scene area where the first virtual object is located, the first virtual object and the second virtual object need to jointly form a shadow on the virtual character. Then, the second depth map of the first virtual object and the second virtual object captured by the depth camera in the shooting area can be dynamically obtained through the ID of the sub-scene area. The second depth map is then created as a second shadow map. The shadow of the second target is rendered and displayed on the virtual character based on the second shadow map. The second depth map can be used to characterize the distance between the first virtual object and the depth camera captured by the depth camera in the shooting area, as well as the distance between the second virtual object and the depth camera. The first virtual object can be a stationary object in the sub-scene area, and the second virtual object can be a moving object in the sub-scene area, such as a moving box.
[0077] Optionally, the second depth map of the first virtual object and the second virtual object can be obtained by directly superimposing the depth map corresponding to the first virtual object and the depth map corresponding to the second virtual object, or by first creating the depth map corresponding to the first virtual object as the shadow map of the first virtual object, creating the depth map corresponding to the second virtual object as the shadow map of the second virtual object, and then superimposing the shadow map of the first virtual object and the shadow map of the second virtual object. No specific limitation is made here.
[0078] As an optional implementation, the method may further include determining a virtual object retrieved from a database based on a region identifier of a sub-scene region as a first virtual object, wherein the database stores the correspondence between region identifiers and virtual objects contained in the sub-scene region.
[0079] In this embodiment, the correspondence between the region identifier of the sub-scene region and the virtual objects contained in the sub-scene region can be stored as a list of data in the form of key-value pairs, for example, (region identifier of sub-scene region, list of virtual objects), and the list data is stored in the database. When a dynamic object appears in the sub-scene region, the first virtual object can be directly retrieved from the list data in the database through the region identifier of the sub-scene region. Then, the depth camera can capture only the depth map of the first virtual object. This step, like the static baking shadow map technology, can also be performed offline without additional performance consumption.
[0080] The technical solutions of the embodiments of this application will be further illustrated below with reference to preferred embodiments.
[0081] In the development of virtual scenes, shadows can enhance the realism of the image. However, implementing shadows is not only costly in terms of game performance but also difficult to handle. Achieving a shadow effect that is both aesthetically pleasing and low in performance has been a long-standing challenge in the industry. For example, achieving a shadow without jagged edges or moiré patterns, or improving the accuracy of shadows.
[0082] In a virtual scene, shadow effects can be divided into two types based on the definition of the transmitter and receiver: the shadow effect of the object on other objects and the shadow effect of other objects on the object. In this embodiment of the application, the performance optimization method of the shadow effect of other objects (e.g., scene objects) on the object (e.g., virtual character) is mainly analyzed.
[0083] Cartoon rendering is a popular rendering style. Cartoon rendering usually has some non-physical realism. For example, virtual characters can receive shadows cast by scene objects, but at the same time, scene objects do not cast shadows on themselves, and virtual characters do not cast shadows on scene objects. Figure 3(a) is a schematic diagram of a shadow effect according to an embodiment of this application. As shown in Figure 3(a), the virtual character 31 only has shadows cast by the window 32 and the wall 33, as shown in the black elliptical area in the figure, while the virtual character does not cast shadows on the ground 34. Figure 3(b) is another schematic diagram of a shadow effect according to an embodiment of this application. As shown in Figure 3(b), the black elliptical area on the virtual character 31 represents the shadow cast by the window 32 on the virtual character 31.
[0084] In one related technique, the CastShadow switch of the scene objects in the UE4 engine is set to make the light source dynamically movable so that all objects can cast shadows on each other. However, this method will cause objects in the scene (windows, boxes, people) to cast shadows on each other, and generating a depth map of the entire area in real time is very resource-intensive and may also result in a loss of accuracy.
[0085] In another related technique, the shadow effect is achieved by statically baking a scene depth map using Shadow Mask technology, converting the depth map matrix into a shadow map, and then applying the shadow map to a virtual character. For example, using Shadow Mask technology, a SceneCapture2D camera captures the scene (window) depth on a RT (Rapid View Unit), and then the game directly loads this depth map onto the character's shader to create the shadow effect. However, if the scene area is very large (e.g., 1 kilometer), this may not work. To preserve sufficient accuracy in the baked depth map (1 km), the RT texture would be very large, requiring the use of cascade shadow maps to load different levels of shadow maps at different distances. This not only increases the amount of memory required to store multi-level cascaded shadow maps, but also results in a loss of accuracy, making it impossible to guarantee that the shadows cast on the character are clear and correct. In addition, the statically baked textures are determined during offline scene baking and cannot be updated in response to changes in movable objects at runtime, resulting in movable objects not being able to cast shadows correctly on the character.
[0086] However, this embodiment of the application provides a shadow optimization method based on Shadow Mask. This method can optimize the shadow generation area while achieving the above shadow effect, so as to ensure the accuracy of the depth map. It can also make movable objects in the virtual scene cast shadow effects only on the characters and not on the floor.
[0087] The following is a further description of a shadow optimization method based on Shadow Mask provided in this embodiment of the application. The method may include the following two parts.
[0088] The first part, implemented in offline mode, adds the logic of baking shadow maps in different regions on the basis of shadow mask.
[0089] Figure 4 This is a schematic diagram of a regional baking operation interface according to an embodiment of this application, such as... Figure 4 As shown, each small square represents a cell. The virtual character's location is the scene area that needs to be baked. First, a region box can be placed to cover the entire virtual scene whose depth map needs baking. Then, the number of partitions (Split) and the subdivision values for each axis can be defined, for example, 5. 5 5.
[0090] Alternatively, the split value can be obtained by calculating the volume of the virtual character (Bounds), then dividing it by the volume of the entire scene area (Box) and rounding it down.
[0091] It should be noted that the volume of the divided region needs to be larger than the volume occupied by the virtual character in the virtual scene. In other words, the boundary of the divided region cannot pass through the body of the virtual character. For example, the upper body of the virtual character cannot be in region A and the lower body cannot be in region B. Since the same virtual character shader can only load one region depth, if the above situation occurs, it will cause the virtual character shader to load the region depth map incorrectly.
[0092] Alternatively, when capturing a depth map, the volume of the smallest region can be used. The size of the square root of 2 is used as the shooting area. Therefore, there will be some overlap between each minimum region. When the virtual character shader enters different minimum regions, it can seamlessly switch to load the depth map of the different minimum regions. In this way, even if the virtual character is in motion, such as running and jumping, it will not exceed the boundary of the minimum region. The volume of the minimum region can be determined by obtaining the bounding box of the virtual character. It only needs to be greater than the value of the entire virtual character. No specific limit is made here.
[0093] It should be noted that the aforementioned "volume of the minimum region" The square root of 2 in "√2" is for illustrative purposes only and is not intended to be specific.
[0094] Next, define a Box that covers the entire scene area, divide it into many partitioned regions, each region being a Cell. Then, calculate the position, ID, and corresponding depth camera position of each Cell. This calculation includes: creating a ShadowMap for each Cell, defining the length, width, and height of each Cell, the minimum world position of the Box, and the longest side. The code includes: a list of Cell IDs, a list of all static meshes in the scene, region divisions, 3D variables, and the position of each Cell corresponding to the depth camera; a constructor that calculates values in the editor, ensuring the minimum XYZ value of the divided region is 1, resetting the ID list, calculating Cell data, defining a Box covering the entire scene region based on the minimum and maximum XYZ positions of the Box, dividing the Box into multiple Cells according to the Split method, iterating through the X, Y, and Z indices of the Cells, and storing the ID of each Cell in a data list; and outputting the length, width, height, and longest side of each Cell. The square root of 2 and the minimum world position of the Box; call a function (e.g., the Lambda function) to store all static meshes in the scene in an array, and store non-movable objects in the scene in an array to obtain the static mesh on the static mesh.
[0095] Optionally, the Min Location and Max Location of the entire scene area Box can be gradually increased from Min Location to Max Location, and the Id can be increased by 1 in the order of increasing along each axis (ZYX) to obtain the position and Id of each cell. For example, if a scene area Box is divided into 8 cells, the Id and position of each cell can be: 1: (0, 0, 0), 2: (0, 0, 1), 3: (0, 1, 0), 4: (0, 1, 1), 5: (1, 0, 0), 6: (1, 0, 1), 7: (1, 1, 0), 8: (1, 1, 1).
[0096] Finally, static depth maps corresponding to each partition region in the virtual scene are acquired using a depth camera, and a data list is output, resulting in multiple static depth maps. This serves as the basis for creating shadow maps, including: timer call functions to process each cell; and processing the allocated shadow blocks. The system stores a list of map and shadow textures, the matrix transformation of each cell relative to the depth camera, the ID number of the cell being captured, the corresponding cell number, and the light direction of the sky parallel light and directional light. It also includes timeout statistics, storing the depth map captured by the capture, all static meshes in the scene, and the camera capturing the depth. The system ensures the save path cannot be empty. It retrieves the single directional light source in the scene, obtains the direction of the directional light, and calls this every 0.01 seconds until all cells have been processed. It allows the depth camera to capture all objects in the current scene. The system dynamically creates a single-channel RT (Resolution Time) image and assigns it a value. It places the RT onto the scene's Capture component, sets the camera's shooting width, obtains the light source position, sets the depth camera to rotate relative to the bounding box, offsets the depth camera 10,000 units towards the light source direction, updates the depth camera's position, transforms the depth camera's inverse matrix into an array, creates the depth RT as a static texture, and saves it to a file. The next loop processes the next cell; if the index exceeds the cell's maximum value, it indicates that all cells have finished capturing depth, and the timer is cleared.
[0097] Figure 5 This is a schematic diagram of the depth map corresponding to each region in a virtual scene according to an embodiment of this application, such as... Figure 5 As shown, the figure contains depth maps corresponding to multiple different sub-regions. The number below each depth map represents the ID of that depth map. The object resembling a water tower, shadow texture 109 and shadow texture 110, overlaps in these two regions. This is the problem of minimum division region boundary transition solved by the embodiment of this application.
[0098] The second part is implemented in the Runtime state. Based on the obtained data list, it is determined whether to switch the dynamic Capture sub-region depth map and optimize this judgment process.
[0099] During the game runtime, dynamic objects may appear in the virtual scene. The movement of these dynamic objects will affect the shadow effect projected by the scene onto the character Shader. Therefore, when a moving object enters the divided area where the virtual character is located, the depth map of that cell can be dynamically recaptured instead of recapturing the entire virtual scene area.
[0100] To achieve the above effect, optimization can be carried out based on the data list obtained in the first part, including: by calling UE4 functions (such as the GetBounds function), obtaining the bounding boxes of all objects in the virtual scene; when the areas are divided into cells, traversing each cell; determining which object bounding boxes are contained in each cell and adding these objects to the list corresponding to this cell, and storing the list data in the form of key-value pairs (such as TMap<Cell Id, object list>). Then, when dynamically updating the depth of the cell, obtain the object list according to the Cell Id, and let the depth camera only capture the depth of these objects + movable objects (boxes).
[0101] Optionally, the obtained data is the extended data of the data list in the first part. Therefore, the above steps can also be carried out offline without performance consumption.
[0102] The beneficial effects brought by the technical solution of this embodiment of the present application may include: handling the problem of boundary transition in area division; obtaining the preprocessed object list data, and capturing objects as needed when dynamically collecting the depth map to achieve partial performance optimization; based on the Shadow Mask technology, adding content for optimizing the area division algorithm to achieve the effect that "static objects" and "dynamic objects" in the scene can generate depth maps in the smallest area and project shadows onto the virtual character without causing shadow effects on other scene objects.
[0103] In this embodiment, by adding region segmentation algorithm optimization to the Shadow Mask technology, a static depth map of each cell in the scene is obtained and a data list is output. When dynamically updating the depth of a cell, the corresponding object list is obtained from the data list according to the cell's ID, so that the depth camera only captures the depth of objects and moving objects, thereby optimizing the shadow generation area and ensuring the accuracy of the depth map. This solves the technical problem of not being able to achieve shadow effects that meet the requirements of the virtual scene, and achieves the technical effect of achieving shadow effects that meet the requirements of the virtual scene.
[0104] 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 ROM / RAM, magnetic disk, 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.
[0105] This embodiment also provides a method for execution Figure 2 The information processing apparatus of the illustrated embodiment is used to implement the above embodiments and preferred embodiments, and will not be repeated as already described. As used below, the terms "unit" and "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.
[0106] Figure 6 This is a schematic diagram of an information processing apparatus according to one embodiment of this application, such as... Figure 6 As shown, the information processing device 600 includes: a determination unit 601, a division unit 602, a baking unit 603, a creation unit 604, and a rendering unit 605.
[0107] The determining unit 601 is used to determine the scene area of the virtual scene and the outline information of the virtual characters in the virtual scene.
[0108] The segmentation unit 602 is used to divide the scene area based on the contour information to obtain multiple sub-scene areas, wherein the contour of each sub-scene area is larger than the contour of the virtual character.
[0109] Baking unit 603 is used to bake the first virtual object contained in the sub-scene area to obtain the first depth map of the first virtual object;
[0110] Create unit 604 to create a first shadow map using the first depth map.
[0111] The rendering unit 605 is used to render and display the shadow representation of the first target on the virtual character based on the first shadow map, wherein the shadow representation of the first target is the shadow formed by the first virtual object on the virtual character.
[0112] Optionally, the segmentation unit 602 includes: a first segmentation module for determining segmentation parameters based on the outline information of the virtual character; and a second segmentation module for segmenting the scene area according to the segmentation parameters to obtain multiple sub-scene areas.
[0113] Optionally, the first partitioning module includes: a first determining submodule, used to determine a first bounding box of the virtual character, wherein the first bounding box is used to represent the outline information of the area occupied by the virtual character in the virtual scene; and a second determining submodule, used to determine the side length of the sub-scene area based on the side length of the first bounding box.
[0114] Optionally, the second determining submodule is further configured to determine the side length of the sub-scene region based on the side length of the first bounding box through the following steps: the result of adjusting the side length of the first bounding box by a target coefficient is determined as the side length of the sub-scene region, wherein the target coefficient is determined by the movement amplitude of the virtual character, so that the side length of the sub-scene region is greater than the movement amplitude of the virtual character.
[0115] Optionally, the first partitioning module includes: a third determining submodule, used to determine a first bounding box of the virtual character and a second bounding box of the scene region, wherein the first bounding box is used to represent the contour information of the area occupied by the virtual character in the virtual scene, and the second bounding box is used to represent the contour information of the scene region; and a fourth determining submodule, used to determine partitioning parameters based on the first bounding box and the second bounding box.
[0116] Optionally, the segmentation unit 602 includes: a first determining module, used to determine at least one of the following for the sub-scene region according to the segmentation parameters: region location, the location of the corresponding depth camera, and region identifier.
[0117] Optionally, the baking unit 603 includes: a second determining module, used to determine the shooting area of the depth camera on the virtual scene based on the sub-scene area, wherein the sub-scene area is located within the shooting area; and an acquiring module, used to acquire a first depth map captured by the depth camera on the shooting area.
[0118] Optionally, the first depth maps corresponding to two adjacent sub-scene regions each include the depth maps of the same portion of the first virtual object.
[0119] Optionally, the device further includes: an acquisition unit, configured to acquire a second depth map of the first virtual object and the second virtual object captured by a depth camera in the shooting area in response to the second virtual object moving to the sub-scene area; and a processing unit, configured to create a second shadow map from the second depth map and render and display a second target shadow representation on the virtual character based on the second shadow map, wherein the second target shadow representation is the shadow formed by the first virtual object and the second virtual object together on the virtual character.
[0120] In the information processing apparatus of this embodiment, a determining unit is used to determine the scene area of the virtual scene and the outline information of the virtual character in the virtual scene; a dividing unit is used to divide the scene area based on the outline information to obtain multiple sub-scene areas, wherein the outline of each sub-scene area is larger than the outline of the virtual character; a baking unit is used to bake a first virtual object contained in the sub-scene area to obtain a first depth map of the first virtual object; a creating unit is used to create a first shadow map using the first depth map; and a rendering unit is used to render and display a first target shadow representation on the virtual character based on the first shadow map, wherein the first target shadow representation is the shadow formed by the first virtual object on the virtual character, thereby solving the technical problem of not being able to achieve a shadow effect that conforms to the requirements of the virtual scene, and achieving the technical effect of achieving a shadow effect that conforms to the requirements of the virtual scene.
[0121] It should be noted that the above-mentioned units and modules can be implemented by software or hardware. For the latter, they can be implemented in the following ways, but not limited to these: all the above-mentioned units and modules are located in the same processor; or, the above-mentioned units and modules are located in different processors in any combination.
[0122] 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.
[0123] 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.
[0124] 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.
[0125] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0126] S1, determine the scene area of the virtual scene and the outline information of the virtual characters in the virtual scene;
[0127] S2, the scene area is divided based on the contour information to obtain multiple sub-scene areas, wherein the contour of each sub-scene area is larger than the contour of the virtual character;
[0128] S3, bake the first virtual object contained in the sub-scene area to obtain the first depth map of the first virtual object;
[0129] S4, create the first shadow map using the first depth map;
[0130] S5, render and display the shadow of the first target on the virtual character based on the first shadow map, wherein the shadow of the first target is the shadow cast by the first virtual object on the virtual character.
[0131] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining partitioning parameters based on the outline information of the virtual character; and partitioning the scene region according to the partitioning parameters to obtain multiple sub-scene regions.
[0132] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a first bounding box of a virtual character, wherein the first bounding box is used to characterize the outline information of the area occupied by the virtual character in the virtual scene; and determining the side length of a sub-scene area based on the side length of the first bounding box.
[0133] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining the side length of a sub-scene region as the result of adjusting the side length of the first bounding box by a target coefficient, wherein the target coefficient is determined by the motion amplitude of the virtual character, such that the side length of the sub-scene region is greater than the motion amplitude of the virtual character.
[0134] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a first bounding box for a virtual character and a second bounding box for a scene region, wherein the first bounding box is used to characterize the outline information of the area occupied by the virtual character in the virtual scene, and the second bounding box is used to characterize the outline information of the scene region; and determining partitioning parameters based on the first bounding box and the second bounding box.
[0135] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining at least one of the following for a sub-scene region according to partitioning parameters: region location, the location of the corresponding depth camera, and region identifier.
[0136] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining the shooting area of the depth camera on the virtual scene based on the sub-scene region, wherein the sub-scene region is located within the shooting area; and acquiring a first depth map captured by the depth camera on the shooting area.
[0137] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: the first depth maps corresponding to two adjacent sub-scene regions respectively include depth maps of the same portion of the first virtual object.
[0138] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: in response to the second virtual object moving to a sub-scene area, acquiring a second depth map of the first virtual object and the second virtual object captured by a depth camera in the shooting area; creating a second shadow map from the second depth map, and rendering and displaying a second target shadow representation on the virtual character based on the second shadow map, wherein the second target shadow representation is the shadow formed by the first virtual object and the second virtual object together on the virtual character.
[0139] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a virtual object retrieved from a database based on a region identifier of a sub-scene region as a first virtual object, wherein the database stores a correspondence between region identifiers and virtual objects contained in the sub-scene region.
[0140] In the computer-readable storage medium of this embodiment, a scene region of a virtual scene and the outline information of a virtual character in the virtual scene are determined; the scene region is divided based on the outline information to obtain multiple sub-scene regions, wherein the outline of each sub-scene region is larger than the outline of the virtual character; a first virtual object contained in the sub-scene region is baked to obtain a first depth map of the first virtual object; a first shadow map is created using the first depth map; and a first target shadow is rendered and displayed on the virtual character based on the first shadow map, wherein the first target shadow is the shadow formed by the first virtual object on the virtual character, thereby solving the technical problem of not being able to achieve a shadow effect that conforms to the requirements of the virtual scene, and achieving the technical effect of achieving a shadow effect that conforms to the requirements of the virtual scene.
[0141] 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.
[0142] 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.
[0143] 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.
[0144] 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.
[0145] 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, RF, etc., or any suitable combination thereof.
[0146] 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.
[0147] 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.
[0148] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0149] S1, determine the scene area of the virtual scene and the outline information of the virtual characters in the virtual scene;
[0150] S2, the scene area is divided based on the contour information to obtain multiple sub-scene areas, wherein the contour of each sub-scene area is larger than the contour of the virtual character;
[0151] S3, bake the first virtual object contained in the sub-scene area to obtain the first depth map of the first virtual object;
[0152] S4, create the first shadow map using the first depth map;
[0153] S5, render and display the shadow of the first target on the virtual character based on the first shadow map, wherein the shadow of the first target is the shadow cast by the first virtual object on the virtual character.
[0154] Optionally, the processor may also be configured to perform the following steps via a computer program: determine the partitioning parameters based on the outline information of the virtual character; and partition the scene area according to the partitioning parameters to obtain multiple sub-scene areas.
[0155] Optionally, the processor may also be configured to perform the following steps via a computer program: determining a first bounding box for the virtual character, wherein the first bounding box is used to characterize the outline information of the area occupied by the virtual character in the virtual scene; and determining the side length of the sub-scene area based on the side length of the first bounding box.
[0156] Optionally, the processor may also be configured to perform the following steps via a computer program: determining the side length of the sub-scene region as the result of adjusting the side length of the first bounding box by a target coefficient, wherein the target coefficient is determined by the movement range of the virtual character, so that the side length of the sub-scene region is greater than the movement range of the virtual character.
[0157] Optionally, the processor may also be configured to perform the following steps via a computer program: determining a first bounding box for the virtual character and a second bounding box for the scene region, wherein the first bounding box is used to characterize the outline information of the area occupied by the virtual character in the virtual scene, and the second bounding box is used to characterize the outline information of the scene region; and determining partitioning parameters based on the first and second bounding boxes.
[0158] Optionally, the processor may also be configured to perform the following steps via a computer program: determining at least one of the following for a sub-scene region according to partitioning parameters: region location, the location of the corresponding depth camera, and region identifier.
[0159] Optionally, the processor may also be configured to perform the following steps via a computer program: determining the shooting area of the depth camera on the virtual scene based on the sub-scene region, wherein the sub-scene region is located within the shooting area; and acquiring a first depth map captured by the depth camera on the shooting area.
[0160] Optionally, the processor may also be configured to perform the following steps via a computer program: the first depth maps corresponding to two adjacent sub-scene regions respectively include the depth maps of the same part of the first virtual object.
[0161] Optionally, in response to the second virtual object moving to the sub-scene area, a second depth map of the first virtual object and the second virtual object captured by the depth camera in the shooting area is obtained; the second depth map is created as a second shadow map, and the second target shadow is rendered and displayed on the virtual character based on the second shadow map, wherein the second target shadow is the shadow formed by the first virtual object and the second virtual object on the virtual character.
[0162] Optionally, the virtual object retrieved from the database based on the region identifier of the sub-scene region is determined as the first virtual object, wherein the database stores the correspondence between the region identifier and the virtual objects contained in the sub-scene region.
[0163] In the electronic device of this embodiment, the scene area of the virtual scene and the outline information of the virtual character in the virtual scene are determined; the scene area is divided based on the outline information to obtain multiple sub-scene areas, wherein the outline of each sub-scene area is larger than the outline of the virtual character; a first virtual object contained in the sub-scene area is baked to obtain a first depth map of the first virtual object; a first shadow map is created using the first depth map; and a first target shadow is rendered and displayed on the virtual character based on the first shadow map, wherein the first target shadow is the shadow formed by the first virtual object on the virtual character, thereby solving the technical problem of not being able to achieve a shadow effect that meets the requirements of the virtual scene, and achieving the technical effect of achieving a shadow effect that meets the requirements of the virtual scene.
[0164] Figure 7 This is a schematic diagram of an electronic device according to an embodiment of this application. Figure 7 As shown, the electronic device 700 is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0165] like Figure 7 As shown, the electronic device 700 is presented in the form of a general-purpose computing device. The components of the electronic device 700 may include, but are not limited to: at least one processor 710, at least one memory 720, a bus 730 connecting different system components (including memory 720 and processor 710), and a display 740.
[0166] The memory 720 stores program code that can be executed by the processor 710, causing the processor 710 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this application.
[0167] The memory 720 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 7201 and / or cache memory 7202, and may further include read-only memory (ROM) 7203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0168] In some instances, memory 720 may also include a program / utility 7204 having a set (at least one) of program modules 7205, 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 720 may further include memory remotely located relative to processor 710, which can be connected to electronic device 700 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.
[0169] Bus 730 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 710, or a local bus using any of the various bus structures.
[0170] The display 740 may be, for example, a touchscreen liquid crystal display (LCD) that allows a user to interact with the user interface of the electronic device 700.
[0171] Optionally, the electronic device 700 can also communicate with one or more external devices 700 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 700, and / or any device that enables the electronic device 700 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 750. Furthermore, the electronic device 700 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 a network adapter 760. Figure 7 As shown, network adapter 760 communicates with other modules of electronic device 700 via bus 730. It should be understood that, although... Figure 7 As not shown, other hardware and / or software modules may be used in conjunction with electronic device 700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0172] The aforementioned electronic device 700 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.
[0173] Those skilled in the art will understand that Figure 7 The structure shown is for illustrative purposes only and does not limit the structure of the electronic device described above. For example, the electronic device 700 may also include components that are more... Figure 7 The more or fewer components shown, or having the same Figure 1 Different configurations are shown. The memory 720 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the information processing method in this embodiment. The processor 710 executes various functional applications and data processing by running the computer program stored in the memory 720, thereby implementing the aforementioned information processing method.
[0174] 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.
[0175] 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.
[0176] 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.
[0177] 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.
[0178] 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.
[0179] 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.
[0180] 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. An information processing method, characterized in that, include: Determine the scene area of the virtual scene and the outline information of the virtual characters in the virtual scene; The scene area is divided based on the contour information to obtain multiple sub-scene areas, wherein the contour of each sub-scene area is larger than the contour of the virtual character. Baking is performed on the first virtual object contained in the sub-scene region to obtain a first depth map of the first virtual object; A first shadow map is created using the first depth map; The first target shadow is rendered and displayed on the virtual character based on the first shadow map, wherein the first target shadow is the shadow cast by the first virtual object on the virtual character; Wherein, the first depth maps corresponding to two adjacent sub-scene regions respectively include the same portion of the depth map of the first virtual object.
2. The method according to claim 1, characterized in that, The scene region is divided based on the contour information to obtain multiple sub-scene regions, including: The segmentation parameters are determined based on the outline information of the virtual character; The scene region is divided according to the division parameters to obtain the multiple sub-scene regions.
3. The method according to claim 2, characterized in that, Determining segmentation parameters based on the outline information of the virtual character includes: A first bounding box for the virtual character is determined, wherein the first bounding box is used to characterize the outline information of the area occupied by the virtual character in the virtual scene; The side length of the sub-scene region is determined based on the side length of the first bounding box.
4. The method according to claim 3, characterized in that, Determining the side length of the sub-scene region based on the side length of the first bounding box includes: The result of adjusting the side length of the first bounding box by the target coefficient is determined as the side length of the sub-scene region, wherein the target coefficient is determined by the movement amplitude of the virtual character, so that the side length of the sub-scene region is greater than the movement amplitude of the virtual character.
5. The method according to claim 2, characterized in that, Determining segmentation parameters based on the outline information of the virtual character includes: A first bounding box for the virtual character and a second bounding box for the scene region are determined, wherein the first bounding box is used to represent the outline information of the area occupied by the virtual character in the virtual scene, and the second bounding box is used to represent the outline information of the scene region; The partitioning parameters are determined based on the first bounding box and the second bounding box.
6. The method according to claim 5, characterized in that, The scene region is divided according to the aforementioned division parameters to obtain the plurality of sub-scene regions, including: The sub-scene region is determined according to the division parameters by at least one of the following: region location, the location of the corresponding depth camera, and region identifier.
7. The method according to claim 6, characterized in that, Baking the first virtual object contained in the sub-scene region to obtain the first depth map includes: The shooting area of the depth camera on the virtual scene is determined based on the sub-scene area, wherein the sub-scene area is located within the shooting area; The first depth map captured by the depth camera in the shooting area is obtained.
8. The method according to claim 6, characterized in that, The method further includes: In response to the second virtual object moving to the sub-scene area, a second depth map of the first virtual object and the second virtual object captured by the depth camera in the shooting area is obtained; The second depth map is created as a second shadow map, and a second target shadow is rendered and displayed on the virtual character based on the second shadow map, wherein the second target shadow is the shadow formed on the virtual character by the first virtual object and the second virtual object together.
9. The method according to claim 6, characterized in that, The method further includes: The virtual object retrieved from the database based on the region identifier of the sub-scene region is determined as the first virtual object, wherein the database stores the correspondence between the region identifier and the virtual objects contained in the sub-scene region.
10. An information processing device, characterized in that, include: The determining unit is used to determine the scene area of the virtual scene and the outline information of the virtual characters in the virtual scene; A segmentation unit is used to segment the scene region based on the contour information to obtain multiple sub-scene regions, wherein the contour of each sub-scene region is larger than the contour of the virtual character; A baking unit is used to bake a first virtual object contained in the sub-scene area to obtain a first depth map of the first virtual object; A creation unit is used to create a first shadow map using the first depth map; A rendering unit is configured to render and display a first target shadow representation on the virtual character based on the first shadow map, wherein the first target shadow representation is the shadow cast by the first virtual object on the virtual character; Wherein, the first depth maps corresponding to two adjacent sub-scene regions respectively include the same portion of the depth map of the first virtual object.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the method described in any one of claims 1 to 9 when run by a processor.
12. 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 described in any one of claims 1 to 9.
Citation Information
Patent Citations
Object rendering method and device, storage medium and electronic device
CN108564646A
Model rendering method and device, electronic equipment and storage medium
CN114943795A