Scene interaction component rendering method and device, equipment, medium and program product
By responding to drawing instructions in a three-dimensional scene, determining the element information and calculating the depth relationship, the problem of insufficient expressiveness in a three-dimensional scene is solved, and the seamless integration of the interactive components and the three-dimensional environment and a more natural interactive experience are achieved.
Patent Information
- Application Number
- CN202411780866.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-03-04
AI Technical Summary
Traditional two-dimensional interactive components are insufficient in three-dimensional scenes and cannot seamlessly integrate with the three-dimensional environment to provide an intuitive and natural interactive experience.
By responding to the drawing instructions, the target element information of the scene interaction component is determined and the depth relationship with the target scene is calculated. Based on this information, the scene interaction component is rendered in the target scene.
Ensuring the correct three-dimensional depth level of the interactive components solves the problem of insufficient expressiveness in the three-dimensional scene, allowing the scene interaction components to seamlessly integrate with the three-dimensional environment, providing a more intuitive and natural interactive experience, and enhancing the user's immersion and realism.
Smart Images

Figure CN119559309A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a scene interaction component rendering method, device, equipment, medium and program product. Background Art
[0002] In games and virtual environments, interactive components and their user interfaces (UI) not only provide necessary information, but also guide players’ actions, serve as identifiers, prompts, and other functions, and enhance the user experience.
[0003] Although traditional two-dimensional interactive components in virtual scenes are powerful, they have limitations in terms of expressiveness and immersion. With the development of graphics technology, three-dimensional virtual scenes are becoming more and more complex and realistic, and interactive components need to be seamlessly integrated with the game environment to provide a more intuitive and natural interactive experience.
[0004] Therefore, there is an urgent need for a 3D interactive component rendering method that is closely integrated with the 3D scene. Summary of the invention
[0005] In view of this, an embodiment of the present invention provides a scene interaction component rendering method. One or more embodiments of the present invention also relate to a scene interaction component rendering device, a computing device, a computer-readable storage medium and a computer program product to solve the technical defects existing in the prior art.
[0006] According to a first aspect of an embodiment of the present invention, a scene interaction component rendering method is provided, comprising: In response to a drawing instruction for a scene interaction component in a target scene, when the drawing instruction indicates that the material type of the scene interaction component is a target material type, determining target primitive information corresponding to the scene interaction component; Calculate the depth relationship between the target primitive information and the target scene, where the depth relationship refers to the depth level of the scene interaction component in the target scene; Render scene interaction components in the target scene based on the depth relationship and target primitive information.
[0007] According to a second aspect of an embodiment of the present invention, a scene interaction component rendering device is provided, comprising: A determination module is configured to respond to a drawing instruction for a scene interaction component in a target scene, and determine target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is a target material type; A calculation module is configured to calculate a depth relationship between target primitive information and a target scene, wherein the depth relationship refers to a depth level of a scene interaction component in the target scene; The rendering module is configured to render the scene interaction component in the target scene based on the depth relationship and the target primitive information.
[0008] According to a third aspect of an embodiment of the present invention, there is provided a computing device, including: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer programs / instructions are executed by the processor, the steps of the above-mentioned scene interaction component rendering method are implemented.
[0009] According to a fourth aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program / instruction, and when the computer program / instruction is executed by a processor, the steps of the above-mentioned scene interaction component rendering method are implemented.
[0010] According to a fifth aspect of an embodiment of the present invention, there is provided a computer program product, comprising a computer program / instruction, which implements the steps of the above-mentioned scene interaction component rendering method when executed by a processor.
[0011] An embodiment of the present invention realizes responding to a drawing instruction for a scene interaction component in a target scene, and determining the target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is the target material type; calculating the depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to the depth level of the scene interaction component in the target scene; and rendering the scene interaction component in the target scene based on the depth relationship and the target primitive information. By responding to the drawing instruction and determining the primitive information of the scene interaction component, calculating its depth relationship with the target scene, and thus ensuring the correct three-dimensional depth level of the interaction component during rendering, the problem of insufficient expressiveness of traditional two-dimensional interaction components in three-dimensional scenes is solved, so that the scene interaction component can be seamlessly integrated with the three-dimensional environment, providing a more intuitive and natural interaction experience, and enhancing the user's immersion and sense of reality. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] Figure 1 It is an interaction schematic diagram of a scene interaction component rendering system provided by an embodiment of the present invention; Figure 2 is a flow chart of a scene interaction component rendering method provided by an embodiment of the present invention; Figure 3 It is a process flow chart of a scene interaction component rendering method provided by an embodiment of the present invention; Figure 4 It is a structural schematic diagram of a scene interaction component rendering device provided by an embodiment of the present invention; Figure 5It is a structural block diagram of a computing device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0013] Many specific details are set forth in the following description to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of the present invention, so the present invention is not limited to the specific implementation disclosed below.
[0014] The terms used in one or more embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of the present invention. The singular forms of "a", "said" and "the" used in one or more embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of the present invention refers to and includes any or all possible combinations of one or more associated listed items.
[0015] It should be understood that, although the terms first, second, etc. may be used to describe various information in one or more embodiments of the present invention, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present invention, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0016] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0017] First, the terms involved in one or more embodiments of the present invention are explained.
[0018] Pass: A processing or rendering stage in the rendering process.
[0019] Shader: Rendering shader, used to handle tasks such as vertex and pixel color calculation.
[0020] RenderBatch: A batch of vertex data that needs to be drawn together.
[0021] RenderTarget: Rendering target refers to the texture used to save rendering results.
[0022] FXAA: Fast Approximate Anti-Aliasing, a post-processing based anti-aliasing technology designed to reduce the jagged effect on the edges of images.
[0023] SDF: Signed Distance Field. A technology for representing geometric shapes. It is used to store the distance from each point in a two-dimensional or three-dimensional space to the nearest boundary point, and mark whether the distance is inside or outside.
[0024] Gamma space: refers to a nonlinear gradient color space in image processing and display technology. Gamma correction is a technique used to adjust image brightness to adapt to the nonlinear characteristics of the human visual system.
[0025] In the present invention, a scene interaction component rendering method is provided. The present invention also relates to a scene interaction component rendering system, a scene interaction component rendering device, a computing device, a computer-readable storage medium, and a computer program product, which are described in detail one by one in the following embodiments.
[0026] See also Figure 1 , Figure 1 It is an interactive schematic diagram of a scene interaction component rendering system provided by an embodiment of the present invention. The scene interaction component rendering system includes a user end and a server end, wherein the user end is used to send a drawing instruction for the scene interaction component in the target scene to the server end; the server end is used to respond to the drawing instruction for the scene interaction component in the target scene, and when the drawing instruction indicates that the material type of the scene interaction component is the target material type, determine the target primitive information corresponding to the scene interaction component; calculate the depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to the depth level of the scene interaction component in the target scene; and render the scene interaction component in the target scene based on the depth relationship and the target primitive information.
[0027] Applied to the scene interaction component rendering system, the correct rendering of the interaction component in the three-dimensional scene is achieved through the collaborative work of the client and the server. The user end sends drawing instructions for the scene interaction component in the target scene to the server, and the server responds to these instructions. When the drawing instructions indicate that the material type of the scene interaction component is the target material type, the server determines the target primitive information corresponding to the scene interaction component and calculates the depth relationship between the target primitive information and the target scene to ensure the correct three-dimensional depth level of the scene interaction component in the target scene. Based on these depth relationships and target primitive information, the server renders the scene interaction component in the target scene, thereby solving the problem of insufficient expressiveness of traditional two-dimensional interaction components in three-dimensional scenes, enabling the scene interaction component to seamlessly integrate with the three-dimensional environment, providing a more intuitive and natural interactive experience, and enhancing the user's sense of immersion and reality.
[0028] See also Figure 2 , Figure 2 It is a flowchart of a scene interaction component rendering method provided by an embodiment of the present invention, which specifically includes the following steps.
[0029] Step 202: In response to a drawing instruction for a scene interaction component in a target scene, when the drawing instruction indicates that the material type of the scene interaction component is a target material type, determine target primitive information corresponding to the scene interaction component.
[0030] Among them, scene interaction components refer to objects that users can interact with in the virtual environment, such as buttons, switches, map markers, etc. Target material types refer to materials with specific optical properties, such as transparent or translucent materials. Target primitive information refers to the specific geometric information required to draw scene interaction components, including shape, size, position, etc.
[0031] In actual applications, the system responds to a drawing instruction for a scene interaction component in a target scene, and checks whether the drawing instruction indicates that the material type of the scene interaction component is the target material type. If the drawing instruction does indicate that the material type is the target material type, the system will further determine the target primitive information corresponding to the scene interaction component. This means that the system needs to obtain geometric data related to the scene interaction component. For example, if the scene interaction component is a transparent map marker, the system needs to know the shape (such as circle, rectangle), size (such as width and height), position (such as screen coordinates), and transparency level of this marker. After determining this information, the system can correctly draw the interactive components and ensure that they can correctly interact with other elements in the scene, such as the occlusion effect of terrain or other objects.
[0032] For the step of determining the target primitive information corresponding to the scene interaction component, one implementation method is to read this information from the data structure of the scene interaction component. Another implementation method is to obtain this information by querying a database or calling an API. Regardless of which method is used, the system needs to ensure that the information obtained is accurate and can promptly reflect any changes made by the user or program to the scene interaction component.
[0033] In a specific embodiment of the present invention, a virtual scene contains map markers, mission objectives, NPC locations, etc. with transparent or translucent materials. These markers can be directly embedded in the scene and occlude and interact with the terrain and other objects. When the user issues a drawing instruction indicating that a transparent map marker needs to be drawn, the system first checks the drawing instruction to confirm that the material type of the scene interaction component required to be drawn is transparent or translucent. The system then determines the target primitive information corresponding to the map marker, including its shape (such as an arrow), size (such as 50x50 pixels), position (such as left of the center of the screen), and transparency (such as 50% transparent). With this information, the system can correctly draw the map marker into the virtual scene and ensure that it can correctly occlude other objects. For example, when the player approaches an NPC, a transparent map marker may be occluded by the NPC model, and vice versa.
[0034] Furthermore, in response to a drawing instruction for a scene interaction component in a target scene, when the drawing instruction indicates that the material type of the scene interaction component is a target material type, target primitive information corresponding to the scene interaction component is obtained, including: in response to a drawing instruction for a scene interaction component in a target scene, initializing a rendering pipeline corresponding to the target scene; extracting candidate primitive information corresponding to the candidate scene component in the process of calculating scene primitive visibility and culling in the rendering pipeline, wherein the candidate primitive information includes the material type; when the candidate primitive information includes the target material type, determining the candidate scene component as a scene interaction component, and using the candidate primitive information of the target material type as the target primitive information corresponding to the scene interaction component.
[0035] In actual applications, the system responds to the drawing instruction for the scene interaction component in the target scene, and first initializes the rendering pipeline corresponding to the target scene. Initializing the rendering pipeline means setting the various parameters and states required for rendering, and preparing to start processing image data. Next, the process of calculating the visibility and culling of scene primitives in the rendering pipeline extracts the candidate primitive information corresponding to the candidate scene component, wherein the candidate primitive information includes the material type. The system checks whether the candidate primitive information contains the target material type. If the candidate primitive information contains the target material type, the system determines the candidate scene component as a scene interaction component, and uses the candidate primitive information of the target material type as the target primitive information corresponding to the scene interaction component. This means that the system will use these geometric data to draw the scene interaction component with the specified material type. For the step of initializing the rendering pipeline corresponding to the target scene, one implementation method is to load the shader program and texture resources required for rendering, and set rendering states such as depth testing and blending mode. Another implementation method is to configure the rendering context, such as an OpenGL or Direct3D environment, to ensure that the rendering pipeline is ready to receive and process image data.
[0036] In a specific embodiment of the present invention, it is assumed that in a virtual scene, players can interact with map markers, mission targets, NPC locations, etc. of transparent or translucent materials. When the system receives an instruction to draw these markers, it first initializes the rendering pipeline, including loading the necessary shader program and texture resources, and setting the correct depth test and blending mode. Then, the system extracts the candidate primitive information of each candidate scene component in the rendering pipeline to check whether it contains a transparent or translucent material type. For those components that contain the target material type, the system determines them as scene interaction components and uses the primitive information of these components to draw transparent or translucent markers. For example, when it is necessary to draw a transparent map marker located in the center of the screen, the system extracts the primitive information of the marker and finds that its material type is transparent, so the system determines this marker as a scene interaction component and uses its primitive information for rendering. The marker will be displayed correctly on the screen and will be properly blocked and interacted with other elements in the scene.
[0037] Based on this, by responding to drawing instructions and extracting candidate primitive information in the rendering pipeline to determine the scene interaction components and their material types, the system can accurately draw interactive components with specific material characteristics. This method not only improves the accuracy of rendering, but also enhances the realism and user experience of the virtual scene. The system can effectively manage the occlusion relationship in the scene, ensuring that elements such as map markers with transparent or translucent materials can be displayed correctly in any case.
[0038] Step 204: Calculate the depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to the depth level of the scene interaction component in the target scene.
[0039] The target primitive information refers to the geometric data used to draw the scene interaction components, including shape, size, position, etc. The depth relationship refers to the front and back position relationship of the scene interaction components in the three-dimensional scene, which determines which objects will be rendered in front and which objects will be rendered in the back.
[0040] In actual applications, when the system calculates the depth relationship between the target primitive information and the target scene, it first needs to obtain the location information of the scene interaction component, which usually includes three-dimensional coordinates (X, Y, Z), where the Z axis represents the depth. Then, the system determines the front and back order of the scene interaction components in the three-dimensional space based on these coordinate values. This process can be achieved through depth testing, which is a commonly used graphics rendering technology used to determine the visibility of objects in the scene. The depth test can be performed before or after the fragment shader is executed, depending on the specific graphics pipeline configuration and application scenario. If the fragment passes the depth test, its color value will be written to the color buffer and finally displayed on the screen. The system will determine its depth level in the three-dimensional scene based on the Z coordinate value of the scene interaction component to ensure that the object in front can correctly block the object behind. For calculating the depth relationship, one implementation method is to use depth buffer technology. The system stores the Z coordinate value of each scene interaction component in a depth buffer and determines the front and back order of objects based on these values when rendering. Another implementation method is to use a sorting algorithm. The system first sorts all scene interaction components according to their Z coordinate values, and then renders these components in sequence.
[0041] In a specific embodiment of the present invention, it is envisioned that a virtual scene contains map markers, mission objectives, NPC locations, etc. with transparent or translucent materials. These markers can be directly embedded in the scene and block and interact with the terrain and other objects. When it is necessary to calculate the depth relationship between these scene interaction components and the target scene, the system first reads the three-dimensional coordinate information of each marker. Then, the system uses depth buffer technology to record these coordinate values, and determines which markers should be displayed in front and which markers should be blocked based on these values during rendering. For example, when the player stands on a hill, the terrain model of the hill will block the mission objective marker behind the hill, while the NPC position marker in front of the hill will be clearly visible. The system can also use a sorting algorithm to process the rendering order of these markers in advance to ensure that a large number of scene interaction components can be efficiently processed during rendering.
[0042] Furthermore, the depth relationship between the target primitive information and the target scene is calculated, including: obtaining scene primitive information of the target scene; performing a depth test based on the target primitive information and the scene primitive information, and calculating the position relationship of each vertex in the scene interaction component relative to each part in the target scene; when the position relationship satisfies a preset occlusion rule, the position relationship is used as the depth relationship between the target primitive information and the target scene.
[0043] Depth testing is a technique used to determine whether pixels covered by primitives in a scene are visible. It determines whether each pixel is occluded by comparing its depth value with the depth value of the corresponding pixel in the depth buffer. Preset occlusion rules are a set of defined conditions used to determine when one object should occlude another object.
[0044] In actual applications, the system first obtains the scene primitive information of the target scene, which includes all geometric objects (such as polygon meshes), light sources, camera positions, etc. in the scene. This information is usually stored in the data structure of the game engine or 3D rendering software, such as a scene tree or primitive list. Next, based on the target primitive information and the scene primitive information, the system first executes the vertex shader in the pipeline, and then performs a depth test before / after the fragment / pixel shader to determine whether the current fragment should be discarded. This step involves calculating the positional relationship of each vertex in the scene interaction component relative to each part of the target scene. Specifically, the system tests the occlusion relationship of the current fragment based on the depth test on the fragment / pixel, and determines whether the current fragment is finally discarded (occluded) or output to the color buffer (unoccluded). The system can use depth buffer technology to record the depth value of each pixel and decide which pixels should be updated based on these values during rendering. For performing depth testing, one implementation method is to use a depth buffer to store the depth value of each pixel and compare them during rendering. Another implementation method is to use a sorting algorithm to process the rendering order of objects in advance to ensure the correctness of the occlusion relationship.
[0045] When the position relationship meets the preset occlusion rules, the system uses the position relationship as the depth relationship between the target primitive information and the target scene. This means that only when the position relationship of the vertices meets the preset occlusion rules will these position relationships be used as part of the depth relationship. The preset occlusion rules can include the type of object, material properties, or other logical conditions to ensure that only reasonable occlusion relationships affect the final rendering results.
[0046] In a specific embodiment of the present invention, it is envisioned that a virtual scene contains map markers, mission objectives, NPC locations, etc. with transparent or translucent materials. These markers can be directly embedded in the scene and occlude and interact with the terrain and other objects. When the system needs to calculate the depth relationship between these markers and the scene, it first obtains the primitive information of the entire scene, including the position information of all objects such as terrain, buildings, and trees. Then, the system performs a depth test based on the primitive information of the marker and the scene primitive information. For example, for a map marker located in the center of the screen, the system calculates the three-dimensional coordinates of each vertex in the marker and compares it with the positions of other objects in the scene. If the depth value of a vertex of the marker is less than the depth value of the terrain or building, the vertex is considered to be in front of these objects. If the position relationship meets the preset occlusion rules, such as the marker cannot occlude important game elements, the system uses these position relationships as part of the depth relationship for subsequent rendering operations. For example, the marker may be occluded by a building, or displayed on the terrain under certain conditions.
[0047] Based on this, by calculating the depth relationship between the target primitive information and the target scene, the system can ensure that the rendering of the scene interaction components in the three-dimensional scene not only meets the expected depth level, but also maintains a good visual effect. This method not only improves rendering efficiency, but also enhances the realism and immersion of the virtual scene. The system can effectively manage the occlusion relationship in the scene, ensuring that elements such as map markers with transparent or semi-transparent materials can be displayed correctly in any case.
[0048] Step 206: Rendering a scene interaction component in the target scene based on the depth relationship and the target primitive information.
[0049] In actual applications, the system first determines the rendering order of scene interaction components based on the calculated depth relationship. This usually involves sorting all interactive components in the scene according to their depth in three-dimensional space. After the sorting is completed, the system will render these components one by one in order from far to near. Next, the system draws each scene interaction component based on the target primitive information. This includes determining the geometric properties of the component such as position, size, shape, and applying appropriate materials and textures. For the step of rendering scene interaction components based on depth relationship and target primitive information, one implementation method is to use depth buffer technology. The system stores the depth information of each component in the depth buffer and determines which pixels should be updated based on this information when rendering. Another implementation method is to use an explicit sorting algorithm. The system first sorts all components according to their depth values, and then renders these components in sequence according to the sorting results to ensure the correctness of the rendering order.
[0050] In a specific embodiment of the present invention, it is envisioned that a virtual scene contains map markers, mission targets, NPC locations, etc. with transparent or translucent materials. These markers can be directly embedded in the scene and block and interact with the terrain and other objects. When the system needs to render these scene interaction components based on the depth relationship and target primitive information, the system first calculates the depth relationship of each marker based on the three-dimensional coordinate information of each marker, and sorts these markers in order from far to near. Then, the system draws them according to the target primitive information of each marker, including determining the position, size, shape, etc. of the marker, and applying appropriate materials and textures. For example, for a mission target marker located on a distant hill, the system will first render the hill terrain model, and then draw the mission target marker at its appropriate position to ensure that the marker does not block the hill. For the NPC position marker located near the player, it will be drawn at the correct position within the player's line of sight to ensure that the marker is clearly visible and not blocked by other objects.
[0051] Furthermore, a scene interaction component is rendered in the target scene based on the depth relationship and the target primitive information, including: rendering an initial interaction component in the target scene based on the depth relationship and the target primitive information; detecting edge pixels of the initial interaction component and determining the edge direction; performing edge smoothing on the initial interaction component according to the target primitive information and the edge direction to obtain a scene interaction component.
[0052] Among them, edge smoothing refers to using algorithms to reduce the jagged effect on the edges of images to make the edges look smoother.
[0053] In actual applications, the system renders the initial interactive components in the target scene based on the depth relationship and the target primitive information. This means that the system first determines the rendering order of the scene interactive components based on the depth relationship, and then uses the target primitive information to draw these components. Next, the system detects the edge pixels of the initial interactive components and determines the edge direction. This step is usually achieved by looking for sharp changes in pixel color, that is, looking for adjacent pixels with large color differences, which are usually located at the edges of components. Determining the edge direction can help the system better understand the direction of the edge, so as to make more accurate smoothing in subsequent processing.
[0054] The system performs edge smoothing on the initial interactive component according to the target primitive information and edge direction to obtain the scene interactive component. Edge smoothing can be achieved through a variety of algorithms, such as bilateral filtering, Gaussian blur, etc. These algorithms can reduce the jagged effect of the edge and make the edge look more natural. For edge smoothing, one implementation method is to use the bilateral filtering algorithm, which can reduce noise while retaining the edge. Another implementation method is to use the Gaussian blur algorithm to achieve a smoothing effect by blurring the edge.
[0055] Based on this, by smoothing the edges of scene interaction components, the system can ensure that the rendering results not only conform to the depth relationship, but also have higher visual quality. This method not only improves the realism of the rendering, but also enhances the immersion of the virtual scene. The system can effectively manage the occlusion relationship in the scene and ensure that elements such as map markers with transparent or semi-transparent materials can be clearly displayed in any case through smoothing.
[0056] Furthermore, the target primitive information includes distance information between each position in the scene interaction component and the component surface; the initial interaction component is edge-smoothed according to the target primitive information and the edge direction to obtain the scene interaction component, including: calculating the smoothness level of each position in the initial interaction component based on the distance information; and performing edge smoothing on the initial interaction component based on the smoothness level and the edge direction to obtain the scene interaction component.
[0057] The target primitive information includes the distance information between each position in the scene interaction component and the component surface, namely the Signed Distance Field (SDF) data, which is used to describe the distance from each pixel to the nearest surface. The smoothness level refers to the degree of edge smoothness determined based on the distance information.
[0058] In actual applications, the system calculates the smoothness level of each position in the initial interactive component based on the distance information in the target primitive information. This means that the system first needs to read the distance value from each pixel in the scene interactive component to the nearest surface. Then, the system determines the smoothness level of each position based on these distance values. The higher the smoothness level, the closer the position is to the edge of the component, and more smoothing is required to reduce the jagged effect. The process of calculating the smoothness level can be implemented in a variety of ways. For example, the system can set a threshold. When the distance value is less than this threshold, it indicates that the position is close to the edge and needs to be smoothed. For the step calculation of the smoothness level, one implementation method is to use threshold judgment, and another implementation method is to use a continuous function for smooth transition.
[0059] Next, the system performs edge smoothing on the initial interaction component based on the smoothness level and edge direction to obtain the scene interaction component. In this step, the system adjusts the color transition of the pixel according to the smoothness level and edge direction of each position to make the edge look smoother. The edge direction can be estimated by the color difference of adjacent pixels or determined by calculating the gradient. For edge smoothing, one implementation method is to use a bilateral filtering algorithm, which can reduce noise while retaining the edge. Another implementation method is to use a Gaussian blur algorithm to achieve a smoothing effect by blurring the edge.
[0060] In a specific embodiment of the present invention, it is envisioned that a virtual scene contains map markers, mission objectives, NPC locations, etc. with transparent or translucent materials. These markers can be directly embedded in the scene and occlude and interact with terrain and other objects. When the system needs to perform edge smoothing on these scene interaction components, the system first reads the SDF data of each marker, that is, the distance information from each pixel to the nearest surface. Then, the system calculates the smoothness level of each position based on this distance information. For example, for a map marker located in the center of the screen, the system detects the distance values of pixels near the edge of the marker and determines the smoothness level based on these values. Then, the system performs edge smoothing on the initial interaction component based on the smoothness level and edge direction. For example, the system can use a bilateral filtering algorithm to process the edges of the marker to ensure that the edges of the marker look smooth and natural, rather than jagged. After smoothing, the marker will be displayed more clearly on the screen and will be properly occluded and interacted with other elements in the scene.
[0061] Based on this, and with information about the distance from each pixel to the nearest surface, the system can quickly determine which pixels are close to an edge and smooth them out.
[0062] Furthermore, after rendering the scene interaction component in the target scene based on the depth relationship and the target primitive information, it also includes: adjusting the interaction strategy of the occlusion component in the target scene in response to the interaction strategy adjustment instruction, wherein the occlusion component is a component that blocks the front-end user from interacting with the scene interaction component.
[0063] The interaction strategy refers to the way the system handles the interaction between the user and the scene interaction component, including but not limited to responding to user input, handling occlusion relationships, etc. Occlusion components refer to those components that block or cover the direct interaction between the user and the scene interaction component.
[0064] In actual applications, the system will adjust the interaction strategy of the occluded components in the target scene in response to the interaction strategy adjustment instruction. This means that when the user issues an adjustment instruction, the system will re-evaluate the behavior of all occluded components in the scene. For example, if the user wants to interact with an occluded map marker in the virtual scene, the system will check whether there are other objects (such as buildings, trees, etc.) that block the marker and adjust the interaction behavior of these occluded objects. The adjustment method can be to temporarily change the transparency of the occluded object to make it translucent, or to change the position of the occluded object so that it no longer blocks the user's line of sight. For adjusting the interaction strategy of the occluded component, one implementation method is to temporarily modify the material properties of the occluded object to make it translucent. Another implementation method is to dynamically adjust the position or size of the occluded object so that it no longer blocks the line of sight between the user and the target interactive component.
[0065] After adjusting the interaction strategy of the occlusion component, the system recalculates the occlusion relationship in the scene and re-renders the scene according to the new interaction strategy. For example, if the user wants to view a map marker that is blocked by a building, the system can temporarily reduce the opacity of the building so that the user can see the map marker through the building and interact with it. This adjustment can be instantaneous or gradual to provide a more natural visual experience.
[0066] In a specific embodiment of the present invention, it is envisioned that a virtual scene contains map markers, mission objectives, NPC locations, etc. with transparent or translucent materials. These markers can be directly embedded in the scene and occlude and interact with terrain and other objects. When a user attempts to interact with a map marker that is blocked by a building, the system adjusts the interaction strategy of the building in response to the user's interaction strategy adjustment instruction. For example, the system can temporarily change the transparency of the building to make it translucent, so that the user can see the map marker through the building. In this case, the system adjusts the material properties of the building to reduce its transparency and recalculates the occlusion relationship in the scene. After the adjustment, the user can clearly see the map marker and interact with it. When the user completes the interaction, the system can restore the original transparency of the building to restore it to normal.
[0067] Based on this, by adjusting the interaction strategy of the occluded components in the target scene in response to the interaction strategy adjustment instruction, the system can ensure that the user will not be unnecessarily hindered when interacting with the scene interaction components in the virtual environment. This method not only improves the user's interactive experience, but also enhances the realism and immersion of the virtual scene. The system can effectively manage the occlusion relationship in the scene, ensuring that the user can interact with the target interaction component without obstacles when needed.
[0068] An embodiment of the present invention realizes responding to a drawing instruction for a scene interaction component in a target scene, and determining the target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is the target material type; calculating the depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to the depth level of the scene interaction component in the target scene; and rendering the scene interaction component in the target scene based on the depth relationship and the target primitive information. By responding to the drawing instruction and determining the primitive information of the scene interaction component, calculating its depth relationship with the target scene, and thus ensuring the correct three-dimensional depth level of the interaction component during rendering, the problem of insufficient expressiveness of traditional two-dimensional interaction components in three-dimensional scenes is solved, so that the scene interaction component can be seamlessly integrated with the three-dimensional environment, providing a more intuitive and natural interaction experience, and enhancing the user's immersion and sense of reality.
[0069] The following combination Figure 3Taking the application of the scene interaction component rendering method provided by the present invention in the game scene 3DUI rendering as an example, the scene interaction component rendering method is further described. Figure 3 It is a process flow chart of a scene interaction component rendering method provided by an embodiment of the present invention, which specifically includes the following steps.
[0070] Step 302: Transform the scene rendering pipeline.
[0071] Specifically, the scene rendering pipeline is transformed. First, when counting scene primitive information, the vertex (Vertex) and triangle ID cache (IndexBuffer) are organized in the scene rendering agent, and drawing commands are collected in the primitive visibility detection stage. The transparent rendering process after post-processing (AfterPostProcess) is supported in the material, and a Pass for rendering transparent material models is added at the end of the pipeline. This is the model of the scene UI belonging to the transparent material (that is, the aforementioned target material). In order to support the unified control, management and optimization of the transparent model by the pipeline, the rendering target map (RenderTarget) drawn in SeparateTranslucency (a specific rendering channel) is used to draw the UI model.
[0072] Step 304: Modify the Shader extraction process of BasePass.
[0073] Specifically, the shader extraction process of BasePass (basic rendering stage) is modified, and the 3D UI post-processing type is added to TranslucencyPass (semi-transparent material type rendering stage), and the TranslucencyPass type is passed in turn during the call of BasePassShaders. If there are 3D UI post-pass primitives in the scene primitive extraction process of the rendering pipeline initialization view process, and the rendering of 3D UI post-pass is marked in the material, the non-vertical inversion type vertex shader and the pixel shader output in the Gamma space are extracted, and the compilation of the 3D UI post-pass material is added to the compilation strategy of the BasePassShader variant.
[0074] Step 306: Reconstruct the SeparateTranslucency drawing process.
[0075] Specifically, after the 3D UI post-pass is included in the AfterTonemappingPass (tone mapping stage), the SeparateTranslucency (a technology that separates the rendering of transparent objects from the rendering of other opaque objects) rendering process is distinguished by the TranslucencyPass type. When TranslucencyPass is all transparency types, all primitives under the current type are directly drawn; otherwise, the downsampling Pass and upsampling Pass (UpsamplePass) are drawn before and after respectively according to the downsampling strategy of SeparateTranslucency, and the SeparateTranslucency buffer size is updated through the downsampling strategy, and then the constant buffer data of the view is reassembled and updated for use in the Shader. If there is a 3D UI post-pass in the pipeline, a pass that needs to be uniformly vertically reversed is drawn once after this pass; otherwise, only one vertically reversed pass is drawn on the last pass of the current pipeline.
[0076] Step 308: Optimize the drawing strategy of the UI on the RenderTarget.
[0077] Specifically, the writing of DepthStencilBuffer is prohibited, replaced with a read-only state, and the depth of the currently drawn 3D UI primitive is compared with the scene depth. The drawing of CustomDepthBuffer is prohibited, the drawing of VelocityBuffer is prohibited, the projection of shadows is turned off, and the influence of lighting on primitives is prohibited. In the interactive click strategy, the problem of invalid collision detection between the ray and the 3D UI primitive at the current click position is fixed, and the collision detection function of some Widgets (basic elements of the UI) that interfere with the scene interaction components is selectively turned off.
[0078] Step 310: Add FXAA and SDF processing.
[0079] Specifically, the vertical image flipping problem is corrected in the final upsampling pass, and then an FXAA (a post-processing based anti-aliasing solution) pass is added after the 3D UI to alleviate the jagged problem. Finally, the SDF (signed distance field) material is used in the UI production, which completely solves the jagged problem of the 3D UI edge.
[0080] Through the above-mentioned transformation process of step 302 to step 310, the rendering pipeline of the scene interaction component rendering system can have the function of rendering 3D scene interaction components in the target virtual scene.
[0081] Corresponding to the above method embodiment, the present invention also provides a scene interaction component rendering device embodiment, Figure 4 FIG. 1 is a schematic diagram of a scene interaction component rendering device provided by an embodiment of the present invention. Figure 4 As shown, the device comprises: The determination module 402 is configured to respond to a drawing instruction for a scene interaction component in a target scene, and determine target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is a target material type; The calculation module 404 is configured to calculate the depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to the depth level of the scene interaction component in the target scene; The rendering module 406 is configured to render the scene interaction component in the target scene based on the depth relationship and the target primitive information.
[0082] Optionally, the determination module 402 is further configured to initialize the rendering pipeline corresponding to the target scene in response to a drawing instruction for a scene interaction component in the target scene; extract candidate primitive information corresponding to the candidate scene component in the process of calculating scene primitive visibility and culling in the rendering pipeline, wherein the candidate primitive information includes a material type; when the candidate primitive information contains a target material type, determine the candidate scene component as a scene interaction component, and use the candidate primitive information of the target material type as the target primitive information corresponding to the scene interaction component.
[0083] Optionally, the computing module 404 is further configured to obtain scene primitive information of the target scene; based on the target primitive information and the scene primitive information, perform a depth test to calculate the positional relationship of each vertex in the scene interaction component relative to each part of the target scene; when the positional relationship satisfies a preset occlusion rule, use the positional relationship as the depth relationship between the target primitive information and the target scene.
[0084] Optionally, the rendering module 406 is further configured to render the initial interaction component in the target scene based on the depth relationship and the target primitive information; detect the edge pixels of the initial interaction component and determine the edge direction; perform edge smoothing on the initial interaction component according to the target primitive information and the edge direction to obtain the scene interaction component.
[0085] Optionally, the target primitive information includes distance information between each position in the scene interaction component and the component surface; accordingly, the rendering module 406 is further configured to calculate the smoothness level of each position in the initial interaction component based on the distance information; based on the smoothness level and edge direction, the initial interaction component is edge smoothed to obtain the scene interaction component.
[0086] Optionally, the scene interaction component rendering device also includes an adjustment module, which is configured to adjust the interaction strategy of the occlusion component in the target scene in response to the interaction strategy adjustment instruction, wherein the occlusion component is a component that blocks the front-end user from interacting with the scene interaction component.
[0087] Applied to the scene interaction component rendering device, the correct rendering of the interaction component in the three-dimensional scene is achieved through the collaborative work of the determination module 402, the calculation module 404 and the rendering module 406. The determination module 402 responds to the drawing instruction for the scene interaction component in the target scene, and determines the target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is the target material type; the calculation module 404 calculates the depth relationship between the target primitive information and the target scene to ensure the correct three-dimensional depth level of the scene interaction component in the target scene; the rendering module 406 renders the scene interaction component in the target scene based on the depth relationship and the target primitive information, thereby solving the problem of insufficient expressiveness of traditional two-dimensional interaction components in three-dimensional scenes, enabling the scene interaction component to be seamlessly integrated with the three-dimensional environment, providing a more intuitive and natural interactive experience, and enhancing the user's immersion and sense of reality.
[0088] The above is a schematic scheme of a scene interaction component rendering device of this embodiment. It should be noted that the technical scheme of the scene interaction component rendering device and the technical scheme of the above-mentioned scene interaction component rendering method belong to the same concept, and the details not described in detail in the technical scheme of the scene interaction component rendering device can be found in the description of the technical scheme of the above-mentioned scene interaction component rendering method.
[0089] Figure 5 The block diagram of a computing device 500 provided according to an embodiment of the present invention is shown. The components of the computing device 500 include but are not limited to a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and the database 550 is used to store data.
[0090] The computing device 500 also includes an access device 540 that enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 540 may include one or more of any type of network interface (e.g., a network interface card (NIC)) that is wired or wireless, such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a world-wide interoperability for microwave access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0091] In one embodiment of the present invention, the above components of the computing device 500 and Figure 5 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 5 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of the present invention. Those skilled in the art may add or replace other components as needed.
[0092] The computing device 500 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 500 may also be a mobile or stationary server.
[0093] The processor 520 is used to execute the following computer program / instructions, which, when executed by the processor, implement the steps of the above-mentioned scene interaction component rendering method.
[0094] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computing device embodiment, since it is basically similar to the scene interaction component rendering method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the scene interaction component rendering method embodiment.
[0095] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program / instruction, which implements the steps of the above-mentioned scene interaction component rendering method when executed by a processor.
[0096] Each embodiment of the present invention is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the computer-readable storage medium embodiment, since it is basically similar to the scene interaction component rendering method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the scene interaction component rendering method embodiment.
[0097] An embodiment of the present invention further provides a computer program product, including a computer program / instruction, which implements the steps of the above-mentioned scene interaction component rendering method when executed by a processor.
[0098] The above is a schematic scheme of a computer program product of this embodiment. It should be noted that the technical scheme of the computer program product and the technical scheme of the above-mentioned scene interaction component rendering method belong to the same concept, and the details not described in detail in the technical scheme of the computer program product can be referred to the description of the technical scheme of the above-mentioned scene interaction component rendering method.
[0099] The above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0100] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0101] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the described action sequence, because according to the embodiments of the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of the present invention.
[0102] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0103] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of the present invention. The present invention selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A scene interaction component rendering method, characterized in that: include: In response to a drawing instruction for a scene interaction component in a target scene, when the drawing instruction indicates that the material type of the scene interaction component is a target material type, determining target primitive information corresponding to the scene interaction component; Calculating a depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to a depth level of the scene interaction component in the target scene; The scene interaction component is rendered in the target scene based on the depth relationship and the target primitive information.
2. The method according to claim 1, characterized in that: The step of responding to a drawing instruction for a scene interaction component in a target scene, and obtaining target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is a target material type, includes: In response to a drawing instruction for a scene interaction component in a target scene, initializing a rendering pipeline corresponding to the target scene; Extracting candidate primitive information corresponding to the candidate scene component during the process of calculating scene primitive visibility and culling in the rendering pipeline, wherein the candidate primitive information includes a material type; In the case where the candidate primitive information includes the target material type, the candidate scene component is determined as the scene interaction component, and the candidate primitive information of the target material type is used as the target primitive information corresponding to the scene interaction component.
3. The method according to claim 1, characterized in that The calculating the depth relationship between the target primitive information and the target scene includes: Obtaining scene primitive information of the target scene; Based on the target primitive information and the scene primitive information, a depth test is performed to calculate the positional relationship of each vertex in the scene interaction component relative to each part in the target scene; In the case where the position relationship satisfies a preset occlusion rule, the position relationship is used as a depth relationship between the target primitive information and the target scene.
4. The method according to claim 1, characterized in that The rendering of the scene interaction component in the target scene based on the depth relationship and the target primitive information includes: Based on the depth relationship and the target primitive information, rendering an initial interaction component in the target scene; Detecting edge pixels of the initial interaction component and determining the edge direction; The initial interaction component is subjected to edge smoothing processing according to the target primitive information and the edge direction to obtain the scene interaction component.
5. The method according to claim 4, characterized in that The target primitive information includes distance information between each position in the scene interaction component and the component surface; performing edge smoothing on the initial interaction component according to the target primitive information and the edge direction to obtain the scene interaction component includes: Based on the distance information, calculating the smoothness level of each position in the initial interaction component; Based on the smoothing level and the edge direction, edge smoothing is performed on the initial interaction component to obtain the scene interaction component.
6. The method according to claim 1, characterized in that After rendering the scene interaction component in the target scene based on the depth relationship and the target primitive information, the method further includes: In response to the interaction strategy adjustment instruction, the interaction strategy of the obstruction component in the target scene is adjusted, wherein the obstruction component is a component that obstructs the front-end user from interacting with the scene interaction component.
7. A scene interaction component rendering device, characterized in that: include: A determination module is configured to, in response to a drawing instruction for a scene interaction component in a target scene, determine target primitive information corresponding to the scene interaction component when the drawing instruction indicates that the material type of the scene interaction component is a target material type; A calculation module, configured to calculate a depth relationship between the target primitive information and the target scene, wherein the depth relationship refers to a depth level of the scene interaction component in the target scene; A rendering module is configured to render the scene interaction component in the target scene based on the depth relationship and the target primitive information.
8. A computing device, characterized in that include: Memory and processor; The memory is used to store computer programs / instructions, and the processor is used to execute the computer programs / instructions. When the computer program / instructions are executed by the processor, the steps of the scene interaction component rendering method described in any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium, characterized in that: It stores a computer program / instruction, which, when executed by a processor, implements the steps of the scene interaction component rendering method described in any one of claims 1-6.
10. A computer program product, characterized in that It includes a computer program / instruction, which, when executed by a processor, implements the steps of the scene interaction component rendering method described in any one of claims 1 to 6.
Citation Information
Cited By
Rendering method and electronic equipment
CN122156423A