Scene rendering method and device, equipment, medium and program product

By specifying the ray tracing interface to trace the light source rays in the virtual scene, and rendering based on the ray tracing texture data and material information, it solves the problem that the Vulkan Raytracing interface cannot perform ray tracing rendering, and achieves efficient light reflection effects on mobile devices. render.

CN118674850APending Publication Date: 2024-09-20TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 5 Cited by

Patent Information

Application Number
CN202310313064.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-15
Publication Date
2024-09-20

AI Technical Summary

Technical Problem

The existing Unreal Engine cannot perform light effect color calculation and rendering after ray tracing when using the Vulkan Raytracing interface, resulting in low ray tracing rendering efficiency and the inability to efficiently render light reflection effects on mobile devices.

Method used

Trace the light source rays in the virtual scene by specifying the ray tracing interface, obtain a list of models within the reflection range, and render based on the ray tracing texture data and the material information of the target virtual object to generate light reflection effects. The Vulkan Raytracing interface is supported for ray processing. Trace rendering.

Benefits of technology

It improves the adaptability of ray tracing rendering to application scenarios, enables efficient rendering of light reflection effects on mobile devices, reduces ray tracing rendering overhead, and improves rendering efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118674850A
    Figure CN118674850A
Patent Text Reader

Abstract

The invention discloses a scene rendering method and device, equipment, a medium and a program product, and relates to the field of interface rendering. The method comprises the following steps: tracking light emission of a light source ray in a virtual scene through a specified light tracking interface, and determining a target virtual object hit by the light source ray; obtaining a model list in a reflection range in the virtual scene; and rendering the target virtual object based on the ray tracing texture data of the light source ray and the material information of the target virtual object under the condition that the target virtual object is within the range of the model list. And for a target virtual object obtained by tracking the specified ray tracing interface, matching the target virtual object with the model list of the visual range, if the target virtual object is in the visual range of the player, fusing the ray tracing texture data and the object texture data of the target virtual object to render the target virtual object, and if the target virtual object is in the visual range of the player, rendering the target virtual object. And completing rendering of the ray tracing effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of interface rendering, and in particular to a scene rendering method, device, equipment, medium and program product. Background Art

[0002] There is usually a lot of light propagation in virtual scenes, such as smooth metal surfaces, water-logged floor tiles, etc., which will produce light reflection. The propagation of light will produce a reflection effect on the smooth surface of the object, so the smooth object will show the reflected light.

[0003] In the related technology, Unreal Engine usually uses DirectX Raytracing interface for tracing, while cross-platform interface Vulkan Raytracing also supports ray tracing function. After using DirectXRaytracing interface for ray tracing, DirectX Raytracing interface can perform local resource binding, so Unreal Engine also supports calculation of light effect color of rendering after ray tracing under DirectX Raytracing interface and corresponding rendering. However, Vulkan Raytracing interface does not support local resource binding, so current Unreal Engine cannot perform subsequent color calculation and rendering. Summary of the invention

[0004] The embodiments of the present application provide a scene rendering method, device, equipment, medium and program product, which can improve the adaptability of ray tracing rendering to application scenarios. The technical solution is as follows:

[0005] In one aspect, a scene rendering method is provided, the method comprising:

[0006] Tracing the light emission of the light source ray in the virtual scene through a specified ray tracing interface to determine the target virtual object hit by the light source ray;

[0007] Acquire a list of models within the reflection range in the virtual scene, wherein the virtual objects in the list of models are model objects within the reflection range of the light source;

[0008] When the target virtual object is within the model list, the target virtual object is rendered based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain a light reflection effect of the reflective surface of the target virtual object in the virtual scene.

[0009] In another aspect, a scene rendering device is provided, the device comprising:

[0010] A determination module, used to trace the light emission of the light source ray in the virtual scene through a specified ray tracing interface, and determine the target virtual object hit by the light source ray;

[0011] An acquisition module, used for acquiring a model list within the reflection range in the virtual scene, wherein the virtual objects in the model list are model objects currently to be rendered;

[0012] A rendering module is used to render the target virtual object based on the ray tracing texture data of the light source ray and the object texture data of the target virtual object when the target virtual object is within the model list, so as to obtain the light reflection effect of the reflection surface of the target virtual object in the virtual scene.

[0013] On the other hand, a computer device is provided, comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a code set or an instruction set, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the scene rendering method provided in the above-mentioned embodiment of the present application.

[0014] On the other hand, a computer-readable storage medium is provided, in which at least one instruction, at least one program, a code set or an instruction set is stored, and the at least one instruction, the at least one program, the code set or the instruction set is loaded and executed by the processor to implement the scene rendering method provided in the above-mentioned embodiment of the present application.

[0015] On the other hand, a computer program product is provided. When the computer program product is run on a computer, the computer executes the scene rendering method provided in the above-mentioned embodiment of the present application.

[0016] The beneficial effects brought by the technical solution provided by the embodiment of the present application include at least:

[0017] By utilizing the reversibility principle of light, when determining the reflection effect on the surface of an object, the target virtual object obtained by tracking the specified ray tracing interface is matched with the model list of the reflection range to determine whether the target virtual object is within the range of the reflected light source ray. If it is within the reflection range, the target virtual object is rendered by integrating the ray tracing object data texture and the obtained material information of the target virtual object, thereby generating a light reflection effect of the target virtual object being hit by light. The application of the Vulkan Raytracing interface can also complete the rendering of the ray tracing effect on the basis of supporting ray tracing. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0019] Figure 1 It is a schematic diagram of the overall process of a scene rendering method provided by an exemplary embodiment of the present application;

[0020] Figure 2 is a flow chart of a scene rendering method provided by an exemplary embodiment of the present application;

[0021] Figure 3 is a flow chart of a scene rendering method provided by another exemplary embodiment of the present application;

[0022] Figure 4 is based on Figure 3 A schematic diagram of a rendering process of a ray tracing material system provided by the illustrated embodiment;

[0023] Figure 5 A flowchart of a scene rendering method provided by another exemplary embodiment of the present application;

[0024] Figure 6 is based on Figure 5 The illustrated embodiment provides a schematic diagram of object identification;

[0025] Figure 7 is based on Figure 5 The illustrated embodiment provides a schematic diagram of a rendering request frame-by-frame readback request;

[0026] Figure 8 is a schematic diagram of light reflection effect provided by an exemplary embodiment of the present application;

[0027] Fig. 9 It is a schematic diagram of the overall process of light reflection provided by an exemplary embodiment of the present application;

[0028] Fig.10 It is a schematic diagram of the light reflection principle provided by an exemplary embodiment of the present application;

[0029] Fig.11 is a structural block diagram of a scene rendering device provided by an exemplary embodiment of the present application;

[0030] Fig.12 is a structural block diagram of a scene rendering device provided by another exemplary embodiment of the present application;

[0031] Fig.13It is a structural block diagram of a computer device provided by an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0032] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.

[0033] First, the nouns involved in the embodiments of the present application are briefly introduced:

[0034] Shader: A small program that runs in the graphics processor in a graphics card and is used to parallelize calculations on various graphics units. Common shader types include vertex shaders and pixel shaders.

[0035] Ray tracing: Different from traditional raster rendering, ray tracing technology traces the propagation of light itself, finds its intersection with objects in the virtual scene, and then colors the intersection with objects in the virtual scene.

