Image display method and device, electronic equipment and storage medium
By using ray tracing algorithm on mobile terminals to obtain objects and positions hit by reflected light and replace pixel colors, the game display problem caused by limited hardware configuration of mobile terminals is solved, and the light and shadow effect and user experience are improved.
Patent Information
- Application Number
- CN202310519680.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-09
- Publication Date
- 2024-11-12
AI Technical Summary
The limited hardware configuration of mobile terminals affects the display of game functions, resulting in poor user experience, especially in simulating light and shadow effects.
Use ray tracing algorithm to obtain the object hit by the reflected light at a specified position, determine the position where the object hits by the reflected light, and replace the pixel color with the pixel color corresponding to the position hit by the reflected light, to draw a more vivid and realistic reflected image.
It enhances the visual experience of the game and enhances the user's immersive experience by drawing more realistic reflected images at the designated locations in the scene space.
Smart Images

Figure CN118941690A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image display technology, and more specifically, to an image display method, apparatus, electronic device, and storage medium. Background Art
[0002] With the vigorous development of games and the increasing functionality of mobile devices, mobile devices can support a growing number of games. However, due to the limited hardware configuration of mobile devices, the display of some game functions needs improvement, affecting the user experience. Summary of the Invention
[0003] In view of the above problems, this application proposes an image display method, apparatus, electronic device, and storage medium to improve the above problems.
[0004] In a first aspect, embodiments of this application provide an image display method applied to an electronic device. The method includes: using a ray tracing algorithm to obtain an object hit by reflected light at a specified location, wherein the specified location represents the position where a specified area of a scene space is hit by light; determining the position where the object is hit by the reflected light; and replacing the pixel color at the specified location with the pixel color corresponding to the position where the reflected light hits the object, so as to draw a reflection image corresponding to the object at the specified location.
[0005] Secondly, embodiments of this application provide an image display device operating in an electronic device. The device includes: a hit object acquisition module, configured to acquire an object hit by reflected light at a specified location using a ray tracing algorithm, wherein the specified location represents the position where a specified area of a scene space is hit by light; a position determination module, configured to determine the position where the object is hit by the reflected light; and a display module, configured to replace the pixel color at the specified location with the pixel color corresponding to the position where the reflected light hits the object, so as to draw a reflection image corresponding to the object at the specified location.
[0006] Thirdly, this application provides an electronic device including one or more processors and a memory; one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs being configured to perform the method described in the first aspect above.
[0007] Fourthly, this application provides a computer-readable storage medium storing program code, wherein the method described in the first aspect is executed when the program code is run.
[0008] This application provides an image display method, apparatus, electronic device, and storage medium. It employs a ray tracing algorithm to obtain the object hit by reflected light at a specified location, where the specified location represents the position in a specified area of the scene space where the light hits. The method determines the position where the object is hit by the reflected light; and replaces the pixel color at the specified location with the pixel color corresponding to the position hit by the reflected light, thereby drawing a reflection image corresponding to the object at the specified location. This method enables the drawing of reflection images corresponding to objects in the game at specified locations in the scene space. Compared to undrawn reflection images, the ray tracing effect of the drawn reflection image is more vivid and realistic, improving the user experience to a certain extent. Attached Figure Description
[0009] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 A flowchart of an image display method according to an embodiment of this application is shown.
[0011] Figure 2 An example diagram showing the display effect of the image display method provided in the embodiments of this application is shown.
[0012] Figure 3 A flowchart of an image display method according to another embodiment of this application is shown.
[0013] Figure 4 An example diagram is shown where the storage space provided in this application stores the rgba value of the pixel color to be replaced at a specified location.
[0014] Figure 5 A flowchart of an image display method according to another embodiment of this application is shown.
[0015] Figure 6 A flowchart of an image display method according to another embodiment of this application is shown.
[0016] Figure 7 A structural block diagram of an image display device according to an embodiment of this application is shown.
[0017] Figure 8 A structural block diagram of an electronic device for performing an image display method according to an embodiment of the present application is shown.
[0018] Figure 9 This is a storage unit in this application embodiment for storing or carrying program code that implements an image display method according to this application embodiment. Detailed Implementation
[0019] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0020] Ray tracing, short for Ray Tracing, is a special rendering algorithm in 3D computer graphics that traces the "path" of light rays from their source to an object and then from the object's reflection. Ray tracing technology can bring realistic physical lighting and shadow effects to mobile games, helping players enjoy an immersive visual experience.
[0021] Unlike traditional rasterization, ray tracing constructs the lighting scene of a virtual image by simulating the physical behavior of light and optimizing image effects such as reflections and shadows, thereby making the virtual 3D scene present more realistic lighting effects, material textures, and object positional relationships.
[0022] However, due to the limited hardware configuration of the target mobile terminal, the display of some game functions still needs improvement, which affects the user experience.
[0023] To address the aforementioned issues, the inventors, after extensive research, proposed the image display method, apparatus, electronic device, and storage medium provided in this application. This method is applied to electronic devices and can render the reflection image of an object in a game at a specified location in the scene space. Compared to a reflection image that is not actually rendered, the ray tracing effect of the rendered reflection image is more vivid and realistic, thus improving the user experience to a certain extent.
[0024] To facilitate a better understanding of the content described in this application, the following is a brief explanation of the relevant terms involved or that may be involved in the image display method described in the embodiments of this application.
[0025] Ray tracing: A ray tracing algorithm, a rendering algorithm; the basic rendering process is to calculate what objects the rays will hit for each pixel and how to render the color of that pixel.
[0026] Rasterization: A mainstream rendering algorithm; the process involves drawing objects one by one, calculating which pixel positions the objects will appear on the screen, and then rendering the colors.
[0027] Visibility Buffer: A texture map where each pixel stores the object ID, triangle ID, and difference position for the object to be displayed in the future.
[0028] Shader: A shader is a computer program that runs on the GPU (e.g., a fragment shader calculates the color of a pixel).
[0029] Ray Tracing Pipeline: A hardware-supported algorithm for ray tracing, currently only supported by computer graphics cards. After use, it can rotate and execute a certain shader at runtime.
[0030] Ray Query: A hardware-supported ray tracing algorithm that allows use in general shaders. It is currently the only hardware ray tracing algorithm supported by mobile chips (mobile devices do not support runtime jump to execute shaders).
[0031] Reverse light source point: The observation point during rendering, which is equivalent to the pattern on the final screen that can be obtained by observing from this position.
[0032] The embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0033] Please see Figure 1 One embodiment of this application provides an image display method that can be applied to electronic devices, the method comprising:
[0034] Step S110: Use a ray tracing algorithm to obtain the object hit by the reflected light at the specified location, where the specified location represents the position in the scene space where the light hits a specified area.
[0035] In this embodiment, the scene space can be understood as a three-dimensional space of a business scenario. This business scenario can be a game scenario or a modeling scenario, and the specific type of the business scenario is not limited. For example, it can be any three-dimensional scene that pursues virtual lighting and shadow effects. This embodiment uses a game scenario as an example for illustration.
[0036] The scene space can include various types of objects, such as flowers, trees, virtual game characters, buildings, rivers, ponds, bridges, etc. In this embodiment, a region within the scene space that has reflective properties is designated as the specified region. For example, taking a game scene space as an example, the area containing water, rivers, or ponds within the game scene space can be designated as the specified region. The specified region is a two-dimensional plane.
[0037] When a player (a virtual game character) walks to the water's edge, light shines on other objects in the scene and reflects off them onto the water's surface. This reflection then reaches the player's eyes (their field of vision). The player can then see the reflections (shadows) of other objects in the scene on the water's surface. However, due to the limited hardware capabilities of current mobile devices, they cannot support ray tracing algorithms to truly render the reflections of other objects in the scene as seen by the player on the water's surface. This results in a need for improvement in the game's visual experience.
[0038] As a way to optimize the above problems, this application embodiment takes the perspective of a certain game player in the scene space as the starting point, that is, the position of the game player's perspective is as the reverse light emission point. The position of the reverse light emission point can change due to the movement of the game player, and then the ray tracing algorithm is used to reverse track the reflected light corresponding to the emitted light from the reverse light emission point.
[0039] In the process of reverse ray tracing using ray tracing algorithms, the inverse ray emission point can emit rays, and the specific number and direction of the emitted rays are not limited. Rays emitted from the inverse ray emission point can hit a designated area in the scene space. As one approach, the location where the rays from the inverse ray emission point hit a designated area can be defined as the designated location. If all rays from the inverse ray emission point hit the designated area, the number of rays can be proportional to the number of designated locations (i.e., the number of rays is the same as the number of designated locations). For example, if there is only one ray, there can be only one designated location; if there are multiple rays, there can be multiple designated locations. Alternatively, the number of rays can be greater than the number of designated locations. In this case, at least one ray can hit a designated location; that is, it can be one ray hitting a designated location, or multiple rays hitting a designated location.
[0040] The specified area can be transparent, in which case the color value of the pixels in the specified area can be RGB(255,255,255); the specified area can also be opaque, in which case the color value of the pixels in the specified area can be any value between RGB(0,0,0) and RGB(255,255,255). The color space of the color value of the pixels in the specified area is not limited, and the specified area has reflective properties.
[0041] When a ray of light hits a designated area, the point where it hits can be called the designated location. The ray will reflect off this designated location from the designated area, and this reflected ray can be considered the reflected ray corresponding to the designated location. The reflected ray can hit other objects in the scene space. To provide better lighting and shadow effects and enhance the visual experience in the game scene, one method is to use a ray tracing algorithm to obtain the objects hit by the reflected ray at the designated location. The specific acquisition principle and implementation process will not be elaborated here. It is understandable that there can be multiple designated locations within a designated area hit by the ray. In this way, each designated location can correspond to one reflected ray, resulting in multiple reflected rays. These multiple reflected rays can hit different objects, or some different reflected rays can hit the same object.
[0042] Step S120: Determine the position where the object is hit by the reflected light.
[0043] Every object in the scene space is three-dimensional and solid, and each object can be composed of numerous triangles. After a reflected ray at a specified position hits an object in the scene space, in order to accurately display the lighting effects of these hit objects at a specified location within a specified area, the position where the reflected ray hits the object can be determined first.
[0044] To accurately identify the location where a reflected ray hits an object, all object models in the scene space can be numbered, as can the triangles within each object model, and the position points of each triangle. The model number uniquely identifies which object in the scene space was hit by the reflected ray; the triangle number identifies which triangle within the object's model was hit; and the position point number identifies the specific location of a particular triangle within the object's model that was hit.
[0045] Step S130: Replace the pixel color at the specified position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflection image corresponding to the object at the specified position.
[0046] Once the location where the reflected ray hits an object is determined, the pixel color at the specified location can be directly replaced with the pixel color corresponding to the location hit by the reflected ray, thus drawing a reflection image corresponding to the object at that location. Specifically, after determining the location where the reflected ray hits an object, the pixel color corresponding to that location can be obtained, and then the pixel color at the specified location can be replaced with the pixel color corresponding to the location hit by the reflected ray. This achieves a realistic display of the lighting and shadow effects of the object hit by the reflected ray at the specified location, thereby enhancing the user's visual experience in the game.
[0047] In a specific application scenario, please refer to Figure 2 The diagram illustrates an example of the display effect of the image display method provided in this embodiment. Figure 2 As shown, taking a game scenario as an example, the scene space includes object 1, object 2, and object 3 (the actual number of objects in the scene space is not limited, and the specific types of object 1, object 2, and object 3 are not limited here). Object 1 can be a carrier of a reverse-emitting light point or an object capable of emitting light. The designated area is the reflection area in the scene space. As one implementation, light is emitted from object 1. After the light hits the designated area, the point where the light is hit can be used as a reflection point, and the light is reflected out by the designated area, then hitting object 2 and object 3 in the scene space. The positions of the objects hit by the light after being reflected from the designated area will vary depending on where the light hits the designated area. For example, the three upper rays emitted by object 1 hit three different positions in the designated area, and these three rays, after being reflected out by the designated area, hit three different positions in object 2; the two lower rays emitted by object 1 hit two different positions in the designated area, and these two rays, after being reflected out by the designated area, hit two different positions in object 3.
[0048] As one implementation method, the pixel color at a specified location within a specified area hit by light emitted from object 1 can be replaced with the pixel color corresponding to the location of the object hit by light reflected from the specified area, resulting in... Figure 2 The diagram shows the effect of dashed lines within the designated area. The dashed pentagram represents the reflected image corresponding to object 2, and the dashed square represents the reflected image corresponding to object 3. It should be noted that the virtual pentagram and virtual square shown in diagram 2 are both complete images, each composed of many pixels. For example, for object 2... Figure 2Only three specified locations are drawn (not all locations are drawn, but the principle is similar). In the actual implementation, each reflection image consists of multiple pixels. The original color of each pixel is the color corresponding to its location when the scene space is drawn as a whole on the 2D screen. It is then replaced with the pixel color corresponding to the location of the object hit by the light reflected from the specified area. The reflection image displayed within the specified area is a 2D image.
[0049] This application provides an image display method that uses a ray tracing algorithm to obtain the object hit by reflected light at a specified location, where the specified location represents the position in a specified area of the scene space where the light hits the object; determines the position where the object is hit by the reflected light; and replaces the pixel color at the specified location with the pixel color corresponding to the position hit by the reflected light, thereby drawing a reflection image corresponding to the object at the specified location. Thus, this method enables the drawing of reflection images corresponding to objects in the game at specified locations within a specified area of the scene space. Compared to undrawn reflection images, the ray tracing effect of the drawn reflection image is more vivid and realistic, improving the user experience to a certain extent.
[0050] Please see Figure 3 Another embodiment of this application provides an image display method, which can be applied to electronic devices, the method comprising:
[0051] Step S210: Use a ray tracing algorithm to obtain the object hit by the reflected light at the specified location, where the specified location represents the position in the scene space where the light hits a specified area.
[0052] In this embodiment, a ray tracing algorithm can be used to obtain the object hit by the reflected light at a specified location, thereby achieving a more global ray tracing effect. In at least one embodiment, the ray tracing algorithm can be a ray query.
[0053] It should be noted that, for a player in the scene space, if the player's viewpoint is taken as the reverse light source, and a ray tracing algorithm is used to obtain the object hit by the reflected ray at a specified position, then the object hit by the ray at the specified position can be in front of the player (i.e., within the player's line of sight; this line of sight can be 0°-180° without the player turning their head, and the specific value of the line of sight is not limited). For example, as shown in Figure 2, objects 2 and 3 are in front of object 1. The object hit by the ray at the specified position can also be outside the player's line of sight; for example, these objects can be objects behind the player. Figure 2 The object behind object 1 shown.
[0054] When the object hit by the ray at the designated location is an object outside the player's line of sight, the player cannot see these objects directly from the current perspective, but can see the reflected images of these indirect objects from the designated area.
[0055] Step S220: Determine the position where the object is hit by the reflected light based on the position data of the designated area in the scene space and the position data of the reflected light.
[0056] For electronic devices, all objects in the scene space, the spatial relationships between all objects, and the specific positions of each object in the scene space all exist in the form of data. At this time, the position data of a specified area in the scene space and the position data of reflected light can be obtained, so as to determine the position where the object is hit by the reflected light based on the position data of the specified area in the scene space and the position data of reflected light.
[0057] The location data of the specified area within the scene space can include the coordinates, direction, and angle of the specified area within the scene space. The location data of the reflected light can include the reflection angle and direction when the light is reflected by the specified area. Since the location data of each object in the scene space is known, it is possible to directly determine which object in the scene space will be hit after the light is reflected by the specified area, and at what position of that object, based on the location data of the specified area within the scene space and the location data of the reflected light, thereby determining the position of the object hit by the reflected light.
[0058] Step S230: Using a rasterization algorithm, the pixel color at the specified position is replaced with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflection image corresponding to the object at the specified position.
[0059] In this embodiment, after determining the location where the object is hit by reflected light, a storage space corresponding to a specified area can be obtained; a reflection position parameter corresponding to the location where the object is hit by reflected light can be obtained; and the reflection position parameter can be stored in the storage space. The storage space corresponding to the specified area is used to store the RGBA value (e.g., RGBA value of the pixel color to be replaced at each specified location where the specified area is hit) of the pixel. Figure 4 The diagram illustrates an example of how the storage space provided in this embodiment stores the RGBA values of the pixel color to be replaced at a specified location. Figure 4 The object shown is a "dragon" (the rgba value can be different at different positions of the dragon), and the reflection position parameter can be understood as the position data of the reflected light described in the previous embodiment.
[0060] One approach is to use a rasterization algorithm to replace the pixel color at a specified location with the pixel color corresponding to the location hit by the reflected ray, thereby drawing a reflection image corresponding to the object at a specified location within a specified area. Specifically, a texture map corresponding to the object hit by the reflected ray can be obtained. This texture map records the pixel colors of each surface of the object. The pixel colors corresponding to the reflection position parameters recorded in storage can be retrieved from this texture map. Then, the pixel color at the specified location is replaced with the pixel color corresponding to the reflection position parameters. By performing this operation for each specified location hit within a specified area, a virtual object with the same shape as the object can be displayed at the specified location within the specified area, i.e., a reflection image corresponding to the object.
[0061] By combining ray tracing and rasterization algorithms to render the reflection image corresponding to an object, the lighting and shadow effects in the scene space can be improved while displaying the reflection image corresponding to the object more realistically.
[0062] In this embodiment, the number of designated locations within a designated area can be multiple. In this case, a ray tracing algorithm can be used to obtain the objects hit by the reflected rays corresponding to each of the multiple designated locations. The objects hit by the reflected rays at each of the multiple designated locations can be one or more. For example, assuming there are 5 designated locations, the objects hit by the reflected rays at each of these 5 designated locations can be 1, 2, 3, 4, or 5. Then, when replacing the pixel color of the designated location with the pixel color corresponding to the location hit by the reflected rays, to draw the reflection image corresponding to the object at the designated location, the pixel colors of the multiple designated locations can be replaced with the pixel colors corresponding to the locations where the objects hit by the reflected rays are respectively drawn at the multiple designated locations. That is, the reflection image corresponding to the object will be displayed at the designated location corresponding to the object within the designated area. For example, as described above... Figure 2 It will display the reflection image of object 2 at the location of the virtual pentagram in the specified area, instead of displaying the reflection image of object 3.
[0063] This application provides an image display method that uses a ray tracing algorithm to obtain the object hit by reflected light at a specified location, where the specified location represents the position in a specified area of the scene space where the light hits. Based on the position data of the specified area within the scene space and the position data of the reflected light, the method determines the position where the object is hit by the reflected light. Then, using a rasterization algorithm, the pixel color at the specified location is replaced with the pixel color corresponding to the position hit by the reflected light, thereby drawing a reflection image corresponding to the object at the specified location. This method enables the drawing of reflection images corresponding to objects in the game at specified locations within a specified area of the scene space. Compared to undrawn reflection images, the ray tracing effect of the drawn reflection image is more vivid and realistic, improving the user experience to some extent.
[0064] Please see Figure 5 Another embodiment of this application provides an image display method, which can be applied to electronic devices, the method comprising:
[0065] Step S310: Use a ray tracing algorithm to obtain the object hit by the reflected light at the specified location, where the specified location represents the position in the scene space where the light hits a specified area.
[0066] The specific implementation of step S310 can be referred to the relevant descriptions of steps S110 and S210 in the foregoing embodiments, and will not be repeated here.
[0067] Step S320: Determine the position where the object is hit by the reflected light.
[0068] The specific implementation of step S320 can be referred to the relevant descriptions of steps S120 and S220 in the foregoing embodiments, and will not be repeated here.
[0069] Step S330: For each of the multiple objects, using the same shader as the original model of the object, the pixel color at the specified position is replaced with the pixel color corresponding to the position hit by the reflected light, so as to draw the reflection image corresponding to each of the multiple objects at the specified position. The original models of different objects are different.
[0070] A scene space can include multiple objects. As one approach, for each of these objects, the same shader as the object's original model can be used to render the object model in the original order, following the normal rendering pipeline. The pixel color at a specified location can be replaced with the pixel color corresponding to the location hit by the reflected ray, thus rendering the reflection image corresponding to each of the multiple objects at that specified location (e.g., ...). Figure 2The specified area shown shows the reflection images of objects 2 and 3 respectively. The original models of the different objects are different.
[0071] This application provides an image display method that uses a ray tracing algorithm to obtain the object hit by reflected light at a specified location, where the specified location represents the position in a specified area of the scene space where the light hits. The method determines the position where the object is hit by the reflected light. For each of the multiple objects, using the same shader as the object's original model, the pixel color at the specified location is replaced with the pixel color corresponding to the position hit by the reflected light, thereby drawing a reflection image corresponding to each of the multiple objects at the specified location. The original models of different objects are different. This method enables the drawing of reflection images corresponding to objects in the game at specified locations within a specified area of the scene space. Compared to undrawn reflection images, the ray tracing effect of the drawn reflection images is more vivid and realistic, improving the user experience to a certain extent.
[0072] Please see Figure 6 Another embodiment of this application provides an image display method, which can be applied to electronic devices, the method comprising:
[0073] Step S410: Use a ray tracing algorithm to obtain the object hit by the reflected light at the specified location, where the specified location represents the position in the scene space where the light hits a specified area.
[0074] The specific implementation of step S410 can be referred to the relevant descriptions of steps S110 and S210 in the foregoing embodiments, and will not be repeated here.
[0075] Step S420: Determine the position where the object is hit by the reflected light.
[0076] The specific implementation of step S420 can be referred to the relevant descriptions of steps S120 and S220 in the foregoing embodiments, and will not be repeated here.
[0077] Step S430: Replace the pixel color at the specified position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflection image corresponding to the object at the specified position.
[0078] The specific implementation of step S430 can be referred to the relevant descriptions of steps S130 and S230 in the foregoing embodiments, and will not be repeated here.
[0079] Step S440: Use a rasterization algorithm to draw the object image in the scene space.
[0080] As one approach, after drawing the reflection image corresponding to the object at a specified location within a specified area, a rasterization algorithm can be used to draw images of other objects in the scene space. This allows for the display of both the object images in the game scene space and their reflections within the game scene space, thus achieving a complete display of the game scene space image and enhancing the user's visual gaming experience.
[0081] This application provides an image display method that uses a ray tracing algorithm to obtain the object hit by reflected light at a specified location, where the specified location represents the position in a specified area of the scene space where the light hits; determines the position where the object is hit by the reflected light; replaces the pixel color at the specified location with the pixel color corresponding to the position hit by the reflected light, thereby drawing a reflection image corresponding to the object at the specified location; and uses a rasterization algorithm to draw the object image within the scene space. Thus, this method enables the drawing of reflection images corresponding to objects in the game at specified locations within a specified area of the scene space. Compared to undrawn reflection images, the ray tracing effect of the drawn reflection image is more vivid and realistic, improving the user experience to a certain extent.
[0082] Furthermore, by displaying both images of objects within the game scene space and their reflections, a complete view of the game scene space can be achieved, thus enhancing the user's visual experience. Additionally, ray tracing combined with rasterization rendering can improve the game's lighting and shadow effects, as well as the display of reflections.
[0083] Please see Figure 7 This application provides an image display device 500, which operates in an electronic device. The device 500 includes:
[0084] The object acquisition module 510 is used to acquire the object hit by the reflected light at a specified position using a ray tracing algorithm. The specified position represents the location in a specified area of the scene space where the light hits the object.
[0085] The position acquisition module 520 is used to determine the position where the object is hit by the reflected light.
[0086] In one approach, the location acquisition module 520 can be used to determine the position where the object is hit by the reflected light based on the location data of the specified area within the scene space and the location data of the reflected light.
[0087] The display module 530 is used to replace the pixel color at the specified position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflection image corresponding to the object at the specified position.
[0088] In this embodiment, the number of objects can be multiple. In this way, the display module 530 can be used to replace the pixel color at the specified position with the pixel color corresponding to the position hit by the reflected light for each of the multiple objects using the same shader as the original model of the object, so as to draw a reflection image corresponding to each of the multiple objects at the specified position, and the original models of different objects are different.
[0089] In one implementation, the display module 530 can be used to employ a rasterization algorithm to replace the pixel color at the specified position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflection image corresponding to the object at the specified position.
[0090] In at least one embodiment, the device 500 may further include a storage module, configured to: acquire a storage space corresponding to the specified area before replacing the pixel color at the specified location with the pixel color corresponding to the location hit by the reflected ray to draw a reflection image corresponding to the object at the specified location; acquire a reflection position parameter corresponding to the location where the object is hit by the reflected ray; and store the reflection position parameter in the storage space.
[0091] In this embodiment of the application, the display module 530 can also be used to draw object images in the scene space using a rasterization algorithm to display a three-dimensional scene space.
[0092] In this embodiment of the application, the number of designated locations may include multiple locations. In this way, the object acquisition module 510 can be used to acquire the objects hit by the reflected light corresponding to each of the multiple designated locations using a ray tracing algorithm; the display module 530 can be used to replace the pixel colors of the multiple designated locations with the pixel colors corresponding to the locations where the objects hit by the reflected light are located, so as to draw the reflection images corresponding to the objects hit by the reflected light at the multiple designated locations.
[0093] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0094] In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or other forms.
[0095] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0096] Please see Figure 8 Based on the image display method and apparatus described above, this application also provides an electronic device 100 capable of executing the aforementioned image display method. The electronic device 100 includes a memory 102 and one or more (only one shown in the figure) processors 104 coupled to each other, with a communication line connecting the memory 102 and the processors 104. The memory 102 stores a program capable of executing the contents of the aforementioned embodiments, and the processors 104 can execute the program stored in the memory 102.
[0097] The processor 104 may include one or more processing cores. The processor 104 connects to various parts within the electronic device 100 using various interfaces and lines, and performs various functions and processes data by running or executing instructions, programs, code sets, or instruction sets stored in the memory 102, and by calling data stored in the memory 102. Optionally, the processor 104 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 104 may integrate one or a combination of several of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the modem may also not be integrated into the processor 104 and may be implemented separately using a communication chip.
[0098] The memory 102 may include random access memory (RAM) or read-only memory (ROM). The memory 102 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 102 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the aforementioned embodiments. The data storage area may also store data created by the electronic device 100 during use (such as phonebook data, audio and video data, chat log data, etc.).
[0099] Please refer to Figure 9 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable storage medium 600 stores program code that can be called by a processor to execute the methods described in the above method embodiments.
[0100] The computer-readable storage medium 600 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 600 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 600 has storage space for program code 610 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 610 may be compressed, for example, in a suitable form.
[0101] In summary, the image display method, apparatus, electronic device, and storage medium provided in this application employ a ray tracing algorithm to obtain the object hit by reflected light at a specified location, where the specified location represents the position in a specified area of the scene space where the light hits; determine the position where the object is hit by the reflected light; and replace the pixel color at the specified location with the pixel color corresponding to the position hit by the reflected light, thereby drawing a reflection image corresponding to the object at the specified location. Thus, this method enables the drawing of a reflection image corresponding to an object in the game at a specified location within a specified area of the scene space. Compared to a reflection image that is not actually drawn, the ray tracing effect of the drawn reflection image is more vivid and realistic, improving the user experience to a certain extent.
[0102] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An image display method, It is characterized in that Applied to electronic equipment, the method comprises: Using a ray tracing algorithm to obtain an object hit by a reflected light ray corresponding to a specified position, wherein the specified position represents a position where a specified area of a scene space is hit by the light ray; determining a position of the object hit by the reflected light; The pixel color at the designated position is replaced with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to the object at the designated position.
2. The method according to claim 1, It is characterized in that Determining the position of the object hit by the reflected light comprises: The position of the object hit by the reflected light is determined according to the position data of the designated area in the scene space and the position data of the reflected light.
3. The method according to claim 2, It is characterized in that The number of the specified positions includes a plurality, and the method of using a ray tracing algorithm to obtain an object hit by a reflected ray corresponding to the specified position includes: Using a ray tracing algorithm to obtain objects hit by the reflected light rays corresponding to each of the plurality of designated positions; The step of replacing the pixel color at the designated position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to the object at the designated position, comprises: The pixel colors of the multiple specified positions are replaced with the pixel colors corresponding to the positions where the objects hit by the corresponding reflected light rays are hit, so as to draw reflection images corresponding to the objects hit by the corresponding reflected light rays at the multiple specified positions.
4. The method according to claim 1, It is characterized in that In the case that there are multiple objects, replacing the pixel color at the designated position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to the object at the designated position, includes: For each of the multiple objects, the same shader as the original model of the object is used to replace the pixel color of the specified position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to each of the multiple objects at the specified position, and the original models of different objects are different.
5. The method according to claim 1, It is characterized in that The step of replacing the pixel color at the designated position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to the object at the designated position, comprises: A rasterization algorithm is used to replace the pixel color of the designated position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to the object at the designated position.
6. The method according to claim 1, It is characterized in that Before replacing the pixel color of the designated position with the pixel color corresponding to the position hit by the reflected light to draw a reflected image corresponding to the object at the designated position, the method further includes: Acquire a storage space corresponding to the specified area; Obtaining a reflection position parameter corresponding to a position where the object is hit by the reflected light; The reflection position parameters are stored in the storage space.
7. The method according to any one of claims 1 to 6, It is characterized in that The method further comprises: A rasterization algorithm is used to draw the image of the object in the scene space.
8. An image display device, It is characterized in that Running on an electronic device, the device comprises: A hit object acquisition module, used for acquiring the object hit by the reflected light corresponding to the specified position by using a ray tracing algorithm, wherein the specified position represents the position where the specified area of the scene space is hit by the light; A position determination module, used to determine the position of the object hit by the reflected light; The display module is used to replace the pixel color of the designated position with the pixel color corresponding to the position hit by the reflected light, so as to draw a reflected image corresponding to the object at the designated position.
9. An electronic device, It is characterized in that including one or more processors and memory; One or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores program code, wherein when the program code is executed by a processor, the method according to any one of claims 1 to 7 is executed.
