Silhouette processing method and apparatus, storage medium, and electronic device
By defining the area to be viewed in a 3D virtual scene and performing transparency homogenization, the problems of poor flexibility and uneven transparency in existing silhouette effect production methods are solved, thus improving the rendering quality of virtual model occlusion effects.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NETEASE (HANGZHOU) NETWORK CO LTD
- Filing Date
- 2023-02-28
- Publication Date
- 2026-05-01
AI Technical Summary
Existing technologies for creating silhouette effects for virtual models lack flexibility and cannot achieve uniform transparency rendering results, especially in global processing methods and dual rendering processes.
Based on the current perspective of the 3D virtual scene, the area to be viewed is determined and the target silhouette area is obtained. The first processing result is obtained through transparency uniformity processing, and finally it is rendered onto the target display screen, improving the flexibility and transparency uniformity of silhouette processing.
This improves the flexibility and uniformity of silhouette processing in virtual model occlusion effects, enhancing the visual realism and user experience of virtual scenes.
Smart Images

Figure CN116228954B_ABST
Abstract
Description
Silhouette processing methods, apparatus, storage media and electronic devices Technical Field
[0001] This application relates to the field of computer technology, and more specifically, to a silhouette processing method, apparatus, storage medium, and electronic device. Background Technology
[0002] In the rendering and production of 3D virtual scenes, it is often necessary to represent the occlusion effect between multiple virtual models. This occlusion effect is achieved by rendering the silhouette of the occluded part of the virtual model. Existing solutions mainly provide the following two methods for creating the silhouette effect of the occluded part of the virtual model.
[0003] The first method involves first outputting a depth map containing only the virtual model that needs to display perspective. Then, in post-processing, this depth map is compared with the scene depth map to identify the occluded parts, and finally, a texture of the occluded parts is overlaid onto the screen. However, this method has a drawback: as a global processing approach, it cannot label individual virtual models, and the output is a global result. In other words, all silhouette effects in the entire scene can only have their color and transparency adjusted uniformly, resulting in low flexibility.
[0004] The second method uses two rendering passes for virtual models that require a perspective effect. The first pass renders normally, while the second pass renders fragments using a depth test. In other words, the second pass only renders the occluded parts of the virtual model. However, this method has a drawback: it can only achieve opaque perspective effects. For virtual models with transparency, the rendered occluded parts will overlap, and the transparency will not be uniform.
[0005] There is currently no effective solution to the above problems.
[0006] 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
[0007] At least some embodiments of this application provide a silhouette processing method, apparatus, storage medium, and electronic device to at least solve the technical problems of poor flexibility and inability to achieve uniform transparency rendering results in the related art methods for creating silhouette effects corresponding to virtual models using post-processing or dual rendering processes.
[0008] According to one embodiment of this application, a silhouette processing method is provided, comprising: determining a region to be perspectived based on the current viewpoint of a three-dimensional virtual scene, wherein the region to be perspectived is the region corresponding to the part of a first virtual model in the three-dimensional virtual scene that is occluded by a second virtual model; obtaining a target silhouette region corresponding to the region to be perspectived, wherein the target silhouette region is a screen space pixel region to be rendered within the target display screen; performing transparency uniformization processing on the target silhouette region to obtain a first processing result; and rendering the first processing result onto the target display screen.
[0009] According to one embodiment of this application, a silhouette processing apparatus is also provided, comprising: a determining module, configured to determine a region to be viewed based on the current viewpoint of a three-dimensional virtual scene, wherein the region to be viewed is the region corresponding to the part of a first virtual model in the three-dimensional virtual scene that is occluded by a second virtual model; an acquiring module, configured to acquire a target silhouette region corresponding to the region to be viewed, wherein the target silhouette region is a screen space pixel region to be rendered within a target display screen; a processing module, configured to perform transparency uniformization processing on the target silhouette region to obtain a first processing result; and a rendering module, configured to render the first processing result onto the target display screen.
[0010] 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 silhouette processing method described in any of the above claims when it is run.
[0011] 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 silhouette processing method described in any of the preceding claims.
[0012] In at least some embodiments of this application, based on the current viewpoint of the 3D virtual scene, a region to be viewed is determined, wherein the region to be viewed is the area corresponding to the part of the first virtual model in the 3D virtual scene that is occluded by the second virtual model; a target silhouette region corresponding to the region to be viewed is obtained, wherein the target silhouette region is the screen space pixel region to be rendered in the target display screen; the transparency of the target silhouette region is uniformized to obtain a first processing result; and the first processing result is rendered to the target display screen. Thus, the method provided by this application achieves the goal of obtaining a display screen with a silhouette effect containing uniform transparency based on the occluded part of the virtual model, thereby improving the flexibility and uniformity of transparency in the silhouette processing during the creation of the virtual model occlusion effect. This solves the technical problems of poor flexibility and inability to achieve uniform transparency rendering results in related technologies that use post-processing or dual rendering processes to create silhouette effects corresponding to virtual models. Attached Figure Description
[0013] 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:
[0014] 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:
[0015] Figure 1 is a schematic diagram of the occlusion effect of a virtual model according to existing technology;
[0016] Figure 2 is a schematic diagram of the occlusion effect of another virtual model based on the prior art;
[0017] Figure 3 is a schematic diagram of another virtual model occlusion effect based on the prior art;
[0018] Figure 4 is a schematic diagram of the occlusion effect of another virtual model based on the prior art;
[0019] Figure 5 is a hardware structure block diagram of a mobile terminal according to a silhouette processing method according to one embodiment of the present application;
[0020] Figure 6 is a flowchart of a silhouette processing method according to one embodiment of the present application;
[0021] Figure 7 is a schematic diagram of the silhouette rendering result of an optional virtual character model according to one embodiment of this application;
[0022] Figure 8 is a schematic diagram of the result of superimposing semi-transparent sheets;
[0023] Figure 9 is a schematic diagram of a pixel arrangement in an image;
[0024] Figure 10 is a schematic diagram of the transparency distribution of screen pixels according to one embodiment of this application;
[0025] Figure 11 is a schematic diagram of a patch overlay result according to one embodiment of this application;
[0026] Figure 12 is a schematic diagram of an optional silhouette rendering result according to one embodiment of this application;
[0027] Figure 13 is a partial enlarged view of an optional silhouette rendering result according to one embodiment of this application;
[0028] Figure 14 is a schematic diagram of a silhouette rendering result of an optional smoothing process according to one embodiment of this application;
[0029] Figure 15 is a partial enlarged view of a silhouette rendering result of an optional smoothing process according to one embodiment of the present application;
[0030] Figure 16 is a schematic diagram of an optional adjusted silhouette rendering result according to one embodiment of this application;
[0031] Figure 17 is a schematic diagram of another optional adjusted silhouette rendering result according to one embodiment of the present application;
[0032] Figure 18 is a schematic diagram of another optional adjusted silhouette rendering result according to one embodiment of the present application;
[0033] Figure 19 is a structural block diagram of a silhouette processing apparatus according to one embodiment of the present application;
[0034] Figure 20 is a structural block diagram of an optional silhouette processing apparatus according to an embodiment of this application;
[0035] Figure 21 is a schematic diagram of an electronic device according to an embodiment of this application. Detailed Implementation
[0036] 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.
[0037] 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.
[0038] 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.
[0039] Figure 1 is a schematic diagram of a virtual model occlusion effect according to existing technology. As shown in Figure 1, in a 3D virtual scene, it is common to encounter situations where multiple virtual models occlude each other, such as the virtual wall model partially occluding the virtual task model in Figure 1. In a real-world scene, if the occluding object is opaque, then the occluded part of the object should be completely invisible. However, in a virtual scene (such as a virtual game scene), in order to show the user information about the occluded object, it is necessary to display the silhouette effect corresponding to the occluded part of the virtual model.
[0040] Figure 2 is a schematic diagram of another virtual model occlusion effect according to the prior art. The prior art provides a method for creating a silhouette effect of the occluded part of a virtual model in the post-processing stage: In the post-processing stage, the depth map sceneDepth of the virtual scene is output, and then the virtual model that needs to display the perspective effect (the virtual character model shown in Figure 2) is selected. A depth map customDepth containing only the selected virtual model is output. The scene depth map sceneDepth contains occlusion information, while the depth map customDepth of the selected simulation model does not contain occlusion information. The scene depth map sceneDepth and the depth map customDepth of the selected simulation model are compared to obtain the occluded part of the model. Then, in the post-processing stage of rendering, the occluded part is superimposed on the screen. As shown in Figure 2, the occluded part on the right side of the virtual character model is superimposed on the corresponding position of the virtual wall model in the scene image to obtain the occlusion effect of the virtual wall model on the virtual character model.
[0041] However, the drawback of the above method is that, as a global processing method, it cannot label individual virtual models, and the output result is a global result. In other words, all silhouette effects in the entire scene can only have their color and transparency adjusted uniformly, which is not flexible.
[0042] Existing technology also provides another method for creating a silhouette effect of occluded parts of a virtual model using a two-pass rendering process: the first pass is normal rendering, and the second pass completes fragment rendering through depth testing. In other words, the second pass only renders the occluded parts of the virtual model. Figure 3 is a schematic diagram of another virtual model occlusion effect according to existing technology. For an occluded virtual character, the above-mentioned silhouette effect creation method using two passes can achieve the opaque perspective effect shown in Figure 3. Figure 4 is a schematic diagram of another virtual model occlusion effect according to existing technology. As shown in Figure 4, for virtual models with transparency, the rendering result obtained using the above-mentioned silhouette effect creation method using two passes will show an overlapping effect, and the transparency is not uniform.
[0043] In view of the shortcomings of the two methods provided by the prior art, no effective solution has been proposed in the relevant technical field before this application.
[0044] In one possible implementation of this application, the inventors, after practice and careful research, found that the post-processing methods or 2-pass rendering methods commonly used in computer technology for creating scenes involving occlusion effects between virtual models still suffer from poor flexibility and the inability to achieve uniform transparency rendering results. Based on this, the application scenario of this application can be a computer image production scenario involving virtual model occlusion effects in the fields of virtual reality and virtual games, especially a rendering scenario of game scene images in the field of virtual games. The game type targeted by this scenario can be action, adventure, simulation, role-playing, and casual games, etc.
[0045] This application proposes a silhouette processing method for the area to be viewed in a three-dimensional virtual scene. It adopts the technical concept of obtaining a display screen with a silhouette effect containing uniform transparency based on the occluded part of the virtual model. This improves the flexibility and uniformity of transparency in the silhouette processing during the creation of the virtual model occlusion effect. It solves the technical problems of poor flexibility and inability to achieve uniform transparency rendering results in the related technologies that use post-processing or dual rendering processes to create the silhouette effect of the virtual model.
[0046] 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, PAD, game console, or other terminal device.
[0047] Figure 5 is a hardware structure block diagram of a mobile terminal according to one embodiment of the silhouette processing method of this application. As shown in Figure 5, the mobile terminal may include one or more (only one is shown in Figure 5) processors 502, memory 504, transmission devices 506, input / output devices 508, and display devices 510. Taking the silhouette processing method applied to a video game scene through this mobile terminal as an example, the processor 502 calls and runs the computer program stored in the memory 504 to execute the silhouette processing method. The generated target display screen of the video game scene is transmitted to the input / output device 508 and / or the display device 510 through the transmission device 506, thereby providing the target display screen to the player.
[0048] As still shown in Figure 5, the 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, Microcontroller Unit (MCU), Field Programmable Gate Array (FPGA), Neural-Network Processing Unit (NPU), Tensor Processing Unit (TPU), Artificial Intelligence (AI) type processors, etc.
[0049] Those skilled in the art will understand that the structure shown in Figure 5 is merely illustrative and does not limit the structure of the mobile terminal described above. For example, the mobile terminal may include more or fewer components than shown in Figure 5, or have a different configuration than that shown in Figure 5.
[0050] 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.
[0051] 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, CDN, and big data and artificial intelligence platforms. Taking the silhouette processing method applied to a video game scene via a video game server as an example, the video game server can generate a target display screen of the video game scene based on this silhouette processing method and provide this target display screen 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.).
[0052] According to one embodiment of this application, an embodiment of a silhouette 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.
[0053] This embodiment provides a silhouette processing method running on the aforementioned mobile terminal. Figure 6 is a flowchart of a silhouette processing method according to one embodiment of this application. As shown in Figure 6, the method includes the following steps:
[0054] Step S61: Based on the current viewpoint of the 3D virtual scene, determine the area to be viewed, wherein the area to be viewed is the area corresponding to the part of the first virtual model in the 3D virtual scene that is occluded by the second virtual model.
[0055] The aforementioned 3D virtual scene can be a 3D game scene in a virtual game. The corresponding game type can be: action (e.g., first-person or third-person shooter games, 2D or 3D fighting games, war action games, and sports action games), adventure (e.g., exploration games, collection games, puzzle games), simulation (e.g., sandbox simulation games, simulation games, strategy simulation games, city building simulation games, business simulation games), role-playing games, and casual (e.g., board games, casual competitive games, music rhythm games, dress-up games, etc.).
[0056] The current perspective of the aforementioned 3D virtual scene is the shooting perspective of the virtual camera set in the 3D virtual scene at the current moment. The first virtual model is an occluded object model in the 3D virtual scene, such as a virtual prop model, virtual item model, or virtual character model. The second virtual model is an occluded object model in the 3D virtual scene, such as a virtual building model, virtual wall model, or virtual smoke model. The area to be viewed is the region corresponding to the portion of the first virtual model occluded by the second virtual model.
[0057] Specifically, the area of the first virtual model occluded by the second virtual model within the aforementioned 3D virtual scene corresponds to the entire visible area of the first virtual model from the current viewpoint; that is, from the current viewpoint, the first virtual model is completely occluded by the second virtual model. Alternatively, the area of the first virtual model occluded by the second virtual model within the aforementioned 3D virtual scene corresponds to a portion of the visible area of the first virtual model from the current viewpoint; that is, from the current viewpoint, the first virtual model is partially occluded by the second virtual model.
[0058] Step S62: Obtain the target silhouette area corresponding to the area to be viewed, wherein the target silhouette area is the screen space pixel area to be rendered within the target display screen;
[0059] The target silhouette area corresponding to the area to be seen through is the screen space pixel area to be rendered within the target display screen. The target display screen is the screen display image after the silhouette of the area to be seen through is shown in the shooting scene image, which is the initial image captured by the virtual camera in the 3D virtual scene from the current viewpoint. The target silhouette area is the portion of the 3D virtual scene captured by the virtual camera from the current viewpoint that corresponds to the area to be seen through. Specifically, the target silhouette area is the display area of the portion of the first virtual model occluded by the second virtual model in the target display screen, which is also the screen space pixel area to be rendered.
[0060] Step S63: Perform transparency equalization processing on the target silhouette area to obtain the first processing result;
[0061] In one optional embodiment of this application, a technician determines the processing dimension for uniformity processing according to scene requirements, and performs transparency uniformity processing on the target silhouette area within this processing dimension. The processing dimension can be a pre-divided image block dimension, a patch dimension determined according to preset rules, or a pixel dimension. Taking the pixel dimension as an example, within the target display screen, the pixel representation of the target silhouette area is adjusted to achieve uniform transparency. Therefore, the obtained first processing result can uniformly represent the silhouette effect corresponding to the portion of the first virtual model occluded by the second virtual model, thereby overcoming the problem of existing methods failing to achieve uniformly transparent silhouette rendering results.
[0062] Step S64: Render the first processing result onto the target display screen.
[0063] In step S64 above, the first processing result is rendered onto the target display screen. That is, the process of obtaining the first processing result occurs during or before the rendering process, facilitating flexible control over the transparency, color, and individual differences of the silhouette effect. Furthermore, since the first processing result can represent the silhouette effect corresponding to the portion of the first virtual model occluded by the second virtual model with uniform transparency, the occlusion effect between virtual models presented in the target display screen can have a higher degree of physical realism, thus enhancing the user experience when this target display screen is provided to the user.
[0064] According to steps S61 to S64 above, in at least some embodiments of this application, based on the current viewpoint of the three-dimensional virtual scene, a region to be viewed is determined, wherein the region to be viewed is the region corresponding to the part of the first virtual model occluded by the second virtual model in the three-dimensional virtual scene; a target silhouette region corresponding to the region to be viewed is obtained, wherein the target silhouette region is the screen space pixel region to be rendered in the target display screen; the transparency of the target silhouette region is uniformized to obtain a first processing result; and the first processing result is rendered to the target display screen. Thus, the method provided by this application achieves the purpose of obtaining a display screen with a silhouette effect containing uniform transparency based on the occluded part of the virtual model, thereby improving the flexibility and uniformity of transparency in the silhouette processing during the virtual model occlusion effect production process, and solving the technical problems of poor flexibility and inability to achieve uniform transparency rendering results in the related technologies that use post-processing or dual rendering processes to produce silhouette effects corresponding to virtual models.
[0065] The silhouette processing method provided in this application can be applied, but is not limited to, computer image production scenarios involving virtual model occlusion effects in the fields of virtual reality, virtual games, and other technical fields, especially rendering scenarios of game scene images in the field of virtual games. For example, this application embodiment can be applied to rendering scenarios where the silhouette of a virtual character model is occluded by a virtual wall model in a virtual game scene. The specific technical solution of the silhouette processing method in this application embodiment will be further described below using this rendering scenario as an example.
[0066] Optionally, in step S62, obtaining the target silhouette region corresponding to the region to be viewed may include the following steps:
[0067] Step S621: Within the area to be viewed, obtain the screen space pixels corresponding to each fragment among the multiple fragments contained in the partial model;
[0068] Step S622: Determine the target silhouette region based on screen space pixels.
[0069] In the above optional implementation, the screen space pixels refer to the screen position coordinates of the screen pixel point corresponding to the screen pixel point of each fragment among the multiple fragments included in the above partial model displayed in the above area to be viewed. The target silhouette area is determined based on the screen space pixels; specifically, the pixel area corresponding to the silhouette to be rendered within the screen space is determined based on the screen space pixels.
[0070] Taking the rendering scene of a virtual character model whose silhouette is partially obscured by a virtual wall model in a virtual game scene as an example, this application embodiment further improves upon the silhouette rendering method provided by related technologies using a 2-pass approach. As still shown in Figure 1, in this example, the virtual character model is partially obscured by the virtual wall model from the current viewpoint, and the virtual character model is a model that needs to display a perspective effect.
[0071] The virtual character model's material is rendered using two passes. The first pass (hereinafter referred to as pass1) renders the virtual character model normally to the scene, while the second pass (hereinafter referred to as pass2) renders the occluded parts of the virtual character model. Specifically, when using pass1 to render the virtual character model, stencil testing is used to mark elements to address self-occlusion. When using pass2 to render the virtual character model, the depth test mode is set to: no depth is written, and depth comparison only passes fragments with a depth greater than the current depth (this mode is denoted as TestNoWriteGreater); simultaneously, the stencil test is configured to: not render marked fragments to further address the self-occlusion issue.
[0072] It's easy to understand that for virtual character models with transparency, if the self-occlusion problem isn't addressed, the generated silhouette will have uneven transparency. The overlap caused by self-occlusion will reduce the transparency of the overlapping areas. Therefore, solving the self-occlusion problem of the virtual character model through pass2 can improve the uniformity of the silhouette's transparency.
[0073] Furthermore, taking the rendering scene of a virtual character model's silhouette being obscured by a virtual wall model in a virtual game scene as an example, Figure 7 is a schematic diagram of an optional virtual character model silhouette rendering result according to one embodiment of this application. When drawing the virtual character model using pass2, setting the transparency to 1 (i.e., completely opaque) can achieve a solid color opaque perspective effect as shown in Figure 7. However, in the silhouette rendering result shown in Figure 7, because the silhouette of the obscured part of the virtual character model is opaque, it completely obscures the corresponding area of the virtual wall model, which reduces the overall visual effect of the scene. Therefore, it is necessary to add transparency to the silhouette rendering result.
[0074] Figure 8 is a schematic diagram of the result of overlapping semi-transparent patches. As shown in Figure 8, when two semi-transparent patches are overlapped, the transparency of the overlapping part decreases, resulting in uneven transparency across the entire patch area. Based on this principle, if the existing method of silhouette rendering using a 2-pass approach is followed, and the transparency value is set to 0.4 when drawing the virtual character model using pass 2, an unevenly transparent silhouette effect as shown in Figure 4 will be obtained. In response, the silhouette processing method provided in this application can perform transparency uniformity processing on the target silhouette area at the pixel level. The specific improved technical solution is as follows.
[0075] Figure 9 is a schematic diagram of a pixel arrangement. As shown in Figure 8, when a game scene is displayed on a display device (such as a screen) of an electronic device, the scene is composed of multiple square pixels arranged in a regular pattern. Each pixel presents a color (the display color is not shown in Figure 9 to show the arrangement of the pixels). The display of the target scene can be achieved by controlling the display color of multiple pixels by the fragment shader.
[0076] Furthermore, by obtaining the screen space position (i.e., pixel position) of the fragment (i.e. pixel point) corresponding to the area of the silhouette to be displayed in the game engine, and calculating the screen space position, the pixel area corresponding to the silhouette to be rendered of the virtual character model in the screen space can be determined.
[0077] Optionally, in step S63, performing transparency homogenization on the target silhouette area to obtain the first processing result may include the following steps:
[0078] Step S631: Determine multiple first pixels and multiple second pixels contained within the target silhouette area, wherein the multiple first pixels and multiple second pixels have different transparency.
[0079] Step S632: Perform transparency equalization processing on multiple first pixels and multiple second pixels within the target silhouette area to obtain the first processing result.
[0080] Continuing with the example of rendering a silhouette of a virtual character model partially obscured by a virtual wall model in a virtual game scene, when uniformizing the transparency of the target silhouette area in the pixel dimension, the aforementioned multiple first pixels are completely transparent pixels, and the aforementioned multiple second pixels are opaque pixels. Alternatively, the aforementioned multiple first pixels are opaque pixels, and the aforementioned multiple second pixels are completely transparent pixels.
[0081] The silhouette of the virtual character model to be rendered is located within the corresponding pixel area in screen space. The transparency of the completely transparent and opaque pixels is then uniformly adjusted to obtain the first processing result. This uniform transparency adjustment can be achieved by adjusting the pixel distribution.
[0082] In particular, in another alternative implementation, the transparency of the target silhouette region is uniformly processed in the image block dimension, which can be divided according to pixels. For example, each 4×4 pixels is divided into an image block, and any two adjacent image blocks have different transparency.
[0083] Optionally, in step S632, performing transparency homogenization processing on multiple first pixels and multiple second pixels within the target silhouette area to obtain a first processing result may include the following steps:
[0084] Step S6321: Multiple first pixels and multiple second pixels are alternately distributed within the target silhouette area to determine the positions of the first pixels and the second pixels. The position of the first pixel is the screen space pixel position corresponding to each of the multiple first pixels, and the position of the second pixel is the screen space pixel position corresponding to each of the multiple second pixels.
[0085] Step S6322: Set the transparency corresponding to the first pixel position to the first transparency and set the transparency corresponding to the second pixel position to the second transparency to obtain the first processing result.
[0086] Taking the rendering scene of a virtual character model's silhouette partially obscured by a virtual wall model in a virtual game scene as an example, based on the screen space positions (i.e., pixel positions) of multiple fragments (i.e., pixels) corresponding to the area of the silhouette to be displayed obtained from the game engine, completely transparent pixels and opaque pixels are alternately distributed to determine the first pixel position and the second pixel position. For example, the number of pixel rows and columns of each pixel is calculated using the screen space positions. Further, the pixel positions where the number of pixel rows and columns are both odd or both even are determined as the first pixel position, and the other pixel positions are determined as the second pixel positions. Further, the transparency of the pixels at the first pixel position is set to 0, and the transparency of the pixels at the second pixel position is set to 1, resulting in the first processing result described above.
[0087] Figure 10 is a schematic diagram of the transparency distribution of screen pixels according to one embodiment of this application. As shown in Figure 10, white pixels represent pixels with a transparency of 1 (i.e., completely opaque), and black pixels represent pixels with a transparency of 0 (i.e., completely transparent). As shown in Figure 10, when using pass2 to draw the virtual character model, two transparency values are assigned to multiple pixels corresponding to the scene screen, namely transparency of 1 and transparency of 0. When assigning values, white pixels and black pixels are distributed alternately (similar to the distribution of a chessboard).
[0088] Figure 11 is a schematic diagram of a patch overlay result according to one embodiment of this application. As shown in Figure 11, when the pixel transparency distribution method shown in Figure 10 is adopted, when two patches are overlaid, the corresponding pixels in the other patch that are overlaid with transparent pixels (transparency 0) of one patch are also transparent pixels (transparency 0). Similarly, the corresponding pixels in the other patch that are overlaid with opaque pixels (transparency 1) of one patch are also opaque pixels (transparency 1). Therefore, when patches are overlaid, the transparency of each pixel does not change due to overlay, and there is no problem of uneven transparency in the entire patch overlay area. In other words, the above method can solve the problem of uneven transparency in the silhouette rendering result in the silhouette processing method provided by the related technology.
[0089] Optionally, in step S6322, setting the transparency corresponding to the first pixel position to a first transparency and setting the transparency corresponding to the second pixel position to a second transparency to obtain the first processing result may include the following execution steps:
[0090] Step S6323: Set the transparency corresponding to the first pixel position to the first transparency and set the transparency corresponding to the second pixel position to the second transparency to obtain the second processing result;
[0091] Step S6324: Perform mesh weakening on the second processing result to obtain the first processing result.
[0092] Taking the rendering scene of a virtual character model being partially obscured by a virtual wall model in a virtual game scene as an example, after setting the transparency of multiple pixels in the area to be rendered to a mix of fully transparent and opaque pixels (equivalent to the second processing result mentioned above), further mesh weakening processing can make the final first processing result have a smoother visual effect.
[0093] Optionally, in step S6324, performing mesh weakening processing on the second processing result to obtain the first processing result may include the following execution steps:
[0094] Step S6325: The second processing result is subjected to mesh weakening processing using a preset anti-aliasing method to obtain the first processing result.
[0095] The aforementioned preset anti-aliasing method can be a commonly used anti-aliasing method, such as Fast Approximate Anti-Aliasing (FXAA) and Temporal Anti-Aliasing (TAA), etc., and this application embodiment does not limit it.
[0096] Optionally, in step S64, rendering the first processing result to the target display screen may include the following steps:
[0097] Step S641: Perform the first rendering operation on the first virtual model and the second virtual model based on the current viewpoint to obtain the initial display screen, wherein the initial display screen is used to present that part of the model in the first virtual model is occluded by the second virtual model;
[0098] Step S642: Perform a secondary rendering operation on the first processing result to obtain the target display screen, wherein the target display screen is used to present the default silhouette corresponding to the first processing result.
[0099] Taking the rendering scene of rendering the silhouette of a virtual character model that is partially obscured by a virtual wall model in a virtual game scene as an example, the first rendering operation of the virtual character model and the virtual wall model based on the current view can be the normal rendering operation of the virtual character model using pass1, which renders the above initial display screen. In the initial display screen, part of the virtual character model is obscured by the virtual wall model, which is the rendering result shown in Figure 1.
[0100] Furthermore, pass2 is used to perform a second rendering of the first processing result to obtain the target display screen. This target display screen shows the silhouette of the occluded part of the virtual character model.
[0101] Figure 12 is a schematic diagram of an optional silhouette rendering result according to one embodiment of the present application, and Figure 13 is a partial enlarged view of an optional silhouette rendering result according to one embodiment of the present application. As shown in Figure 12, by setting the transparency of fragments based on their screen spatial position, the silhouette ultimately displayed in the area to be displayed can have uniform transparency. As shown in Figure 13, the uniform transparency of the silhouette is achieved by alternating transparent and opaque fragments. This fragment distribution method can solve the self-occlusion problem of virtual character models, thereby avoiding the phenomenon of uneven silhouette transparency.
[0102] Further, Figure 14 is a schematic diagram of a silhouette rendering result with optional smoothing processing according to one embodiment of the present application, and Figure 15 is a partial enlarged view of a silhouette rendering result with optional smoothing processing according to one embodiment of the present application. In the silhouette rendering result shown in Figure 13, since the fragments (i.e., pixels) are square, a jagged effect may occur when displaying in high-definition images. To address this, an anti-aliasing method is used to smooth the silhouette rendering results shown in Figures 12 and 13, resulting in the processed silhouette rendering results shown in Figures 14 and 15. It is readily apparent that the anti-aliasing processing reduces the grid-like effect of the silhouette rendering result, improving the visual effect of the scene and the user experience.
[0103] Optionally, the above silhouette processing method may further include the following steps:
[0104] Step S651: Adjust the cell properties of the default silhouette to obtain the adjusted silhouette, wherein the cell properties include at least one of the following: cell size, cell shape;
[0105] Step S652: Display the adjusted silhouette within the target display screen.
[0106] The cell attributes described above represent the display attributes of multiple fragments (i.e., multiple pixels) in the default silhouette. Adjusting the cell attributes of the default silhouette, that is, adjusting the fragment size and shape of the multiple fragments in the default silhouette, yields the adjusted silhouette. Furthermore, displaying the adjusted silhouette within the target display screen allows for flexible control over the style of the generated silhouette.
[0107] Continuing with the example of rendering a silhouette of a virtual character model partially obscured by a virtual wall model in a virtual game scene, the above implementation uses square fragments as an example. That is, the fragment shapes of the multiple fragments corresponding to the obtained default silhouette are all squares, as shown in Figure 13. Adjusting the fragment attributes of the default silhouette can yield silhouettes of various styles.
[0108] Figure 16 is a schematic diagram of an optional adjusted silhouette rendering result according to one embodiment of the present application; Figure 17 is a schematic diagram of another optional adjusted silhouette rendering result according to one embodiment of the present application; and Figure 18 is a schematic diagram of yet another optional adjusted silhouette rendering result according to one embodiment of the present application. By setting the fragment shape in the default silhouette shown in Figure 13 or Figure 15 to a curved rectangle and reducing its size, a silkscreen silhouette rendering result as shown in Figure 16 can be obtained. By enlarging the fragment size in the default silhouette, a silhouette rendering result with a more pronounced checkerboard effect as shown in Figure 17 can be obtained. By setting the fragment shape in the default silhouette to a rectangle, a blocky silhouette rendering result as shown in Figure 18 can be obtained.
[0109] 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.
[0110] This embodiment also provides a silhouette processing device for implementing the above embodiments and preferred embodiments; 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 device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0111] Figure 19 is a structural block diagram of a silhouette processing device according to one embodiment of this application. As shown in Figure 19, the device includes: a determining module 1901, used to determine a region to be viewed based on the current viewpoint of a three-dimensional virtual scene, wherein the region to be viewed is the region corresponding to the part of the first virtual model in the three-dimensional virtual scene that is occluded by a second virtual model; an acquiring module 1902, used to acquire a target silhouette region corresponding to the region to be viewed, wherein the target silhouette region is a screen space pixel region to be rendered in the target display screen; a processing module 1903, used to perform transparency uniformization processing on the target silhouette region to obtain a first processing result; and a rendering module 1904, used to render the first processing result to the target display screen.
[0112] Optionally, the acquisition module 1902 is further configured to: acquire the screen space pixels corresponding to each fragment among multiple fragments contained in the partial model within the area to be viewed; and determine the target silhouette area based on the screen space pixels.
[0113] Optionally, the processing module 1903 is further configured to: determine a plurality of first pixels and a plurality of second pixels contained within the target silhouette area, wherein the plurality of first pixels and the plurality of second pixels adopt different transparency; and perform transparency uniformization processing on the plurality of first pixels and the plurality of second pixels within the target silhouette area to obtain a first processing result.
[0114] Optionally, the processing module 1903 is further configured to: alternately distribute multiple first pixels and multiple second pixels within the target silhouette area; determine the positions of the first pixels and the second pixels, wherein the position of the first pixel is the screen space pixel position corresponding to each of the multiple first pixels, and the position of the second pixel is the screen space pixel position corresponding to each of the multiple second pixels; set the transparency corresponding to the first pixel position to a first transparency, and set the transparency corresponding to the second pixel position to a second transparency, to obtain a first processing result.
[0115] Optionally, the processing module 1903 is further configured to: set the transparency corresponding to the first pixel position to a first transparency, and set the transparency corresponding to the second pixel position to a second transparency, to obtain a second processing result; and perform mesh weakening processing on the second processing result to obtain a first processing result.
[0116] Optionally, the above-mentioned processing module 1903 is further configured to: perform mesh weakening processing on the second processing result using a preset anti-aliasing method to obtain the first processing result.
[0117] Optionally, the rendering module 1904 is further configured to: perform an initial rendering operation on the first virtual model and the second virtual model based on the current viewpoint to obtain an initial display screen, wherein the initial display screen is used to present a part of the model in the first virtual model being occluded by the second virtual model; and perform a secondary rendering operation on the first processing result to obtain a target display screen, wherein the target display screen is used to present the default silhouette corresponding to the first processing result.
[0118] Optionally, FIG20 is a structural block diagram of an optional silhouette processing device according to an embodiment of the present application. As shown in FIG20, in addition to all the modules shown in FIG19, the device further includes: an adjustment module 1905, used to adjust the cell attributes of the default silhouette to obtain an adjusted silhouette, wherein the cell attributes include at least one of the following: cell size, cell shape; and display the adjusted silhouette in the target display screen.
[0119] 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.
[0120] 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.
[0121] 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.
[0122] 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.
[0123] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0124] S1. Based on the current perspective of the 3D virtual scene, determine the area to be viewed, where the area to be viewed is the area corresponding to the part of the first virtual model in the 3D virtual scene that is occluded by the second virtual model.
[0125] S2, obtain the target silhouette area corresponding to the area to be viewed, where the target silhouette area is the screen space pixel area to be rendered within the target display screen;
[0126] S3, perform transparency homogenization processing on the target silhouette area to obtain the first processing result;
[0127] S4 renders the first processing result onto the target display screen.
[0128] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: within the area to be viewed, acquiring the screen space pixels corresponding to each of the multiple fragments contained in the partial model; and determining the target silhouette area based on the screen space pixels.
[0129] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: determining a plurality of first pixels and a plurality of second pixels contained within the target silhouette region, wherein the plurality of first pixels and the plurality of second pixels have different transparency; performing transparency homogenization processing on the plurality of first pixels and the plurality of second pixels within the target silhouette region to obtain a first processing result.
[0130] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: alternatingly distributing a plurality of first pixels and a plurality of second pixels within the target silhouette area; determining the positions of the first pixels and the second pixels, wherein the first pixel position is the screen space pixel position corresponding to each of the plurality of first pixels, and the second pixel position is the screen space pixel position corresponding to each of the plurality of second pixels; setting the transparency corresponding to the first pixel position to a first transparency, and setting the transparency corresponding to the second pixel position to a second transparency, to obtain a first processing result.
[0131] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: setting the transparency corresponding to the first pixel position to a first transparency, and setting the transparency corresponding to the second pixel position to a second transparency, to obtain a second processing result; performing mesh weakening processing on the second processing result to obtain a first processing result.
[0132] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: performing mesh weakening processing on the second processing result using a preset anti-aliasing method to obtain the first processing result.
[0133] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: performing an initial rendering operation on the first virtual model and the second virtual model based on the current viewpoint to obtain an initial display screen, wherein the initial display screen is used to present a portion of the model in the first virtual model being occluded by the second virtual model; performing a secondary rendering operation on the first processing result to obtain a target display screen, wherein the target display screen is used to present a default silhouette corresponding to the first processing result.
[0134] Optionally, the aforementioned computer-readable storage medium is further configured to store program code for performing the following steps: adjusting the cell properties of a default silhouette to obtain an adjusted silhouette, wherein the cell properties include at least one of the following: cell size, cell shape; and displaying the adjusted silhouette within a target display screen.
[0135] In the computer-readable storage medium of the above embodiments, a technical solution for implementing a silhouette processing method is provided. Based on the current viewpoint of a three-dimensional virtual scene, a region to be perspectived is determined, wherein the region to be perspectived is the region corresponding to the part of the model of the first virtual model in the three-dimensional virtual scene that is occluded by the second virtual model; a target silhouette region corresponding to the region to be perspectived is obtained, wherein the target silhouette region is the screen space pixel region to be rendered in the target display screen; the transparency of the target silhouette region is uniformized to obtain a first processing result; and the first processing result is rendered to the target display screen. Thus, the above method provided by this application achieves the purpose of obtaining a display screen with a silhouette effect containing uniform transparency based on the occluded part of the virtual model, thereby realizing the technical effect of improving the flexibility and transparency uniformity of silhouette processing in the virtual model occlusion effect production process, and solving the technical problems of poor flexibility and inability to achieve uniform transparency rendering results in the related art methods that use post-processing or dual rendering processes to produce silhouette effects corresponding to virtual models.
[0136] 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.
[0137] 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.
[0138] 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.
[0139] 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.
[0140] 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.
[0141] 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.
[0142] 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.
[0143] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0144] S1. Based on the current perspective of the 3D virtual scene, determine the area to be viewed, where the area to be viewed is the area corresponding to the part of the first virtual model in the 3D virtual scene that is occluded by the second virtual model.
[0145] S2, obtain the target silhouette area corresponding to the area to be viewed, where the target silhouette area is the screen space pixel area to be rendered within the target display screen;
[0146] S3, perform transparency homogenization processing on the target silhouette area to obtain the first processing result;
[0147] S4 renders the first processing result onto the target display screen.
[0148] Optionally, the processor may also be configured to perform the following steps via a computer program: within the area to be viewed, obtain the screen space pixels corresponding to each fragment among multiple fragments contained in the partial model; and determine the target silhouette area based on the screen space pixels.
[0149] Optionally, the processor may also be configured to perform the following steps via a computer program: determining a plurality of first pixels and a plurality of second pixels contained within the target silhouette region, wherein the plurality of first pixels and the plurality of second pixels have different transparency; performing transparency homogenization processing on the plurality of first pixels and the plurality of second pixels within the target silhouette region to obtain a first processing result.
[0150] Optionally, the processor may also be configured to perform the following steps via a computer program: alternately distributing multiple first pixels and multiple second pixels within the target silhouette area; determining the positions of the first pixels and the second pixels, wherein the first pixel position is the screen space pixel position corresponding to each of the multiple first pixels, and the second pixel position is the screen space pixel position corresponding to each of the multiple second pixels; setting the transparency corresponding to the first pixel position to a first transparency, and setting the transparency corresponding to the second pixel position to a second transparency, to obtain a first processing result.
[0151] Optionally, the processor may also be configured to perform the following steps via a computer program: setting the transparency corresponding to the first pixel position to a first transparency and setting the transparency corresponding to the second pixel position to a second transparency to obtain a second processing result; performing mesh weakening processing on the second processing result to obtain a first processing result.
[0152] Optionally, the processor may also be configured to perform the following steps via a computer program: perform mesh weakening on the second processing result using a preset anti-aliasing method to obtain the first processing result.
[0153] Optionally, the processor may also be configured to perform the following steps via a computer program: perform an initial rendering operation on the first virtual model and the second virtual model based on the current viewpoint to obtain an initial display screen, wherein the initial display screen is used to present a portion of the model in the first virtual model being occluded by the second virtual model; perform a secondary rendering operation on the first processing result to obtain a target display screen, wherein the target display screen is used to present the default silhouette corresponding to the first processing result.
[0154] Optionally, the processor may also be configured to perform the following steps via a computer program: adjusting the cell properties of the default silhouette to obtain an adjusted silhouette, wherein the cell properties include at least one of the following: cell size, cell shape; and displaying the adjusted silhouette within the target display screen.
[0155] In the electronic device described in the above embodiments, a technical solution for implementing a silhouette processing method is provided. Based on the current viewpoint of a three-dimensional virtual scene, a region to be viewed is determined, wherein the region to be viewed is the area corresponding to the part of a first virtual model occluded by a second virtual model within the three-dimensional virtual scene; a target silhouette region corresponding to the region to be viewed is obtained, wherein the target silhouette region is the screen space pixel region to be rendered within the target display screen; the target silhouette region undergoes transparency homogenization processing to obtain a first processing result; and the first processing result is rendered onto the target display screen. Therefore, the method provided in this application achieves the goal of obtaining a display screen containing a silhouette effect with uniform transparency based on the occluded part of the virtual model, thereby improving the flexibility and transparency uniformity of silhouette processing during the creation of virtual model occlusion effects. This solves the technical problems of poor flexibility and inability to achieve uniform transparency rendering results in related technologies that use post-processing methods or dual rendering processes to create silhouette effects corresponding to virtual models.
[0156] Figure 21 is a schematic diagram of an electronic device according to an embodiment of this application. As shown in Figure 21, the electronic device 2100 is merely an example and should not impose any limitation on the function and scope of use of the embodiments of this application.
[0157] As shown in Figure 21, the electronic device 2100 is presented in the form of a general-purpose computing device. The components of the electronic device 2100 may include, but are not limited to: at least one processor 2110, at least one memory 2120, a bus 2130 connecting different system components (including memory 2120 and processor 2110), and a display 2140.
[0158] The memory 2120 stores program code that can be executed by the processor 2110, causing the processor 2110 to perform the steps described in the method section of the embodiments of this application according to various exemplary implementations of this application.
[0159] The memory 2120 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 21201 and / or cache memory 21202, and may further include read-only memory (ROM) 21203, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory.
[0160] In some instances, memory 2120 may also include programs / utilities 21204 having a set (at least one) of program modules 21205, 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 2120 may further include memory remotely located relative to processor 2110, which can be connected to electronic device 2100 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.
[0161] Bus 2130 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 2110, or a local bus using any of the various bus structures.
[0162] Display 2140 may be, for example, a touch-screen liquid crystal display (LCD) that allows a user to interact with the user interface of electronic device 2100.
[0163] Optionally, the electronic device 2100 can also communicate with one or more external devices 2200 (e.g., keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 2100, and / or any device that enables the electronic device 2100 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 2150. Furthermore, the electronic device 2100 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 2160. As shown in Figure 21, the network adapter 2160 communicates with other modules of the electronic device 2100 via the bus 2130. It should be understood that, although not shown in Figure 21, other hardware and / or software modules may be used in conjunction with electronic device 2100, 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.
[0164] The aforementioned electronic device 2100 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.
[0165] Those skilled in the art will understand that the structure shown in FIG21 is merely illustrative and does not limit the structure of the electronic device described above. For example, the electronic device 2100 may also include more or fewer components than shown in FIG21, or have a different configuration than shown in FIG21. The memory 2120 can be used to store computer programs and corresponding data, such as the computer program and corresponding data corresponding to the silhouette processing method in the embodiments of this application. The processor 2110 executes various functional applications and data processing by running the computer program stored in the memory 2120, thereby implementing the silhouette processing method described above.
[0166] 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.
[0167] 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.
[0168] 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.
[0169] 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.
[0170] 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.
[0171] 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.
[0172] 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 silhouette processing method, characterized in that, include: Based on the current perspective of the 3D virtual scene, a region to be viewed is determined, wherein the region to be viewed is the area corresponding to the part of the first virtual model in the 3D virtual scene that is occluded by the second virtual model; a target silhouette region corresponding to the region to be viewed is obtained, wherein the target silhouette region is the screen space pixel region to be rendered in the target display screen; the transparency of the target silhouette region is uniformly processed to obtain a first processing result; the first processing result is rendered onto the target display screen; wherein the method further includes: setting the transparency corresponding to the first pixel position to a first transparency, and setting the transparency corresponding to the second pixel position to a second transparency to obtain a second processing result, wherein the first pixel position is determined based on the number of pixel rows and the number of pixel columns of each pixel in the screen space pixel region, and the second pixel position is determined based on the number of pixel rows and the number of pixel columns of each pixel in the screen space pixel region; the mesh weakening processing is performed on the second processing result to obtain the first processing result.
2. The silhouette processing method according to claim 1, characterized in that, Obtaining the target silhouette region corresponding to the region to be viewed includes: within the region to be viewed, obtaining the screen space pixels corresponding to each fragment among the multiple fragments contained in the partial model; and determining the target silhouette region based on the screen space pixels.
3. The silhouette processing method according to claim 1, characterized in that, Performing transparency homogenization processing on the target silhouette region to obtain the first processing result includes: determining a plurality of first pixels and a plurality of second pixels contained in the target silhouette region, wherein the plurality of first pixels and the plurality of second pixels have different transparency; performing transparency homogenization processing on the plurality of first pixels and the plurality of second pixels in the target silhouette region to obtain the first processing result.
4. The silhouette processing method according to claim 3, characterized in that, Performing transparency homogenization processing on the plurality of first pixels and the plurality of second pixels within the target silhouette area to obtain the first processing result includes: alternately distributing the plurality of first pixels and the plurality of second pixels within the target silhouette area; determining the positions of the first pixels and the second pixels, wherein the first pixel position is the screen space pixel position corresponding to each of the plurality of first pixels, and the second pixel position is the screen space pixel position corresponding to each of the plurality of second pixels; setting the transparency corresponding to the first pixel position to a first transparency, and setting the transparency corresponding to the second pixel position to a second transparency, to obtain the first processing result.
5. The silhouette processing method according to claim 1, characterized in that, The process of weakening the mesh of the second processing result to obtain the first processing result includes: weakening the mesh of the second processing result using a preset anti-aliasing method to obtain the first processing result.
6. The silhouette processing method according to claim 1, characterized in that, Rendering the first processing result to the target display screen includes: performing an initial rendering operation on the first virtual model and the second virtual model based on the current viewpoint to obtain an initial display screen, wherein the initial display screen is used to present a portion of the model in the first virtual model being occluded by the second virtual model; performing a second rendering operation on the first processing result to obtain the target display screen, wherein the target display screen is used to present a default silhouette corresponding to the first processing result.
7. The silhouette processing method according to claim 1, characterized in that, The silhouette processing method further includes: adjusting the cell attributes of the default silhouette to obtain an adjusted silhouette, wherein the cell attributes include at least one of the following: cell size, cell shape; and displaying the adjusted silhouette within the target display screen.
8. A silhouette processing device, characterized in that, include: A determining module is used to determine the area to be viewed based on the current viewpoint of the 3D virtual scene, wherein the area to be viewed is the area corresponding to the part of the first virtual model in the 3D virtual scene that is occluded by the second virtual model; an acquiring module is used to acquire the target silhouette area corresponding to the area to be viewed, wherein the target silhouette area is the screen space pixel area to be rendered in the target display screen; a processing module is used to perform transparency uniformization processing on the target silhouette area to obtain a first processing result; a rendering module is used to render the first processing result to the target display screen; wherein the processing module is further used to: set the transparency corresponding to the first pixel position to a first transparency, and set the transparency corresponding to the second pixel position to a second transparency to obtain a second processing result, wherein the first pixel position is determined based on the number of pixel rows and the number of pixel columns of each pixel in the screen space pixel area, and the second pixel position is determined based on the number of pixel rows and the number of pixel columns of each pixel in the screen space pixel area; and perform mesh weakening processing on the second processing result to obtain the first processing result.
9. 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 silhouette processing method according to any one of claims 1 to 7 when run by a processor.
10. 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 silhouette processing method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Image processing system
US20100134516A1