[0036] Ray tracing effect: refers to the rendering effect that uses ray tracing technology. In current mainstream game applications, ray tracing effects are combined with traditional rasterization rendering effects to provide rendering effects that are difficult to overcome with their principles, such as soft shadows, ambient occlusion, and reflections.

[0037] Raytracing Pipeline: is a new pipeline around ray intersection and shading, which will automatically intersect rays and acceleration structures, call the corresponding shader of the object for shading, and can continue to emit rays (such as reflection) to repeat the above steps. This pipeline allows recursive execution of shaders.

[0038] Ray Query: An interface for intersecting rays and acceleration structures. It can be called in any type of shader, emitting rays for intersection, and returning intersection information to the called shader. Compared to Raytracing Pipeline, Ray Query cannot call the shader corresponding to the object and recursively execute. Currently, Android mobile platforms that support Vulkan Raytracing only support Ray Query, but not RaytracingPipeline.

[0039] Since the Vulkan Raytracing interface lacks the resource binding (Local Root Signature) capability for individual objects compared to the DirectX Raytracing interface, the latest version of the Unreal Engine does not currently support material shading for objects that hit the surface. At the same time, the latest mobile platforms already support Vulkan ray tracing, but only support Vulkan Ray Query, that is, it can obtain information such as identifiers and coordinates of objects hit by ray tracing, but cannot perform color calculations, so shading cannot be completed. Because in effects such as reflection, a large number of rays will hit objects that do not exist in the scene, and there is no information about them in screen space, so screen space-based technologies will produce a large number of rendering errors. For mobile platforms that support ray tracing, the performance cost of ray tracing is too high compared to traditional rendering methods.

[0040] In the embodiment of the present application, after ray tracing is performed through the Vulkan Raytracing interface, the ability to color the surface material of the hit object is provided, which can greatly reduce the rendering overhead of ray tracing, enable it to be efficiently rendered on mobile devices, and improve the rendering efficiency in ray tracing scenarios.

[0041] The embodiment of the present application can be executed by the terminal alone, or by the terminal and the server in cooperation. When the terminal is executed alone, after the terminal obtains the virtual scene data, it performs ray tracing through a specified ray tracing interface, and renders the virtual scene screen based on the ray tracing result.

[0042] When the terminal and the server cooperate to execute, in some embodiments, the virtual scene is implemented as a scene in a cloud application. After the cloud server obtains the virtual scene data, it performs ray tracing through a specified ray tracing interface, and renders the virtual scene image based on the ray tracing results, thereby sending the rendered data to the terminal, which displays the rendered data.

[0043] It is worth noting that the above-mentioned terminal can be a mobile phone, computer, tablet computer, virtual reality (VR) device and other terminals, and the above-mentioned terminal can be installed with Microsoft Windows system, Android system, Apple system, etc., which is not limited in the embodiments of the present application.

[0044] The scene rendering method provided in the embodiment of the present application can be applied to at least one of the following scenarios:

[0045] 1. In the game scene, there is a lot of light propagation in the game scene of mobile games or PC games, such as: luminous display screens in the game scene, lights in the game scene, natural light in the game scene, etc. By rendering the light effect, the reflection effect of objects in the game scene after being illuminated by light is reflected;

[0046] 2. In a virtual reality (VR) scene, a user wears a VR device to view a virtual scene. Light propagation exists in the virtual scene. For example, a luminous object in the virtual scene that is around the user's field of vision can reflect the reflection effect of the object in the VR scene after being illuminated by light by rendering the light effect.

[0047] 3. In the 3D house preview software, the lighting in the room on a sunny day is simulated by light propagation. That is, there is a light source outside the 3D house model. The light from the light source propagates through the transparent windows of the 3D house model and propagates inside the house, and produces a reflection effect on objects in the house, thereby simulating the lighting conditions of the house on a sunny day.

[0048] It is worth noting that the above application scenarios are only illustrative examples, and the embodiments of the present application do not limit the specific application scenarios of the scene rendering method.

[0049] Figure 1 FIG. 1 is a schematic diagram of the overall process of a scene rendering method provided by an exemplary embodiment of the present application. Figure 1 As shown, the light data in the virtual scene is intersected by Ray Query to determine the pixel fragment 110 hit by the light in the virtual scene and the virtual object 100 corresponding to the pixel fragment, wherein the pixel fragment 110 is the fragment structure constituting the virtual object 100.

[0050] The information of the pixel fragment 110 is stored in the ray-traced object data texture 120, and the fragments that need to be rendered by ray tracing texture in the ray-traced object data texture 120 are determined according to the list of objects to be rendered 130 obtained by the engine side. The virtual object 100 in the virtual scene is rendered according to the original scene texture and the ray-traced texture.

[0051] Figure 2 : is a flowchart of a scene rendering method provided by an exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by a terminal and a server in cooperation. In this embodiment, the method is applied to a terminal as an example for explanation. Figure 2 As shown, the method includes:

[0052] Step 201 , tracing the light emission of light source rays in the virtual scene through a specified ray tracing interface to determine the target virtual object hit by the light source rays.

[0053] The target virtual object corresponds to an object identifier.

[0054] Optionally, in an embodiment of the present application, the specified ray tracing interface is implemented as a Ray Query interface, which can perform emission tracing on the rays emitted by the light source in the virtual scene. In some embodiments, Ray Query is an interface for the intersection operation of rays and acceleration structures. It can be called in any type of shader, emits rays for intersection and returns the intersection information to the called shader.

[0055] The light source ray refers to the light effect ray of the virtual object that generates the light effect mapping, which is determined in reverse based on the reversible principle of the light path, with the camera model observing the virtual scene as the exit point.

[0056] In the embodiment of the present application, the light source ray includes at least one of a direct light source ray and a reflected light source ray. The direct light source ray refers to the light emitted directly from the light source, such as: the virtual scene includes a virtual display screen, and the light emitted directly from the virtual display screen is the direct light source ray; the reflected light source ray refers to the light reflected from the object after the direct light source ray is emitted from the light source, and the direct light source ray hits the surface of the object, such as: the virtual scene includes virtual sunlight, the direct light source ray of the virtual sunlight hits the wall, and the wall reflects the light source to obtain the reflected light source ray.

[0057] In some embodiments, when the light source ray is implemented as a light source reflected ray, the target virtual object is a virtual object that meets the light reflection condition, that is, the target virtual object is a virtual object with a roughness lower than a roughness threshold, such as a mirror, glass, etc.

[0058] First, the origin position and emission direction of the light source ray in the virtual scene are obtained, and based on the origin position and emission direction of the light source ray, an interface is called to query whether the light source ray hits an object in the virtual scene, and the world space coordinates of the light source ray hitting point, the object identifier of the hit object, the fragment identifier of the hit fragment, the fragment centroid coordinates, etc. Among them, the fragment is a structural unit that constitutes the three-dimensional model of the virtual object, and the fragment can be implemented as a triangle fragment, a quadrilateral fragment, any irregular graphic fragment, etc., which is not limited in this embodiment.

[0059] By determining the object ID of the object hit by the light ray, first determine the candidate virtual object that needs to be rendered with light effects. Optionally, the fragment ID, fragment centroid coordinates and other information of the fragment hit by the light ray are stored in the ray tracing object data texture (Visibility Buffer), that is, the visibility texture that can encode object information, and the object ID of the virtual object hit by the light ray is stored as a candidate virtual object and fragment to be color calculated and rendered.

[0060] In some embodiments, when the ray tracing interface performs ray tracing on the light source ray, it determines the direction of the light in the world coordinate system corresponding to the light of the light source ray by obtaining the ray expression of the origin position and the emission direction of the light source ray in the world coordinate system, and intersects the world coordinate range of each virtual object in the world coordinate system with the ray expression to determine the target virtual object hit by the light emitted by the light source ray.

[0061] Illustratively, the ray tracing in the embodiments of the present application is based on the principle of reversibility of the light path, that is, firstly, the surface that needs to be rendered with light effects is determined in the virtual scene, and then the ray tracing path is reversely determined based on the position of the camera model and the surface to be rendered with light effects.

[0062] In some embodiments, a reflective surface in a virtual scene is determined, where the reflective surface is a surface of a virtual object that meets light reflection conditions, and the light emission direction of the light source ray is obtained based on the model position of the camera model and the surface orientation of the reflective surface. The camera model is used to capture scene images of the virtual scene; the light emission direction of the light source ray is reversely traced through a specified ray tracing interface to determine the target virtual object hit by the opposite direction of the light emission.

[0063] Optionally, surface normal information of the reflective surface is obtained; the direction of incident light from the model position of the camera model to the reflective surface is obtained; and the light emission direction of the light source ray is determined based on the incident light direction and the surface normal information.

[0064] For example, if the virtual scene includes a smooth reflective surface, after traditional scene rendering, the reflective surface rendering appears as if the object has not reflected light. Determine the position of the camera model in the virtual scene for capturing the scene image, and determine the direction of the light between the reflective surfaces from the position of the camera model. The light is the light reflected by the reflective surface and then emitted toward the camera model. The light captured by the camera model is emitted in the direction of the light according to the normal of the reflective surface. That is, after the light is emitted from the reflective light source to the reflective surface from the light emission direction, it is reflected by the reflective surface and emitted toward the camera model along the light direction. Therefore, the direct light source or reflected light source that emits light to the reflective surface is traced back according to the principle of reversibility of the optical path.

[0065] In some embodiments, the light reflection condition refers to the reflectivity of the target virtual object to the received light. In some embodiments, determining whether the light source ray satisfies the light reflection condition on the target virtual object generally includes the following methods:

[0066] Determine candidate objects in a virtual scene; obtain object roughness parameters of the candidate virtual objects; and determine the candidate virtual objects as target virtual objects when the object roughness parameters of the candidate virtual objects meet light reflection conditions; wherein the object roughness parameters are parameter light source rays configured in texture data of the candidate virtual objects.

[0067] It should be noted that the above-mentioned method for determining the light reflection condition is only an illustrative example and is not limited to this in this embodiment.

[0068] It is worth noting that the above embodiments are described by taking the roughness parameter of the virtual object as an example. In some embodiments, the smoothness parameter of the virtual object is obtained, and when the smoothness parameter meets the light reflection condition, the candidate virtual object is determined to be the target virtual object.

[0069] In some embodiments, before tracing the rays emitted by the light source, the virtual scene is rendered using a graphics rendering technology to obtain a scene rendering effect, wherein the scene rendering effect does not include a light reflection effect.

[0070] Step 202: Obtain a list of models in the virtual scene that are within the reflection range. The virtual objects in the list of models are model objects that are currently to be rendered.

[0071] The model objects in the model list correspond to object identifiers, and the object identifiers and the object identifiers of the target virtual objects hit by the light are determined in a unified manner.

[0072] In some embodiments, when performing ray tracing, the ray tracing interface intersects virtual objects in the virtual scene based on the world coordinate system. In some cases, the virtual object hit by the light of the light source ray is within the player's line of sight in the virtual scene, but the light reflected by the light source ray after hitting the virtual object is outside the player's line of sight. That is, the virtual object in the virtual scene hit by the light of the light source ray is not actually within the current virtual scene lighting effect rendering range.

[0073] Therefore, in the embodiment of the present application, it is also necessary to obtain a model list of virtual objects in the virtual scene that are within the range that the reflected light may hit, wherein, when performing ray tracing through the ray tracing interface, a model list in the virtual scene that is reflected by the light can be obtained at the same time. The reflection range refers to the range of virtual objects that may be hit by the light source ray and reflect the light.

[0074] Optionally, the virtual objects in the model list are model objects to be rendered that are within the reflection range, and object identifiers corresponding to the model objects within the reflection range are stored in the model list.

[0075] Optionally, the identification of virtual objects in the virtual scene that are hit by the light emission direction is obtained; and a list of models within the reflection range is determined based on the identification of the virtual objects hit by the light emission direction.

[0076] In an optional embodiment, virtual scene data corresponding to at least one frame of image to be rendered is obtained; based on the virtual scene data corresponding to at least one frame of image, virtual objects within the reflection range in the virtual scene data are obtained to obtain a model list.

[0077] The at least one frame of image to be rendered refers to a preset number of consecutive image frames starting from the current frame; the current frame refers to the image frame to be rendered and displayed. The virtual scene data corresponding to the at least one frame of image is obtained, and based on the virtual scene data corresponding to the at least one frame of image, a virtual object in the reflection range in at least one frame of image in the multiple frames of image is obtained, and the object identifier of the virtual object is added to the model list to obtain a model list in the reflection range.

[0078] Step 203 , when the target virtual object is within the model list, the target virtual object is rendered based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain the light reflection effect of the target virtual object in the virtual scene.

[0079] Optionally, the object identifier of the target virtual object is matched with the object identifier stored in the model list to determine whether the target virtual object is in the model list; and the virtual object in the model list refers to the virtual object currently in the reflection range. If the object identifier of the target virtual object is in the model list, it means that the target virtual object is in the reflection range of the terminal. Conversely, if the object identifier of the target virtual object is not in the model list, it means that the target virtual object is invisible to the master virtual object or the player.

[0080] In an embodiment of the present application, when the target virtual object is in the model list, the ray tracing texture data of the light source ray and the material information of the target virtual object are obtained, and then the ray tracing texture data and the material information of the target virtual object are fused to render the target virtual object, thereby expressing the light reflection effect when the target virtual object is hit by the light of the light source ray in the virtual scene.

[0081] In some embodiments, material information of the target virtual object is obtained based on an object identifier corresponding to the target virtual object; when the object identifier is within the range of the model list, the target virtual object is rendered based on ray tracing texture data of the light source ray and the material information of the target virtual object to obtain a light reflection effect of the reflective surface of the target virtual object in the virtual scene.

[0082] To summarize, the scene rendering method provided in this embodiment utilizes the reversibility principle of light. When determining the reflection effect on the surface of an object, the target virtual object obtained by tracking the target virtual object using the specified ray tracing interface is matched with the model list of the reflection range to determine whether the target virtual object is within the range of the reflected light source ray. If it is within the reflection range, the target virtual object is rendered by integrating the ray tracing object data texture and the acquired material information of the target virtual object, thereby generating a light reflection effect of the target virtual object being hit by light. When applied to the VulkanRaytracing interface, the rendering of the ray tracing effect can also be completed on the basis of supporting ray tracing.

[0083] The method provided in this embodiment determines whether the target virtual object is in the list by obtaining a list of objects hit by ray tracing, and the list of objects hit by ray tracing is objects that can reflect light into the observation range of the camera model through a reflective surface, thereby improving the efficiency of object tracking.

[0084] In an optional embodiment, after determining the object hit by the light of the light source ray, the object information is stored. Figure 3 is a flow chart of a scene rendering method provided by another exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by a terminal and a server in cooperation. In this embodiment, the method is applied to a terminal as an example for explanation. Figure 3 As shown, the method includes:

[0085] Step 301 , tracing the light emission of light source rays in the virtual scene through a specified ray tracing interface to obtain object hit data of the light source rays.

[0086] The object hit data includes the fragment data of the target virtual object hit by the light source ray, and the fragment data includes the fragment identifier and the coordinates of the centroid of the fragment. Among them, the fragment refers to the unit for constructing the three-dimensional model of the virtual object, and the fragment can be a triangle fragment, a quadrilateral fragment or a fragment of any other shape.

[0087] The three-dimensional model structure of the virtual object in the virtual scene is constructed by multiple fragments, and each fragment used to construct the virtual object corresponds to a fragment identifier and the coordinates of the centroid of the fragment.

[0088] Step 302, recording the fragment identifier and the coordinates of the centroid of the fragment into the object data texture of the ray tracing.

[0089] Optionally, based on the origin and emission direction of the light source ray, the specified ray tracing interface can be called to query whether the light source ray hits an object in the virtual scene, determine the world space coordinates of the pixel hit by the light source ray, and obtain the object ID and fragment ID of the object hit by the light source ray. Taking the fragment as a triangle fragment as an example, the hit triangle fragment ID, triangle centroid coordinates and other information are obtained. When rendering ray tracing effects such as reflection, each pixel on the screen that meets the conditions will emit a ray to the scene (for example, if the roughness is less than a certain value, it will be necessary to render the reflection effect). If the triangle fragment ID and triangle centroid coordinates of the point hit by the ray are recorded in a ray tracing object data texture, the ray tracing object data texture encodes the geometric information corresponding to the pixels visible by the final ray tracing effect, which is called Visibility Buffer.

[0090] For each virtual object in the virtual scene, it may correspond to one or more fragment metadata on the Visibility Buffer, or it may not correspond to any fragment metadata (for example, in the reflection effect, the object identifier that is not hit by the reflected ray will not appear in the Visibility Buffer). The Visibility Buffer uses a specific encoding method, such as: R32G32_UINT encoding method, with a 16-bit depth map), which is defined as follows:

[0091] Visibility Buffer: The R channel stores the triangle identifier (32 bits), and the G channel stores the X and Y information of the center of gravity coordinates (16 bits each, combined into 32 bits);

[0092] Depth map: object identity (16 bits).

[0093] Step 303: Obtain a list of models in the virtual scene that are within the reflection range, where the virtual objects in the list of models are model objects to be rendered currently.

[0094] In the embodiment of the present application, a model list of virtual objects in a virtual scene within a reflection range is obtained, wherein the reflection range refers to the range of objects that may be hit in the virtual scene.

[0095] Optionally, the virtual object in the model list is a model object to be rendered, and an object identifier corresponding to the model object to be rendered is stored in the model list.

[0096] Since the rays generated by the ray tracing effects using the material system may be directed to various places in the scene, it is impossible to use mechanisms such as frustum culling / occlusion culling to reduce the number of virtual objects that need to be rendered. Therefore, while generating the Visibility Buffer, the object identifier set of virtual objects that currently exist in the virtual scene and may be hit by light source rays is output, which is the above-mentioned model list. Due to the synchronization mechanism between the Unreal Engine rendering thread and the rendering hardware interface thread, the object identifier set will be read back from the graphics processor to the Unreal Engine side after 1 to 2 frames. Since the virtual objects corresponding to the object identifier set are different in each frame, after reading it back, the manager on the engine side will convert it into a unique object identifier, thereby driving the drawing process and limiting the number of objects involved in drawing.

[0097] Among them, readback refers to the operation of reading back the identifiers of virtual objects that need to be rendered with light effects determined during the rendering process of the most recent frame or the most recent n-th frame before the current frame from the graphics processing unit (GPU) to the client. In some embodiments, the model list is obtained by reading back within the readback cycle range, wherein the readback cycle range is a pre-set range, or a range determined according to the change amplitude of the viewing angle of the master virtual object, or a range determined according to the change amplitude of the virtual picture. Schematically, the viewing angle change amplitude of the master virtual object within 10 frames is usually small, so 10 frames are used as a readback cycle range. Within the readback cycle range, when determining the model list of the i-th frame, the list of virtual objects that need to be rendered with light effects determined during the light effect rendering process of the i-1-th frame or the i-2-th frame virtual picture can be obtained as the model list of the i-th frame, i>2 and i is an integer.

[0098] Step 304, when the target virtual object is within the model list, based on the fragment metadata corresponding to the target virtual object in the ray tracing object data texture and the material information of the target virtual object, the target virtual object is rendered to obtain the light reflection effect of the reflective surface of the target virtual object in the virtual scene.

[0099] After the Visibility Buffer is generated, the engine will use the Graphics Pipeline to issue multiple draw calls to the virtual objects being rendered, and each draw call is responsible for shading the corresponding fragment pixels. Unlike traditional rendering, each draw call draws a full screen triangle to shade the pixels corresponding to the virtual object to which it belongs. By encoding the virtual object identifier into an additional depth buffer, and making the vertex shader output the same depth as the virtual object identifier when rendering the full screen triangle, the early depth test provided by the graphics processor can be used to remove pixels that do not belong to the virtual object in the current drawing. The virtual object identifier is used to uniquely represent different object instances belonging to different materials, and is used to distinguish different pixels in the ray-traced object data texture. The process of shading the corresponding pixels is called the resolution of the ray-traced object data texture (VisibilityResolve).

[0100] In the Visibility Resolve process, the resources used by each Draw Call include not only the resources used for normal object rendering, such as surface and lighting textures, and the buffer containing object information (Uniform Buffer), but also the geometric information of the object, namely the vertex index (Index Buffer) and vertex attributes (VertexAttributes, such as vertex color, UV, normal). Each pixel belonging to the virtual object will be restored to its corresponding triangle in the pixel shader (Pixel Shader) through the information encoded in the Visibility Buffer, combined with the geometric information, and interpolation will be performed to obtain the attribute information corresponding to the pixel (such as pixel UV, normal), and material attribute calculations and lighting calculations will be performed according to the traditional rendering process to finally obtain the surface color information.

[0101] Indicatively, Figure 4 As shown, the rendering process of the ray tracing material system includes the following processes.

[0102] The rendering process mainly includes a graphics processing unit (GPU) side 410 and an Unreal Engine side 420 .

[0103] Among them, on the GPU side, the normal rendering process is first executed to obtain the world space normal texture 411, depth texture 412 and roughness texture 413 of the virtual scene; ray tracing is performed through the ray tracing interface 414 according to the world space normal texture 411, depth texture 412 and roughness texture 413, the fragment 415 hit by the light is determined and the depth information 416 of the virtual object is obtained, so as to determine the virtual object to which the hit fragment 415 belongs, and generate the ray traced object data texture 417 to be rendered.

[0104] On the Unreal Engine side 420 , a list of objects to be rendered in the virtual scene is obtained 421 .

[0105] The rendering target of the ray tracing effect texture 418 is determined by combining the list of objects to be rendered 421 and the object data texture 417 of the ray tracing to be rendered, and the rendering of the virtual object hit by the light in the virtual scene is obtained based on the original scene color 419 and the ray tracing effect texture 418.

[0106] To summarize, the scene rendering method provided in this embodiment matches the target virtual object obtained by tracing the specified ray tracing interface with the model list of the reflection range, so as to determine whether the target virtual object is within the reflection range of the light source ray. If it is within the reflection range, the target virtual object is rendered by fusing the ray tracing texture data and the material information of the target virtual object, so as to generate a light reflection effect of the target virtual object being hit by the light. When applied to the Vulkan Raytracing interface, it can also complete the rendering of the ray tracing effect on the basis of supporting ray tracing.

[0107] The method provided in this embodiment obtains metadata of fragments hit by light rays from a light source and stores the metadata in a ray-traced object data texture, thereby integrating the fragments hit by light rays on the virtual object through the ray-traced object data texture, determining the light reflection conditions of the virtual object, and providing an efficient solution for rendering light reflection effects.

[0108] In an optional embodiment, the above method can only support the shading of a single ray intersection (Single Bounce) in a ray tracing application, which is equivalent to converting the depth-first traversal process of the Raytracing Pipeline to a breadth-first one. If the reflection effect of the material system currently requires multiple reflections of light (Multi-bounce), it can be accomplished by encoding multiple ray-traced object data textures Visibility Buffer and starting multiple Visibility Resolve processes. When the target platform only supports Vulkan Raytracing / Ray Query, this approach can implement a ray tracing material system in traditional rendering technology, that is, an engine or renderer that issues a Draw Call for each object.

[0109] In the embodiment of the present application, in the case of multiple reflections, object data textures are recorded through multiple ray tracing. Figure 5 is a flow chart of a scene rendering method provided by another exemplary embodiment of the present application. The method can be executed by a terminal, or by a server, or by a terminal and a server in cooperation. In this embodiment, the method is applied to a terminal as an example for explanation. Figure 5 As shown, the above step 302 can also be implemented as the following step 3021, and after step 3021, it also includes steps 501 to 502.

[0110] Step 3021, record the fragment identifier and the coordinates of the fragment center of gravity into the object data texture of the first ray tracing.

[0111] In some embodiments, the object data texture of the first ray tracing is a list created in a single ray intersection process. Optionally, when the target virtual object meets the ray reflection condition, an object identifier corresponding to the target virtual object is obtained.

[0112] In some embodiments, the object data texture of the first ray tracing also stores the object identifier of the target virtual object, that is, when storing the fragment metadata, the fragment metadata and the object identifier corresponding to it are stored in the object data texture of the first ray tracing. When subsequently rendering the target virtual object, the material information of the target virtual object is obtained based on the object identifier corresponding to the target virtual object. When the object identifier is within the range of the model list, the target virtual object is rendered based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain the light reflection effect of the target virtual object in the virtual scene.

[0113] Optionally, the object identifier (Draw ID) of the target virtual object is a pre-set and pre-processed identifier. The pre-setting and pre-processing of the object identifier are explained as follows: In the acceleration structure of ray tracing, an object (BLAS) will have one or more geometries (Geometry segments), such as: a virtual house includes geometries such as a virtual roof and virtual walls, sharing the same local to world space transformation matrix; a scene (TLAS) will have one or more instances of objects (Instance), which is consistent with the concept of Unreal Engine. Therefore, the material system needs to distinguish objects in the scene by two dimensions, geometry and instance, so that the ray tracing object data texture Visibility Buffer can distinguish each object that requires different parameter shading. Each object that requires different parameter shading will be assigned an ID, called Draw ID.

[0114] Indicatively, Figure 6 As shown, all objects participating in the material system are arranged in order in the object list 610, and each instance (Instance) of each sub-object, i.e., the above-mentioned geometric body (Segment), is numbered in turn, and the obtained one is the Draw ID. And the labeling of the Draw ID follows the following conditions: 1. The first Draw ID of each object is the hit group index (Hit Group Index) of the object, and the Hit Group Index will become the Hit Group Index field value of the scene instance when constructing TLAS in each frame; 2. The first Draw ID of each sub-object is called the base Draw ID. The client will issue Draw Calls in turn according to the Base Draw ID to perform Visibility Resolve. Therefore, each Base Draw ID corresponds to a ray tracing drawing command (Ray Query Mesh Command); 3. Draw IDs are numbered from 1, and 0 represents that there is no pixel that needs to be colored at the current position. Due to the limited precision of the depth buffer (Depth Buffer), and considering performance factors, the maximum value of Draw ID is 1023. According to the actual in-game scene calculation, 1023 Draw IDs are sufficient to represent the entire scene.

[0115] Therefore, in the Visibility Buffer generation stage, in the Shader that initiates the Ray Query, the Draw ID can be calculated using Formula 1:

[0116] Formula 1: DrawID=HitGroupIndex+GeometryIndex*InstanceID

[0117] Among them, HitGroupIndex refers to the value of the TLAS Instance passed into the scene instance, which can be obtained in the shader; GeometryIndex refers to the automatically generated geometry index, starting from 0, which can be obtained in the shader; InstanceID is a custom field of TLAS Instance, which can be obtained in the shader. Here, this value is defined as the index of the object instance, starting from 0.

[0118] In some embodiments, during the Visibility Buffer solver, the full screen coverage triangle will output a custom depth. In the Vertex Shader, the output depth is determined by the following formula 2:

[0119] Formula 2: OutPosition.z=BaseDrawID*InstanceID / 1024

[0120] Among them, OutPosition.z refers to the output depth of the full-screen covered triangle, BaseDrawID is the Base Draw ID of the object corresponding to the full-screen covered triangle passed by the client, and InstanceID is the number of the current drawing instance in the Vertex Shader, starting from 0. Through the above solution, after the full-screen covered triangle is rasterized, the advance depth test can eliminate irrelevant objects, leaving pixels with the same Draw ID to be colored by the next Pixel Shader.

[0121] Step 501 , tracing the light reflection of the target virtual object through a designated ray tracing interface, and determining data of multiple intersection hits that are hit by the reflected light source and meet the light reflection condition.

[0122] The light reflected after the target virtual object is hit by the light ray from the light source is used as the light for intersection calculation, that is, the pixel on the target virtual object that receives the light ray from the light source is used as the light source, and the emission direction of the reflected light is used as the light direction to intersect with the virtual objects in the virtual scene, so as to determine the virtual object hit by the light reflected from the target virtual object.

[0123] Among them, the multiple intersection hit data include the object identification, reflection fragment identification, and reflection fragment center of gravity coordinates of the object hit by the reflected light source, wherein the object hit by the reflected light source is an object that meets the light reflection conditions, such as: an object whose roughness parameters meet the smoothness requirements.

[0124] Step 502: Record the reflection fragment identifier and the reflection fragment centroid coordinates into the object data texture of the second ray tracing.

[0125] In the process of multiple ray intersections, different ray-traced object data textures are created for different ray intersection processes, and analytical rendering of the ray-traced object data texture is performed for each created ray-traced object data texture.

[0126] Vertex Shader is responsible for outputting full-screen coverage triangles, and its depth will be set to a custom value. The engine side passes the Base Draw ID to the Shader through a uniform buffer. Since the Base Draw ID assigned to the same object in each frame may not be the same, the Uniform Buffer will be updated frame by frame.

[0127] Pixel Shader is responsible for obtaining, assembling and coloring triangle fragment data. It mainly completes the following calculation steps: 1. Read and unpack Visibility Buffer to obtain triangle fragment identifier and fragment centroid coordinates; 2. Assemble triangles; for each vertex: a. Obtain the corresponding vertex index (Index) through the VertexFactory corresponding to the object in Unreal Engine; b. Use the vertex index to obtain all vertex attributes (Vertex Attributes) in the Vertex Buffer corresponding to the object, such as vertex color, UV, normal, etc. 3. According to the centroid coordinates obtained from Visibility Buffer, interpolate three vertices to obtain the current attribute information of the pixel; 4. Pass the attribute information into the material calculation function of Unreal Engine to obtain material information; 5. Perform lighting calculations on the material information according to the standard object rendering method, and output the color to the ray tracing effect texture.

[0128] In order to comply with the Unreal Engine's drawing process specification, the RayQuery material system needs to implement the Unreal Engine's object drawing command (Mesh Command) mechanism, that is, to collect and store the shader, resources needed for rendering, and additional parameters together for direct use during drawing. A Mesh Command corresponds to a Draw Call for an object. Optionally, for static objects, since their drawing instructions generally do not change, their Mesh Commands will be cached when the objects are added to the scene, while dynamic objects (such as dynamic characters) will be built in each frame. When building a ray tracing scene, Mesh Commands will be collected and sorted to allocate and fill their corresponding Base Draw IDs and generate a drawing list (Visible MeshCommands), where the drawing list records at least one of the following parameters: Vertex / Pixel shader reference; collected resource reference; Index Buffer reference; Base Draw ID; Instance Index: the object index participating in the ray tracing effect in the corresponding engine, that is, the TLAS Instance index; Primitive Index: the index of all objects in the scene in the corresponding engine; PrimIDValue: the persistent ID of the object; SegmentIndex: the sub-object number; NumTransforms: the number of object instances.

[0129] Optionally, during the Visibility Resolve phase, the material system will issue a Draw Call for all collected objects, but these objects may not have corresponding pixels in the Visibility Buffer. Although the hardware's EarlyDepth Test mechanism will prevent irrelevant pixels from waking up the Pixel Shader for shading, binding the pipeline and resource descriptors will also consume CPU time. Therefore, an additional array will be output during the drawing phase of the Visibility Buffer, which records whether each Draw ID appears in the current Visibility Buffer, which is called the object identification array (Draw ID Mask). The array needs to be small enough to greatly reduce the time it takes to read the array back to the central processing unit (CPU). The concept of a bit array is used here, and each bit records the existence of the Draw ID corresponding to its subscript.

[0130] Indicatively, Figure 7As shown, the above array can eliminate the Draw Call corresponding to the Draw ID that does not exist in the Visibility Buffer when performing Visibility Resolve of the current frame. However, due to the thread synchronization mechanism of the terminal itself, the task issued by the task submission thread 701 may not be completed on the rendering thread (RHI thread) 702 and the graphics processor GPU703 until one to two frames later, so the readback needs to wait for one to two frames. Since the Draw ID is not persistent for the object, the Draw ID Mask read back, its corresponding Draw ID information no longer matches the current frame Draw ID. Therefore, in the embodiment of the present application, only when the last result query is completed, will the instruction requesting readback be issued in the current frame. When the readback query of the n-1th frame ends, the instruction requesting readback begins to be issued for the nth frame.

[0131] To summarize, the scene rendering method provided in this embodiment matches the target virtual object obtained by tracing the specified ray tracing interface with the model list of the reflection range, so as to determine whether the target virtual object is within the reflection range of the light source ray. If it is within the reflection range, the target virtual object is rendered by fusing the ray tracing texture data and the material information of the target virtual object, so as to generate a light reflection effect of the target virtual object being hit by the light. When applied to the Vulkan Raytracing interface, it can also complete the rendering of the ray tracing effect on the basis of supporting ray tracing.

[0132] The method provided in this embodiment filters the virtual objects that need to be rendered through Draw ID and ray tracing object data texture, avoids data loading and calculation of virtual objects that are not in the scene or out of sight, and improves the rendering efficiency of light reflection effects.

[0133] like Figure 8 As shown, it shows a schematic diagram of the light reflection effect provided by an exemplary embodiment of the present application, where the display screen 810 in the virtual scene is the light source in the virtual scene, and the light reflection effect of the display content of the display screen 810 on the virtual object 820 is determined by the light emitting position and the light emitting direction of the light source, wherein the virtual object 820 is a glass panel with a smoothness greater than a smoothness threshold.

[0134] Fig. 9 This is a schematic diagram of the overall process provided by an exemplary embodiment of the present application. Fig. 9As shown, the virtual scene is first rendered by traditional graphics rendering technology to obtain a scene picture 910. The scene picture 910 does not include light effect rendering, such as: the glass surface 911 in the scene picture 910 does not reflect the light source. After the scene picture 910 is rendered, the ray tracing technology is used to render the reflected rays by emitting light and letting the GPU calculate the intersection. First, the scene picture 910 contains relatively smooth objects, namely the glass surface 911 and relatively rough objects, such as the beam 912.

[0135] In the physical world, smooth objects may produce mirror reflection effects. In the above embodiment, since the glass surface 911 should reflect the electronic display screen 913 next to it, we need to determine which pixels in the scene image 910 correspond to smooth surfaces and which pixels correspond to rough surfaces. This step can be completed using traditional graphics rendering technology.

[0136] For pixels on smooth surfaces, it can be considered that they will be affected by reflected light, that is, the surface of the object covered by the pixel can be regarded as a reflective surface. Therefore, it is necessary to track the emission point of the reflected light, that is, it is necessary to find the mathematical expression of the ray from the reflective object to the reflective surface, such as Fig. 9 Ray 914 in.

[0137] Because light is reflected from smooth surfaces, Fig.10 As shown, when the position of the camera model 1010 is determined, after the normal of the smooth surface 1020 is determined, the direction of the light reflected from the smooth surface 1020 to the camera model 1010 can be determined, so that the incident direction of the light emitted to the smooth surface 1020 can be determined according to the reverse direction. From the perspective of the reversible principle of the optical path, Fig. 9 and Fig.10 In the illustrated embodiment, this is referred to as the emission direction.

[0138] Use the Vulkan Ray Query interface and pass in the ray in the outgoing direction. The interface will return the information of the object hit by the ray in the outgoing direction, including object ID, fragment ID, and fragment coordinates, etc. All object IDs can be organized as a "list of models in the virtual scene within the range of light reflection", and the results of the reflected rays emitted by each pixel to be reflected (including object ID, triangle ID, triangle coordinates, etc.) are encoded into this pixel, and the result is another image, which is called Visibility Buffer, that is, the above-mentioned ray tracing object data texture.

[0139] Fig.11 is a structural block diagram of a scene rendering device provided by an exemplary embodiment of the present application, such as Fig.11As shown, the device comprises:

[0140] A determination module 1110 is used to trace the light emission of the light source ray in the virtual scene through a specified ray tracing interface to determine the target virtual object hit by the light source ray;

[0141] An acquisition module 1120 is used to acquire a model list within the reflection range in the virtual scene, where the virtual objects in the model list are model objects currently to be rendered;

[0142] The rendering module 1130 is used to render the target virtual object based on the ray tracing texture data of the light source ray and the object texture data of the target virtual object when the target virtual object is within the range of the model list, so as to obtain the light reflection effect of the reflection surface of the target virtual object in the virtual scene.

[0143] In an optional embodiment, the determination module 1110 is further used to trace the light emission of the light source reflected ray in the virtual scene through the specified ray tracing interface to obtain object hit data of the light source reflected ray, wherein the object hit data includes fragment metadata of the target virtual object hit by the light source reflected ray, and the fragment metadata includes a fragment identifier and a fragment centroid coordinate;

[0144] like Fig.12 As shown, the device also includes:

[0145] A recording module 1140, configured to record the fragment identifier and the fragment centroid coordinates into a visibility buffer, wherein the target virtual object corresponds to one or more fragment data in the visibility buffer;

[0146] The rendering module 1130 is also used to render the light reflection effect of the target virtual object on the reflective surface based on the fragment metadata corresponding to the target virtual object in the texture list and the object texture data of the target virtual object when the target virtual object is within the range of the model list, so as to obtain the light reflection effect of the target virtual object in the virtual scene.

[0147] In an optional embodiment, the recording module 1140 is further configured to record the fragment identifier and the fragment centroid coordinates into the first object data texture;

[0148] The determination module 1110 is further configured to trace the light reflection of the target virtual object through a specified ray tracing interface, and determine multiple intersection hit data that are hit by the reflected light source and meet the light reflection condition, wherein the multiple intersection hit data include an object identifier, a reflection fragment identifier, and a centroid coordinate of the reflection fragment of the object hit by the reflected light source;

[0149] The recording module 1140 is further configured to record the reflection fragment identifier and the reflection fragment centroid coordinates into the second object data texture.

[0150] In an optional embodiment, the determination module 1110 is further used to trace the light emission of the light source reflected ray in the virtual scene through the specified ray tracing interface to determine the candidate virtual object hit by the light source reflected ray;

[0151] The acquisition module 1120 is further used to acquire the object roughness parameter of the candidate virtual object;

[0152] The determination module 1110 is further configured to determine that the candidate virtual object is the target virtual object if the object roughness parameter of the candidate virtual object meets the light reflection condition.

[0153] In an optional embodiment, the determination module 1110 is also used to determine a reflective surface in the virtual scene, where the reflective surface is a surface of a virtual object that meets the light reflection condition; the light emission direction of the light source ray is obtained based on the model position of the camera model and the surface orientation of the reflective surface, and the camera model is used to capture the scene image of the virtual scene; and the light emission direction of the light source ray is reversely traced through a specified ray tracing interface to determine the target virtual object hit by the light emission direction.

[0154] In an optional embodiment, the acquisition module 1120 is further used to obtain the identification of virtual objects in the virtual scene that are hit by the light emission direction; and determine the list of models within the reflection range based on the identification of virtual objects hit by the light emission direction.

[0155] In an optional embodiment, the acquisition module 1120 is also used to obtain surface normal information of the reflective surface; obtain the direction of incident light from the model position of the camera model to the reflective surface; and determine the light emission direction of the light source ray based on the incident light direction and the surface normal information.

[0156] In an optional embodiment, the acquisition module 1120 is also used to acquire the material information of the target virtual object based on the object identifier corresponding to the target virtual object; when the object identifier is within the range of the model list, the target virtual object is rendered based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain the light reflection effect of the reflective surface of the target virtual object in the virtual scene.

[0157] The rendering module 1130 is further used to perform scene rendering on the virtual scene by using a graphics rendering technology to obtain a scene rendering effect, wherein the scene rendering effect does not include a light reflection effect.

[0158] To summarize, the scene rendering device provided in this embodiment matches the target virtual object obtained by tracing the specified ray tracing interface with the model list of the visible range, so as to determine whether the target virtual object is within the visible range of the player. If it is within the visible range of the player, the target virtual object is rendered by fusing the ray tracing texture data and the object texture data of the target virtual object, so as to generate a light reflection effect of the target virtual object being hit by light. The application of the Vulkan Raytracing interface can also complete the rendering of the ray tracing effect on the basis of supporting ray tracing.

[0159] It should be noted that the scene rendering device provided in the above embodiment is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the scene rendering device provided in the above embodiment is based on the same concept as the scene rendering method embodiment. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0160] The present application also provides a computer device, which includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the scene rendering method provided by each of the above method embodiments. It should be noted that the computer device can be as follows Fig.11 Computer equipment provided.

[0161] Please refer to Fig.13, which shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. Specifically, the computer device 1300 includes a central processing unit (CPU) 1301, a system memory 1304 including a random access memory (RAM) 1302 and a read-only memory (ROM) 1303, and a system bus 1305 connecting the system memory 1304 and the central processing unit 1301. The computer device 1300 also includes a basic input / output system (I / O system) 1306 that helps transmit information between various devices in the computer, and a large-capacity storage device 1307 for storing an operating system 1313, application programs 1314 and other program modules 1315.

[0162] The basic input / output system 1306 includes a display 1308 for displaying information and an input device 1309 such as a mouse and a keyboard for user inputting information. The display 1308 and the input device 1309 are connected to the central processing unit 1301 through an input / output controller 1310 connected to the system bus 1305. The basic input / output system 1306 may also include an input / output controller 1310 for receiving and processing inputs from a plurality of other devices such as a keyboard, a mouse, or an electronic stylus. Similarly, the input / output controller 1310 also provides output to a display screen, a printer, or other types of output devices.

[0163] The mass storage device 1307 is connected to the central processing unit 1301 through a mass storage controller (not shown) connected to the system bus 1305. The mass storage device 1307 and its associated computer readable media provide non-volatile storage for the computer device 1300. That is, the mass storage device 1307 may include a computer readable medium (not shown) such as a hard disk or a CD-ROM drive.

[0164] Without loss of generality, the computer readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid-state storage technologies, CD-ROM, DVD or other optical storage, cassettes, magnetic tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage media is not limited to the above. The above-mentioned system memory 1304 and mass storage device 1307 can be collectively referred to as memory.

[0165] The memory stores one or more programs, and the one or more programs are configured to be executed by one or more central processing units 1301. The one or more programs include instructions for implementing the above-mentioned scene rendering method or the translation method based on the machine translation model. The central processing unit 1301 executes the one or more programs to implement the scene rendering method or the translation method based on the machine translation model provided by the above-mentioned various method embodiments.

[0166] According to various embodiments of the present invention, the computer device 1300 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 1300 can be connected to the network 1312 through the network interface unit 1311 connected to the system bus 1305, or the network interface unit 1311 can be used to connect to other types of networks or remote computer systems (not shown).

[0167] The memory further includes one or more programs, which are stored in the memory and include steps executed by a computer device in the scene rendering method provided in the embodiment of the present invention.

[0168] An embodiment of the present application also provides a computer device, which includes a memory and a processor, wherein the memory stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is loaded by the processor to implement the above-mentioned scene rendering method.

[0169] An embodiment of the present application also provides a computer-readable storage medium, which stores at least one instruction, at least one program, a code set or an instruction set. The at least one instruction, the at least one program, the code set or the instruction set are loaded and executed by the processor to implement the above-mentioned scene rendering method.

[0170] The present application also provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the scene rendering methods provided by the above-mentioned various method embodiments.

[0171] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware through a program, and the program can be stored in a computer-readable storage medium, which can be a computer-readable storage medium contained in the memory in the above embodiments; or it can be a computer-readable storage medium that exists independently and is not assembled in the terminal. The computer-readable storage medium stores at least one instruction, at least one program, code set or instruction set, and the at least one instruction, the at least one program, the code set or instruction set is loaded and executed by the processor to implement the above scene rendering method or the translation method based on the machine translation model.

[0172] Optionally, the computer readable storage medium may include: a read-only memory (ROM), a random access memory (RAM), a solid state drive (SSD), or an optical disk. Among them, the random access memory may include a resistance random access memory (ReRAM) and a dynamic random access memory (DRAM). The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0173] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0174] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application.

Claims

1. A scene rendering method, It is characterized in that The method comprises: Tracing the light emission of the light source ray in the virtual scene through a specified ray tracing interface to determine the target virtual object hit by the light source ray; Acquire a list of models within the reflection range in the virtual scene, wherein the virtual objects in the list of models are model objects within the reflection range of the light source; When the target virtual object is within the model list, the target virtual object is rendered based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain a light reflection effect of the reflective surface of the target virtual object in the virtual scene.

2. The method according to claim 1, It is characterized in that The step of tracing the light emission of the light source ray in the virtual scene by specifying a ray tracing interface to determine the target virtual object hit by the light source ray includes: Tracing the light emission of the light source ray in the virtual scene through the designated ray tracing interface to obtain object hit data of the light source ray, wherein the object hit data includes fragment metadata of the target virtual object hit by the light source ray, and the fragment metadata includes a fragment identifier and a fragment centroid coordinate; Recording the fragment identifier and the coordinates of the centroid of the fragment into a ray-traced object data texture, wherein the target virtual object corresponds to one or more fragment data in the object data texture; When the target virtual object is within the model list, rendering the target virtual object based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain the light reflection effect of the target virtual object in the virtual scene includes: When the target virtual object is within the range of the model list, the light reflection effect of the target virtual object on the reflective surface is rendered based on the fragment metadata corresponding to the target virtual object in the ray tracing object data texture and the material information of the target virtual object to obtain the light reflection effect of the target virtual object in the virtual scene.

3. The method according to claim 2, It is characterized in that The step of recording the fragment identifier and the coordinates of the centroid of the fragment into the object data texture of ray tracing includes: Recording the fragment identifier and the coordinates of the centroid of the fragment into a first object data texture; The method further comprises: Tracing the light reflection of the target virtual object through a specified ray tracing interface, determining multiple intersection hit data that is hit by the reflected light source and meets the light reflection condition, wherein the multiple intersection hit data includes an object identifier, a reflection fragment identifier, and a centroid coordinate of the reflection fragment of the object hit by the reflected light source; The reflection fragment identifier and the reflection fragment center coordinates are recorded in the second object data texture.

4. The method according to any one of claims 1 to 3, It is characterized in that The step of tracing the light emission of the light source ray in the virtual scene by specifying a ray tracing interface to determine the target virtual object hit by the light source ray includes: Tracing the light emission of the light source ray in the virtual scene through the designated ray tracing interface to determine the candidate virtual object hit by the light source ray; Obtaining an object roughness parameter of the candidate virtual object; When the object roughness parameter of the candidate virtual object meets the light reflection condition, the candidate virtual object is determined to be the target virtual object.

5. The method according to any one of claims 1 to 3, It is characterized in that The step of tracing the light emission of the light source ray in the virtual scene by specifying a ray tracing interface to determine the target virtual object hit by the light source ray includes: Determining a reflective surface in the virtual scene, the reflective surface being a surface of a virtual object that meets the light reflection condition; Acquiring the light emission direction of the light source ray based on the model position of the camera model and the surface orientation of the reflection surface, wherein the camera model is used to collect scene images of the virtual scene; The light emitting direction of the light source ray is traced in reverse through a designated ray tracing interface to determine a target virtual object hit by the light emitting direction.

6. The method according to claim 5, It is characterized in that The step of obtaining a list of models in the virtual scene that are within a reflection range includes: Obtaining identifications of virtual objects in the virtual scene that are hit by the light emission direction; A list of models within the reflection range is determined based on virtual object identifiers hit by the light emission direction.

7. The method according to claim 5, It is characterized in that The method of obtaining the light emission direction of the light source ray based on the model position of the camera model, the model acquisition direction and the surface orientation of the reflection surface includes: Acquiring surface normal information of the reflective surface; Acquire the direction of incident light from the model position of the camera model to the reflective surface; The light emission direction of the light source ray is determined based on the incident light direction and the surface normal information.

8. The method according to any one of claims 1 to 3, It is characterized in that When the target virtual object is within the range of the model list, rendering the target virtual object based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain a light reflection effect of a reflection surface of the target virtual object in the virtual scene includes: Acquire the material information of the target virtual object based on the object identifier corresponding to the target virtual object; When the object identifier is within the range of the model list, the target virtual object is rendered based on the ray tracing texture data of the light source ray and the material information of the target virtual object to obtain a light reflection effect of the reflective surface of the target virtual object in the virtual scene.

9. The method according to any one of claims 1 to 3, It is characterized in that Before tracing the light emission of the light source ray in the virtual scene through the specified ray tracing interface, the method further includes: The virtual scene is rendered by using a graphics rendering technology to obtain a scene rendering effect, wherein the scene rendering effect does not include a light reflection effect.

10. A scene rendering device, It is characterized in that The device comprises: A determination module, used to trace the light emission of the light source ray in the virtual scene through a specified ray tracing interface, and determine the target virtual object hit by the light source ray; An acquisition module, used for acquiring a model list within the reflection range in the virtual scene, wherein the virtual objects in the model list are model objects currently to be rendered; A rendering module is used to render the target virtual object based on the ray tracing texture data of the light source ray and the object texture data of the target virtual object when the target virtual object is within the model list, so as to obtain the light reflection effect of the reflection surface of the target virtual object in the virtual scene.

11. A computer device, It is characterized in that The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the scene rendering method according to any one of claims 1 to 9.

12. A computer-readable storage medium, It is characterized in that At least one instruction is stored in the readable storage medium, and the at least one instruction is loaded and executed by the processor to implement the scene rendering method according to any one of claims 1 to 9.

13. A computer program product, It is characterized in that It comprises a computer program or an instruction, and when the computer program or the instruction is executed by a processor, it implements the scene rendering method as described in any one of claims 1 to 9.

Citation Information

Cited By

  • Image rendering method and device, storage medium and program product

    CN119762655A

  • Image rendering method, device, storage medium and program product

    CN119762655B

  • Method for calculating minimum oil supply pressure of main oil duct meeting cooling and lubricating requirements of bearing bush

    CN119918445A

  • A method for calculating the minimum oil supply pressure of the main oil passage for bearing cooling and lubrication.

    CN119918445B

  • Model rendering method and device, electronic equipment and storage medium

    CN119991915A