Method and device for rendering interior construction effect, electronic equipment and storage medium

By generating virtual inner surfaces and sampling internal texture maps, the high cost and complex model adaptability issues of rendering internal structure effects in existing technologies are solved, achieving efficient and realistic rendering of internal structure effects.

CN116310041BActive Publication Date: 2026-07-21NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2023-03-13
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies for rendering internal structure effects are labor-intensive, costly, and unsuitable for large-scale game or animation scenes. Decal-based methods lack perspective differences, and cube mapping-based methods cannot adapt to complex models.

Method used

By generating a virtual inner surface that matches the shape of the inner structure model, determining virtual pixels and sampling the inner structure texture map, and combining the bounding box and preset mask map, the rendering of the inner structure model is achieved.

Benefits of technology

It reduces rendering overhead, improves rendering efficiency, and enables internal structure effects to change with the viewer's perspective, enhancing realism and fit.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116310041B_ABST
    Figure CN116310041B_ABST
Patent Text Reader

Abstract

The application provides a rendering method and device for an internal structure effect, an electronic device and a storage medium, wherein the method comprises the following steps: generating a virtual internal surface which is consistent in shape with an internal structure model surface and has a preset interval with the internal structure model surface; determining a virtual pixel point corresponding to an original pixel point of the internal structure model surface in the virtual internal surface according to a current view direction; determining a target pixel point to which the virtual pixel point is mapped on the internal structure model surface according to a normal direction of the virtual pixel point, sampling an internal structure texture map of the internal structure model according to the target pixel point, and obtaining a target internal structure texture map; and rendering the internal structure model surface according to the target internal structure texture map. According to the application, the internal model can be mapped, the rendering cost can be reduced, and the rendering efficiency can be improved. By generating the virtual internal surface, parallax offset is realized, the obtained internal structure effect can not only be attached to the model surface but also can change with the line of sight, and the authenticity of the internal structure effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to rendering methods and apparatuses, electronic devices, and storage media for interior effects. Background Technology

[0002] In computer graphics, especially in game and animation rendering, most rendering is based on the model's surface. However, we still encounter some special rendering needs, such as buildings with glass windows. In this type of rendering, the model's surface is covered with a semi-transparent material, through which the internal structure can be seen. For example, we can see the layout of the rooms inside the building through the glass windows; this rendering effect is collectively referred to as an interior effect.

[0003] Current technologies for rendering realistic internal structures typically rely on rendering based on internal models, essentially turning the rendering of internal structures into ordinary model rendering. This rendering method, which involves filling the interior of an existing model with an actual model, is labor-intensive, costly, and consumes significant rendering resources, making it particularly unsuitable for large-scale game or animation scenarios.

[0004] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0005] In view of the above problems, this application is made to provide a rendering method, apparatus, electronic device, and storage medium for interior structure effects that overcomes or at least partially solves the above problems, including:

[0006] A method for rendering interior effects, the method comprising:

[0007] A virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0008] The virtual pixels on the virtual inner surface that correspond to the original pixels on the surface of the inner structure model are determined based on the current viewing direction.

[0009] The target pixel point mapped from the virtual pixel point to the surface of the internal structure model is determined based on the normal direction of the virtual pixel point, and the internal structure texture map is sampled based on the target pixel point to obtain the target internal structure texture map; the internal structure texture map is the texture map corresponding to the internal structure model.

[0010] The surface of the internal structure model is rendered based on the target internal structure texture map.

[0011] Optionally, before generating the virtual inner surface based on the inner model surface used to display the inner model in the target model to be rendered, the method further includes:

[0012] Generate a bounding box corresponding to the surface of the internal model in the target model to be rendered, which is used to display the internal model.

[0013] Obtain the bounding box texture coordinate information and associate the bounding box texture coordinate information with the inner structure texture map.

[0014] Optionally, generating the bounding box corresponding to the surface of the internal model used to display the internal model in the target model to be rendered includes:

[0015] By constructing a cube and adjusting its position, size, and orientation, the projection of the cube onto the target model coincides with the surface of the inner model.

[0016] Based on the position, size, and orientation of the cube, a bounding box corresponding to the surface of the internal model is generated.

[0017] Optionally, the step of sampling the internal texture map based on the target pixel to obtain the target internal texture map includes:

[0018] Determine the pixel texture coordinates within the bounding box corresponding to the target pixel;

[0019] The target internal texture map is obtained by sampling the internal texture map based on the pixel texture coordinates.

[0020] Optionally, after sampling the internal texture map according to the pixel texture coordinates to obtain the target internal texture map, the method further includes:

[0021] Obtain a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model;

[0022] The target internal structure texture map is sampled based on the preset internal structure mask map to update the target internal structure texture map.

[0023] Optionally, rendering the surface of the internal structure model based on the target internal structure texture map includes:

[0024] Obtain the first lighting information of the target internal texture map;

[0025] The surface of the internal structure model is rendered based on the first lighting information and the target internal structure texture map.

[0026] Optionally, rendering the surface of the internal structure model based on the target internal structure texture map includes:

[0027] Obtain the first lighting information of the target internal texture map;

[0028] A first rendering result is generated based on the first lighting information and the target internal texture map;

[0029] Obtain the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model;

[0030] A second rendering effect is generated based on the second lighting information and the surface texture.

[0031] By fusing the first rendering result and the second rendering result, the rendering result of the internal structure model surface is obtained.

[0032] A rendering apparatus for interior effects, the apparatus comprising:

[0033] The virtual inner surface generation module is used to generate a virtual inner surface based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0034] The virtual pixel point determination module is used to determine the virtual pixel points in the virtual inner surface that correspond to the original pixel points on the surface of the inner structure model according to the current viewing direction;

[0035] The internal texture sampling module is used to determine the target pixel point that the virtual pixel point is mapped to on the surface of the internal model based on the normal direction of the virtual pixel point, and to sample the internal texture map based on the target pixel point to obtain the target internal texture map; the internal texture map is the texture map corresponding to the internal model.

[0036] The internal model rendering module is used to render the surface of the internal model according to the target internal texture map.

[0037] Optionally, the device further includes:

[0038] The bounding box generation module is used to generate bounding boxes that correspond to the surfaces of the internal models in the target model to be rendered, which are used to display the internal models.

[0039] The bounding box association module is used to obtain the bounding box texture coordinate information of the bounding box and associate the bounding box texture coordinate information with the inner structure texture map.

[0040] Optionally, the bounding box generation module includes:

[0041] The cube adjustment submodule is used to construct a cube and adjust the position, size, and orientation of the cube so that the projection of the cube onto the target model coincides with the surface of the inner model.

[0042] The parameter determination submodule is used to generate the bounding box corresponding to the surface of the internal model based on the position, size and orientation of the cube.

[0043] Optionally, the internal texture sampling module includes:

[0044] The pixel texture coordinate determination submodule is used to determine the pixel texture coordinates corresponding to the target pixel in the bounding box;

[0045] The pixel texture coordinate sampling submodule is used to sample the internal texture map according to the pixel texture coordinates to obtain the target internal texture map.

[0046] Optionally, the device further includes:

[0047] A preset internal structure mask texture acquisition module is used to acquire a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model;

[0048] The target internal structure texture map update module is used to sample the target internal structure texture map according to the preset internal structure mask map in order to update the target internal structure texture map.

[0049] Optionally, the internal model rendering module includes:

[0050] The first lighting information acquisition module is used to acquire the first lighting information of the target internal texture map;

[0051] The internal structure rendering module is used to render the surface of the internal structure model based on the first lighting information and the target internal structure texture map.

[0052] Optionally, the internal model rendering module includes:

[0053] The first lighting information acquisition module is used to acquire the first lighting information of the target internal texture map;

[0054] The first rendering submodule is used to generate a first rendering result based on the first lighting information and the target internal texture map;

[0055] The second lighting information acquisition module is used to acquire the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model.

[0056] The second rendering submodule is used to generate a second rendering effect based on the second lighting information and the surface texture.

[0057] The fusion submodule is used to fuse the first rendering result and the second rendering result to obtain the rendering result of the surface of the internal model.

[0058] An electronic device includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements a rendering method for the internal structure effects described above.

[0059] A computer-readable storage medium storing a computer program that, when executed by a processor, implements a rendering method for the internal structure effects described above.

[0060] This application has the following advantages:

[0061] In the embodiments of this application, a virtual inner surface is generated based on the inner surface of the target model used to display the inner structure model. The shape of the virtual inner surface is consistent with the shape of the inner surface, and there is a preset distance between the virtual inner surface and the inner surface. Virtual pixels corresponding to the original pixels on the inner surface are determined based on the current viewing direction. Target pixels mapped to the inner surface are determined based on the normal direction of the virtual pixels. The inner texture map of the inner model is sampled based on the target pixels to obtain a target inner texture map. The inner surface is then rendered based on the target inner texture map. This embodiment of the application reduces rendering overhead and improves rendering efficiency by mapping the inner model. By generating a virtual inner surface, this embodiment of the application achieves parallax offset, ensuring that the obtained inner structure effect not only fits the model surface but also changes with the viewing angle, thus improving the realism of the inner structure effect. Attached Figure Description

[0062] To more clearly illustrate the technical solution of this application, the drawings used in the description of this application will be briefly introduced below. Obviously, the 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.

[0063] Figure 1 A flowchart illustrating the process of rendering internal structure effects using existing technology;

[0064] Figure 2This is a flowchart illustrating the process of rendering internal structure effects using decals.

[0065] Figure 3 This is a schematic diagram illustrating the principle of rendering internal structure effects using internal mapping.

[0066] Figure 4 This is a flowchart illustrating the steps of a method for rendering interior effects according to an embodiment of this application.

[0067] Figure 5 This is a schematic diagram illustrating the principle of determining the target pixel in the embodiments of this application;

[0068] Figure 6 This is a schematic diagram illustrating the relationship between the cube and the coordinate axes when adjusting the cube in one example of this application;

[0069] Figure 7 This is a schematic diagram of the internal structure effect on the surface of an internal structure model in one example of this application;

[0070] Figure 8 In order to be in Figure 7 Based on the above, a schematic diagram of the rendering result fused with the second rendering result is presented;

[0071] Figure 9 This is a flowchart illustrating the rendering of the internal structure effect in one example of this application;

[0072] Figure 10 This is a structural block diagram of a rendering device for interior effects according to an embodiment of this application.

[0073] Figure 11 This is a structural block diagram of an electronic device according to an embodiment of this application. Detailed Implementation

[0074] To make the above-mentioned objectives, features, and advantages of this application more apparent and understandable, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0075] In game or animation scenes, there is a need to display internal models through transparent or semi-transparent materials. Current technologies generally render based on the internal model, turning the rendering of internal structure effects into ordinary model rendering. Specifically, this includes... Figure 1The process shown is as follows: design the internal structure area, trim the original model and the internal structure model according to the internal structure display area, merge the trimmed original model and internal structure model, and then render the model. This rendering based on the internal model, which fills the interior of an existing model with the actual model, is labor-intensive, costly, and consumes a lot of rendering resources, making it particularly unsuitable for large-scale game or animation scenes.

[0076] To address the shortcomings of existing technologies, the inventors conceived of rendering based on decals. This involves using a 2D texture image representing the internal structure, rendering it onto corresponding locations on the model's surface using a decal technique, thereby representing the internal structure effect. Specifically, this includes... Figure 2 The process shown is as follows: design the internal structure area, convert to decal parameters, render the original model and the internal decals, and merge the rendering effects. However, this decal-based rendering method, when viewed through the transparent surface material, only presents an image of the internal structure, like a sticker on glass, directly applied to the surface of the object model, lacking any sense of depth. There is no perspective difference between different areas at different corners of the model. Even when the camera is at an angle to the model, the internal view always faces forward. This lack of perspective significantly weakens the sense of atmosphere and three-dimensionality.

[0077] Furthermore, the inventors also conceived of rendering based on internal mapping, such as... Figure 3 As shown, the region containing the internal result can be imagined as a rectangular box. Then, simply mapping the internal intersections to a texture and outputting the correct color is sufficient. While this method, based on a fictional cubic region of internal structure, uses a cube mapping-like approach to represent the appearance of each face of the internal cube, it can convey the depth and perspective differences of the internal structure. However, its fundamental flaw is the use of cube mapping. This method limits the internal structure to a cubic region, and the object model's surface must be flat. For example, rendering windows and the rooms inside windows of buildings can achieve good results. For complex object models with various curved surfaces and uneven structures, this method cannot accurately fit the object's surface, still presenting the internal structure as a cube mapping. Furthermore, when the object's surface has perpendicular intersecting surfaces or other turning structures, it can cause inconsistencies in the surface appearance of the internal structures on two faces.

[0078] In view of this, the present application provides a method for rendering internal structure effects. By mapping the internal model, rendering overhead can be reduced and rendering efficiency can be improved. The present application generates a virtual internal surface to achieve parallax offset, so that the obtained internal structure effect can not only fit the model surface but also change with the viewpoint, thereby improving the realism of the internal structure effect.

[0079] Reference Figure 4This illustration shows a flowchart of the rendering method for interior effects according to an embodiment of this application. This rendering method can run on a local terminal device or a server. The local terminal device may include, but is not limited to, smartphones, desktop computers, tablets, laptops, in-vehicle central control systems, and other electronic devices. The server can be used to provide background services for the local terminal device. The server can be a standalone server, a distributed server, or a server cluster composed of multiple servers. When the information processing method runs on the server, it can be implemented and executed based on a cloud interaction system, which includes a server and client devices.

[0080] In an optional implementation, various cloud applications, such as cloud gaming, can run under the cloud interaction system. Taking cloud gaming as an example, cloud gaming refers to a gaming method based on cloud computing. In the cloud gaming operating mode, the game program and the game screen presentation are separated. The storage and execution of the rendering methods for the game's internal effects are completed on the cloud gaming server. The client device is used for receiving and sending data and for presenting the game screen. For example, the client device can be a display device with data transmission capabilities located close to the user, such as a first terminal device, television, computer, or PDA; however, the rendering methods for the internal effects are performed on the cloud gaming server. When playing the game, the player operates the client device to send operation commands to the cloud gaming server. The cloud gaming server runs the game according to the operation commands, encodes and compresses the game screen and other data, returns it to the client device via the network, and finally, the client device decodes and outputs the game screen.

[0081] In an optional implementation, taking a game as an example, the local terminal device stores a game program and uses it to display game visuals. The local terminal device is used to interact with the player through a graphical user interface (GUI), that is, to run the game program conventionally via an electronic device. This game program can be a downloadable and installable program, or it can be an instant-play program. The local terminal device can provide the GUI to the player in various ways, such as rendering it on the terminal's display screen, or providing it to the player through holographic projection. For example, the local terminal device can include a display screen and a processor. The display screen is used to display the GUI, which includes game visuals, and the processor is used to run the game, generate the GUI, and control the display of the GUI on the display screen.

[0082] In this embodiment of the application, the method may include the following steps:

[0083] Step 401: Generate a virtual inner surface based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0084] Step 402: Determine the virtual pixel points in the virtual inner surface that correspond to the original pixel points on the surface of the inner structure model based on the current viewing direction;

[0085] Step 403: Determine the target pixel point that the virtual pixel point is mapped to on the surface of the internal structure model based on the normal direction of the virtual pixel point, and sample the internal structure texture map based on the target pixel point to obtain the target internal structure texture map; the internal structure texture map is the texture map corresponding to the internal structure model.

[0086] Step 404: Render the surface of the internal structure model according to the target internal structure texture map.

[0087] This embodiment generates a virtual inner surface based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface. Virtual pixels corresponding to the original pixels on the inner structure model surface are determined according to the current viewing direction. Target pixels mapped from the virtual pixels to the inner structure model surface are determined according to the normal direction of the virtual pixels. The inner structure texture map of the inner structure model is sampled based on the target pixels to obtain the target inner structure texture map. The inner structure model surface is rendered based on the target inner structure texture map. This embodiment reduces rendering overhead and improves rendering efficiency by mapping the inner model. By generating a virtual inner surface, this embodiment achieves parallax offset, ensuring that the obtained inner structure effect not only fits the model surface but also changes with the viewing angle, improving the realism of the inner structure effect.

[0088] The rendering method for interior effects in this exemplary embodiment will be further explained below.

[0089] In step 401, a virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0090] The internal model surface can be considered as the part of the target model that is made of transparent or semi-transparent material. The internal model surface is used to display the internal model inside the target model.

[0091] A virtual inner surface is generated that has the same shape as the surface of the inner structure model and has a preset distance between it and the surface of the inner structure model. When the surface of the inner structure model is not a flat plane, that is, when the surface of the inner structure model has unevenness or arc shape, the virtual inner surface with the same shape as the surface of the inner structure model can achieve an inner structure effect that fits the surface of the inner structure model and has a depth effect. The specific implementation process is described in the following text.

[0092] In step 402, virtual pixels corresponding to the original pixels on the surface of the inner structure model are determined based on the current viewing direction.

[0093] In game engines, virtual models exist in three-dimensional space, while the screen and windows are two-dimensional arrays of pixels. This means that much of the work in a game engine involves transforming three-dimensional coordinates into two-dimensional pixels adapted to the screen. This transformation is managed by the game engine's graphics pipeline, which essentially refers to a stream of raw graphics data that undergoes various transformations and processing before finally appearing on the screen. The graphics pipeline can be divided into two main parts: the first part converts the three-dimensional coordinates of the virtual model into two-dimensional coordinates, and the second part converts these two-dimensional coordinates into actual colored pixels.

[0094] It is understandable that the rendering process of a model involves converting the model's three-dimensional coordinates into two-dimensional pixels that fit the screen, and adding corresponding colors to the pixels.

[0095] The current viewing direction refers to the orientation of the virtual camera. By observing the target model from the perspective of the virtual camera, we can obtain the pixels on the surface of the inner structure model on the screen, which are the original pixels. The lines connecting the virtual camera and each pixel on the surface of the inner structure model are extended to intersect with the virtual inner surface. The intersection points corresponding to each pixel are determined as the virtual pixels corresponding to each pixel.

[0096] In step 403, the target pixel point that the virtual pixel point is mapped to on the surface of the internal structure model is determined according to the normal direction of the virtual pixel point, and the internal structure texture map is sampled according to the target pixel point to obtain the target internal structure texture map; the internal structure texture map is the texture map corresponding to the internal structure model.

[0097] The virtual inner surface has the same shape as the inner model surface. Therefore, the normal of each virtual pixel on the virtual inner surface can be determined. For each virtual pixel, the normal of the virtual pixel is extended along the normal direction and intersects with the inner model surface. The intersection point is the target pixel corresponding to the virtual pixel.

[0098] like Figure 5As shown, when the shader renders the internal structure effect at point P0 on the surface of the internal structure model, the virtual pixel P2 on the virtual inner surface of P0 can be determined using a ray (i.e., the view direction). The internal structure effect of this virtual pixel P2 is then used as the internal structure effect at point P0. When the viewing angle changes, i.e., the view direction changes, a recessed internal structure effect can be obtained, perfectly fitting the surface of the internal structure model. Since it is not convenient to sample the internal structure texture map at P2, the position of the target pixel P3 corresponding to P2 can be calculated using a derived formula, and the internal structure texture map can be sampled using P3. The corresponding calculation formula is as follows:

[0099]

[0100]

[0101] P2 = P0 - L * viewDir;

[0102] P3=P2+depth*normal=P0-L*viewDir+depth*normal;

[0103] Where depth represents the preset distance between the virtual inner surface and the surface of the internal model, viewDir represents the view direction, and normal represents the normal direction.

[0104] Considering that in some scenarios, such as ship and space architecture models with complex display requirements, the surface of the internal model is generally not a plane, but a complex curved surface or an uneven surface, the texture coordinates (UV) of the internal model surface are not continuous, and the internal texture map of the internal model... Figure 1 Generally, this corresponds to continuous UVs. Therefore, it's difficult to directly use the UVs of the internal model's surface to sample the internal texture map of the internal model. UVs are the basis for mapping textures onto the model's surface, defining the position information of each point in the image. These points are interconnected with the model in the 3D scene, used to locate the position of the texture map surface, that is, to precisely map each pixel in the image to the model's surface.

[0105] Therefore, in an optional embodiment of this application, a bounding box corresponding to the surface of the internal model can be generated, and the surface of the internal model can be represented by the continuous UVs of the bounding box, thereby converting the discontinuous UVs of the internal model surface into continuous UVs for the view. That is, before generating the virtual inner surface based on the internal model surface used to display the internal model in the target model to be rendered, the method further includes:

[0106] Generate the bounding box corresponding to the surface of the internal model in the target model to be rendered, which is used to display the internal model.

[0107] Obtain the bounding box texture coordinate information and associate the bounding box texture coordinate information with the inner structure texture map.

[0108] In this embodiment, by generating a bounding box corresponding to the surface of the internal model used to display the internal model in the target model to be rendered, the discontinuous UVs of the internal model surface are converted into continuous UVs of the bounding box. This bounding box generally refers to the smallest bounding box of the internal model surface, that is, the bounding box covers the internal model surface. It can be understood that by capturing this bounding box with a virtual camera, the position and size of the bounding box projected onto the target model are completely or substantially the same as the internal model surface of the target model. For ease of computation, this bounding box can specifically be an AABB bounding box, that is, a rectangular bounding box. Rectangular bounding boxes have very low computational cost; that is, using a rectangular bounding box to replace the internal model surface can reduce computational cost and improve computational efficiency.

[0109] After generating the bounding box, since the bounding box can also be considered a model in model space, its texture coordinate information can be obtained. For ease of distinction, this texture coordinate information is denoted as "bounding box texture coordinate information," and then associated with the inner structure texture map. This means that any pixel in the inner structure texture map can have a corresponding UV on the bounding box, and conversely, based on the bounding box's texture coordinate information, the corresponding pixel can be found in the inner structure texture map. Using the inner structure texture map to render the bounding box allows the inner structure model to be displayed at the location of the bounding box.

[0110] In the process of generating the bounding box corresponding to the surface of the internal model used to display the internal model in the target model to be rendered, it is necessary to determine the size, position and projection direction of the bounding box.

[0111] For example, the standard coordinate axes of the target model can be rotated according to the projection direction, that is, the coordinate axes of the model space in which the target model is located can be rotated so that one of the coordinate axes is parallel to the projection direction. Generally, the projection direction is made perpendicular to the plane containing a vertex of the inner model surface. Then, the direction vectors between the vertices of the target model and the center of the projection cube are calculated. The projection cube can be understood as a virtual camera. After obtaining the direction vectors between each vertex and the center of the projection cube, the direction vectors are projected onto the coordinate axes of the rotated projection. Then, the projection is truncated to obtain the bounding box corresponding to the inner model surface. The corresponding code is as follows:

[0112] float3 display_box_x_local=float3(1.0,0.0,0.0);

[0113] float3 display_box_y_local=float3(0.0,1.0,0.0);

[0114] float3 display_box_z_local=float3(0.0,0.0,1.0);

[0115] display_box_x_local=mul(eular_rotation_mat,display_box_x_local);

[0116] display_box_y_local=mul(eular_rotation_mat,display_box_y_local);

[0117] display_box_z_local=mul(eular_rotation_mat,display_box_z_local);

[0118] float3 model_pos_from_box_center=position_local-box_center.xyz;

[0119] float x_dot=dot(display_box_x_local,model_pos_from_box_center);

[0120] float y_dot=dot(display_box_y_local,model_pos_from_box_center);

[0121] float z_dot=dot(display_box_z_local,model_pos_from_box_center);

[0122] float region_mask_x=step(abs(x_dot),box_size.x*0.5f);

[0123] float region_mask_y=step(abs(y_dot),box_size.y*0.5f);

[0124] float region_mask_z=step(abs(z_dot),box_size.z*0.5f);

[0125] float region_mask=region_mask_x*region_mask_y*region_mask_z.

[0126] However, in practice, it is difficult and inefficient for relevant personnel to set the size, position, and projection direction of the bounding box based on intuition and experience. Therefore, an optional embodiment of this application provides a method for generating a bounding box, namely, generating the bounding box corresponding to the surface of the internal model used to display the internal model in the target model to be rendered, which may include:

[0127] By constructing a cube and adjusting its position, size, and orientation, the projection of the cube onto the target model coincides with the surface of the inner model.

[0128] Based on the position, size, and orientation of the cube, a bounding box corresponding to the surface of the internal model is generated.

[0129] In this embodiment, a cube is constructed in the model space, and the position, size and orientation of the cube are adjusted so that the projection of the cube on the target model coincides with the surface of the inner model. Then, the parameters of the cube are converted into the parameters of the inner model surface in the shader. In this way, the bounding box can be easily adjusted intuitively in the editor through the graphically assisted cube.

[0130] It should be noted that since the parameters of the bounding box are defined in model space, while the transform parameters seen in the properties panel when editing the cube in the editor are in world space, it is necessary to transform the cube's transform parameters to the model space of the target model.

[0131] To improve ease of production, when editing parameters, the position and orientation of the target model's transform in the scene can be set to 0, and the scaling to 1. In this way, the model space of the target model overlaps with the world space of the scene, and the transform parameters obtained by adjusting the cube are the final parameters required without the need for conversion.

[0132] In order to directly use the cube's transform parameter in the shader, some special handling is required. When performing Euler rotation, the three default coordinate axes need to be consistent with the standard coordinate axes in model space. The corresponding code is as follows:

[0133] float3 display_box_x_local=float3(1.0,0.0,0.0);

[0134] float3 display_box_y_local=float3(0.0,1.0,0.0);

[0135] float3 display_box_z_local=float3(0.0,0.0,1.0);

[0136] At this point, the bounding box obtained by the shader after applying the cube transform parameter through Euler transformation is consistent with the cube seen in the editor.

[0137] like Figure 6 As shown, in the projection cube, the projection direction can be represented by the x-axis. When generating the bounding box UV, the plane perpendicular to the projection direction, namely the YZ plane, is used as the reference. The Z-axis represents the horizontal direction, namely the U direction, and the Y-axis represents the vertical direction, namely the V direction.

[0138] After obtaining the bounding box corresponding to the surface of the internal structure model, the above-mentioned sampling of the internal structure texture map based on the target pixel points to obtain the target internal structure texture map includes:

[0139] Determine the pixel texture coordinates within the bounding box corresponding to the target pixel;

[0140] The target internal texture map is obtained by sampling the internal texture map based on the pixel texture coordinates.

[0141] Since the target pixel is a pixel on the surface of the internal model, the texture coordinates corresponding to the target pixel can be represented by the pixel texture coordinates of the pixel corresponding to the target pixel in the bounding box. The pixel texture coordinates corresponding to the target pixel in the bounding box are the pixel texture coordinates of the surface of the bounding box projected onto the target pixel.

[0142] Since the bounding box texture coordinates are associated with the inner structure texture map, the corresponding texture can be found from the inner structure texture map based on the bounding box's pixel texture coordinates. Within the virtual camera's field of view, multiple raw pixels can be obtained. Each raw pixel can determine a corresponding virtual pixel, thus resulting in multiple virtual pixels. Each virtual pixel can then determine a corresponding target pixel, leading to multiple target pixels. Furthermore, the pixel texture coordinates corresponding to each target pixel can be determined, resulting in multiple pixel texture coordinates. By sampling the inner structure texture map based on these multiple pixel texture coordinates, the target inner structure texture map can be obtained.

[0143] Furthermore, considering that in the process of using a bounding box to make the UV continuous of the inner model surface, in order to facilitate calculation and reduce performance consumption, an AABB bounding box is generally used. However, in reality, the edge of the inner model surface is not completely consistent with the edge of the bounding box. In order to refine the processing of details, in some optional embodiments of this application, the above method may further include:

[0144] Obtain a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model;

[0145] The target internal structure texture map is sampled based on the preset internal structure mask map to update the target internal structure texture map.

[0146] The preset internal structure masking map is a black and white map, also known as a 0-1 masking map. When a pixel in the preset internal structure masking map is white (i.e., a pixel value of 1), it indicates that the location corresponding to that pixel in the target model belongs to the internal structure model surface. When a pixel in the preset internal structure masking map is black (i.e., a pixel value of 0), it indicates that the location corresponding to that pixel in the target model belongs to a non-internal structure model surface, meaning it is not part of the internal structure model surface and is opaque. The preset internal structure masking map can be generated based on the transparency of various parts of the target model, or it can be preset by relevant personnel according to actual needs.

[0147] This embodiment samples the target internal structure texture map by using a preset internal structure mask map to update the target internal structure texture map. This not only improves the detail of the subsequent rendering effect, but also allows for easy adjustment of the edge of the internal structure model display area by modifying the preset internal structure mask map when the preset internal structure mask map is pre-set by relevant personnel according to actual needs, without the need to modify the model, which can greatly save production costs.

[0148] In step 404, the surface of the internal structure model is rendered according to the target internal structure texture map.

[0149] After obtaining the target internal structure texture map, the surface of the internal structure model is rendered using the target internal structure texture map. This results in the effect of the internal structure model being presented in the internal structure model, i.e., the internal structure effect.

[0150] Furthermore, to make the internal structure effect more realistic, in some optional embodiments of this application, the above-mentioned rendering of the internal structure model surface according to the target internal structure texture map may further include:

[0151] Obtain the first lighting information of the target internal texture map;

[0152] The surface of the internal structure model is rendered based on the first lighting information and the target internal structure texture map.

[0153] In this embodiment, during the rendering of the internal structure model surface, it is also necessary to combine the first lighting information of the target internal structure texture map, that is, to combine the first lighting information of the internal structure model. The internal structure model surface is rendered based on the first lighting information and the target internal structure texture map, which can achieve a more realistic internal structure effect. Figure 7 The image shown is a schematic diagram of the internal structure effect on the surface of an internal structure model in an example of this application.

[0154] Furthermore, considering that some internal structure model surfaces may not be completely transparent, such as colored glass, these internal structure model surfaces also have corresponding texture maps. For ease of distinction, the texture maps corresponding to the internal structure model surfaces are denoted as surface maps. To make the internal structure effect more realistic, in some optional embodiments of this application, the above-mentioned rendering of the internal structure model surface based on the target internal structure texture map may further include:

[0155] Obtain the first lighting information of the target internal texture map;

[0156] A first rendering result is generated based on the first lighting information and the target internal texture map;

[0157] Obtain the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model;

[0158] A second rendering effect is generated based on the second lighting information and the surface texture.

[0159] By fusing the first rendering result and the second rendering result, the rendering result of the internal structure model surface is obtained.

[0160] In this embodiment, during the rendering of the internal structure model surface, it is necessary to consider not only the texture of the corresponding internal structure model but also the texture of the internal structure model itself. The first rendering result is generated based on the first lighting information and the target internal structure texture map; this first rendering result can be considered the rendering result of the region corresponding to the internal structure model surface within the internal structure model. The second rendering result is generated based on the second lighting information and the surface texture map; this second rendering result can be considered the rendering result of the internal structure model surface. By blending the first and second rendering results, the final rendering result of the internal structure model surface can be obtained.

[0161] The rendering result of the internal model surface is obtained by fusing the first rendering result and the second rendering result. For example... Figure 8 The image shown is in Figure 7 Based on the above, a schematic diagram of the rendering result fused with the second rendering result.

[0162] To facilitate understanding of this solution by those skilled in the art, the following will be combined with... Figure 9 The flowchart shown illustrates the rendering method for internal structure effects provided in the embodiments of this application.

[0163] Step 901: Divide the target model into internal model surfaces and other model surfaces. Other model surfaces refer to surfaces where the internal model cannot be displayed. Perform step 902 for internal model surfaces and step 906 for other model surfaces.

[0164] Step 902: Generate a virtual inner surface with the same shape as the inner surface of the inner model, based on the inner model surface. The virtual inner surface and the inner model surface have a preset distance.

[0165] Step 903: Based on the virtual inner surface, calculate the mapping of the original pixel position P0 of the inner model surface to the virtual pixel position P2 of the virtual inner surface.

[0166] Step 904: Map the virtual pixel position P2 of the virtual inner surface back to the target pixel position P3 of the inner model surface according to the normal direction.

[0167] Step 905: Determine the UV of the target pixel position P3 using a decal algorithm. In an optional embodiment of this application, the decal algorithm is implemented by generating a bounding box corresponding to the surface of the internal model. Determining the UV of the target pixel position P3 means determining the UV of the pixel corresponding to the target pixel position P3 within the bounding box.

[0168] Step 906: Using the determined UVs, sample the internal texture map of the internal model and perform lighting calculations to obtain the first rendering result.

[0169] Step 907: Perform conventional lighting rendering on the surfaces of other models to obtain the third rendering result.

[0170] Step 908: The first rendering result and the third rendering result are merged to obtain the final rendering result of the target model. It can be understood that the final rendering result of the target model is the overall rendering result of the target model, including the rendering results of the internal model surfaces as well as the rendering results of other model surfaces. The process of merging the first rendering result and the third rendering result can be considered as splicing the pixels corresponding to the first rendering result with the pixels corresponding to the third rendering result to obtain the overall rendering result of the target model.

[0171] This embodiment generates a virtual inner surface based on the inner surface of the target model to be rendered, which is used to display the inner structure model. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface. Virtual pixels corresponding to the original pixels on the inner surface are determined according to the current viewing direction. Target pixels mapped to the inner structure model surface are determined according to the normal direction of the virtual pixels. The inner structure texture map of the inner structure model is sampled based on the target pixels to obtain the target inner structure texture map. The inner structure model surface is rendered based on the target inner structure texture map. This embodiment reduces rendering overhead and improves rendering efficiency by mapping the inner model. By generating a virtual inner surface, this embodiment achieves parallax offset, so that the obtained inner structure effect not only fits the model surface but also changes with the viewing angle, improving the realism of the inner structure effect.

[0172] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of this application are not limited to the described order of actions, because according to the embodiments of this application, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also understand that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of this application.

[0173] Reference Figure 10 This diagram illustrates a structural block diagram of an embodiment of an interior effect rendering apparatus according to this application. Corresponding to an embodiment of an interior effect rendering method, in this embodiment, the interior effect rendering apparatus may include the following modules:

[0174] The virtual inner surface generation module 1001 is used to generate a virtual inner surface based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0175] The virtual pixel point determination module 1002 is used to determine the virtual pixel points in the virtual inner surface that correspond to the original pixel points on the surface of the inner structure model according to the current viewing direction.

[0176] The internal texture sampling module 1003 is used to determine the target pixel point that the virtual pixel point is mapped to on the surface of the internal model according to the normal direction of the virtual pixel point, and to sample the internal texture map according to the target pixel point to obtain the target internal texture map; the internal texture map is the texture map corresponding to the internal model.

[0177] The internal model rendering module 1004 is used to render the surface of the internal model according to the target internal texture map.

[0178] In some optional embodiments of this application, the apparatus may further include:

[0179] The bounding box generation module is used to generate bounding boxes that correspond to the surfaces of the internal models in the target model to be rendered, which are used to display the internal models.

[0180] The bounding box association module is used to obtain the bounding box texture coordinate information of the bounding box and associate the bounding box texture coordinate information with the inner structure texture map.

[0181] In some optional embodiments of this application, the bounding box generation module may include:

[0182] The cube adjustment submodule is used to construct a cube and adjust the position, size, and orientation of the cube so that the projection of the cube onto the target model coincides with the surface of the inner model.

[0183] The parameter determination submodule is used to generate the bounding box corresponding to the surface of the internal model based on the position, size and orientation of the cube.

[0184] In some optional embodiments of this application, the internal texture sampling module 1003 may include:

[0185] The pixel texture coordinate determination submodule is used to determine the pixel texture coordinates corresponding to the target pixel in the bounding box;

[0186] The pixel texture coordinate sampling submodule is used to sample the internal texture map according to the pixel texture coordinates to obtain the target internal texture map.

[0187] In some optional embodiments of this application, the apparatus may further include:

[0188] A preset internal structure mask texture acquisition module is used to acquire a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model;

[0189] The target internal structure texture map update module is used to sample the target internal structure texture map according to the preset internal structure mask map in order to update the target internal structure texture map.

[0190] In some optional embodiments of this application, the internal model rendering module 1004 may include:

[0191] The first lighting information acquisition module is used to acquire the first lighting information of the target internal texture map;

[0192] The internal structure rendering module is used to render the surface of the internal structure model based on the first lighting information and the target internal structure texture map.

[0193] In some optional embodiments of this application, the internal model rendering module 1004 may include:

[0194] The first lighting information acquisition module is used to acquire the first lighting information of the target internal texture map;

[0195] The first rendering submodule is used to generate a first rendering result based on the first lighting information and the target internal texture map;

[0196] The second lighting information acquisition module is used to acquire the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model.

[0197] The second rendering submodule is used to generate a second rendering effect based on the second lighting information and the surface texture.

[0198] The fusion submodule is used to fuse the first rendering result and the second rendering result to obtain the rendering result of the surface of the internal model.

[0199] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0200] See Figure 11 This application also discloses an electronic device 11, including a processor 1101, a memory 1102, and a computer program 1103 stored in the memory 1102 and capable of running on the processor 1101. When the computer program 1103 is executed by the processor 1101, it implements the steps of the rendering method for the interior effect as described above, for example:

[0201] A virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0202] The virtual pixels on the virtual inner surface that correspond to the original pixels on the surface of the inner structure model are determined based on the current viewing direction.

[0203] The target pixel point mapped from the virtual pixel point to the surface of the internal structure model is determined based on the normal direction of the virtual pixel point, and the internal structure texture map is sampled based on the target pixel point to obtain the target internal structure texture map; the internal structure texture map is the texture map corresponding to the internal structure model.

[0204] The surface of the internal structure model is rendered based on the target internal structure texture map.

[0205] In some optional embodiments of this application, before generating a virtual inner surface based on the inner model surface used to display the inner structure model in the target model to be rendered, the method further includes:

[0206] Generate a bounding box corresponding to the surface of the internal model in the target model to be rendered, which is used to display the internal model.

[0207] Obtain the bounding box texture coordinate information and associate the bounding box texture coordinate information with the inner structure texture map.

[0208] In some optional embodiments of this application, generating a bounding box corresponding to the surface of the internal model used to display the internal model in the target model to be rendered includes:

[0209] By constructing a cube and adjusting its position, size, and orientation, the projection of the cube onto the target model coincides with the surface of the inner model.

[0210] Based on the position, size, and orientation of the cube, a bounding box corresponding to the surface of the internal model is generated.

[0211] In some optional embodiments of this application, the step of sampling the internal texture map based on the target pixel points to obtain the target internal texture map includes:

[0212] Determine the pixel texture coordinates within the bounding box corresponding to the target pixel;

[0213] The target internal texture map is obtained by sampling the internal texture map based on the pixel texture coordinates.

[0214] In some optional embodiments of this application, after sampling the intrinsic texture map according to the pixel texture coordinates to obtain the target intrinsic texture map, the method further includes:

[0215] Obtain a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model;

[0216] The target internal structure texture map is sampled based on the preset internal structure mask map to update the target internal structure texture map.

[0217] In some optional embodiments of this application, rendering the surface of the internal structure model according to the target internal structure texture map includes:

[0218] Obtain the first lighting information of the target internal texture map;

[0219] The surface of the internal structure model is rendered based on the first lighting information and the target internal structure texture map.

[0220] In some optional embodiments of this application, rendering the surface of the internal structure model according to the target internal structure texture map includes:

[0221] Obtain the first lighting information of the target internal texture map;

[0222] A first rendering result is generated based on the first lighting information and the target internal texture map;

[0223] Obtain the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model;

[0224] A second rendering effect is generated based on the second lighting information and the surface texture.

[0225] By fusing the first rendering result and the second rendering result, the rendering result of the internal structure model surface is obtained.

[0226] A virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface. The virtual pixel point in the virtual inner surface corresponding to the original pixel point of the inner structure model surface is determined according to the current viewing direction. The target pixel point mapped to the inner structure model surface by the virtual pixel point is determined according to the normal direction of the virtual pixel point, and the inner structure texture map of the inner structure model is sampled according to the target pixel point to obtain the target inner structure texture map. The inner structure model surface is rendered according to the target inner structure texture map. This embodiment of the application can reduce rendering overhead and improve rendering efficiency by mapping the inner model. This embodiment of the application realizes parallax offset by generating a virtual inner surface, so that the obtained inner structure effect can not only fit the model surface but also change with the viewing angle, improving the realism of the inner structure effect.

[0227] This application also discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the rendering method for the interior effect described above, for example:

[0228] A virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface.

[0229] The virtual pixels on the virtual inner surface that correspond to the original pixels on the surface of the inner structure model are determined based on the current viewing direction.

[0230] The target pixel point mapped from the virtual pixel point to the surface of the internal structure model is determined based on the normal direction of the virtual pixel point, and the internal structure texture map is sampled based on the target pixel point to obtain the target internal structure texture map; the internal structure texture map is the texture map corresponding to the internal structure model.

[0231] The surface of the internal structure model is rendered based on the target internal structure texture map.

[0232] In some optional embodiments of this application, before generating a virtual inner surface based on the inner model surface used to display the inner structure model in the target model to be rendered, the method further includes:

[0233] Generate a bounding box corresponding to the surface of the internal model in the target model to be rendered, which is used to display the internal model.

[0234] Obtain the bounding box texture coordinate information and associate the bounding box texture coordinate information with the inner structure texture map.

[0235] In some optional embodiments of this application, generating a bounding box corresponding to the surface of the internal model used to display the internal model in the target model to be rendered includes:

[0236] By constructing a cube and adjusting its position, size, and orientation, the projection of the cube onto the target model coincides with the surface of the inner model.

[0237] Based on the position, size, and orientation of the cube, a bounding box corresponding to the surface of the internal model is generated.

[0238] In some optional embodiments of this application, the step of sampling the internal texture map based on the target pixel points to obtain the target internal texture map includes:

[0239] Determine the pixel texture coordinates within the bounding box corresponding to the target pixel;

[0240] The target internal texture map is obtained by sampling the internal texture map based on the pixel texture coordinates.

[0241] In some optional embodiments of this application, after sampling the intrinsic texture map according to the pixel texture coordinates to obtain the target intrinsic texture map, the method further includes:

[0242] Obtain a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model;

[0243] The target internal structure texture map is sampled based on the preset internal structure mask map to update the target internal structure texture map.

[0244] In some optional embodiments of this application, rendering the surface of the internal structure model according to the target internal structure texture map includes:

[0245] Obtain the first lighting information of the target internal texture map;

[0246] The surface of the internal structure model is rendered based on the first lighting information and the target internal structure texture map.

[0247] In some optional embodiments of this application, rendering the surface of the internal structure model according to the target internal structure texture map includes:

[0248] Obtain the first lighting information of the target internal texture map;

[0249] A first rendering result is generated based on the first lighting information and the target internal texture map;

[0250] Obtain the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model;

[0251] A second rendering effect is generated based on the second lighting information and the surface texture.

[0252] By fusing the first rendering result and the second rendering result, the rendering result of the internal structure model surface is obtained.

[0253] A virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface. The virtual pixel point in the virtual inner surface corresponding to the original pixel point of the inner structure model surface is determined according to the current viewing direction. The target pixel point mapped to the inner structure model surface by the virtual pixel point is determined according to the normal direction of the virtual pixel point, and the inner structure texture map of the inner structure model is sampled according to the target pixel point to obtain the target inner structure texture map. The inner structure model surface is rendered according to the target inner structure texture map. This embodiment of the application can reduce rendering overhead and improve rendering efficiency by mapping the inner model. This embodiment of the application realizes parallax offset by generating a virtual inner surface, so that the obtained inner structure effect can not only fit the model surface but also change with the viewing angle, improving the realism of the inner structure effect.

[0254] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0255] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, embodiments of this application can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of this application can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0256] This application describes embodiments with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of this application. It should be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0257] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0258] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0259] All information acquisition actions described in this application embodiment are carried out in compliance with the relevant data protection laws and policies of the country where the location is located, and with authorization from the owner of the corresponding device.

[0260] Although preferred embodiments of the present application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present application.

[0261] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0262] The rendering method, apparatus, electronic device, and storage medium for internal structure effects provided in this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

Claims

1. A method for rendering interior structure effects, characterized in that, The method includes: A virtual inner surface is generated based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface. The virtual pixels on the virtual inner surface that correspond to the original pixels on the surface of the inner structure model are determined based on the current viewing direction. The target pixel point mapped from the virtual pixel point to the surface of the internal structure model is determined based on the normal direction of the virtual pixel point, and the internal structure texture map is sampled based on the target pixel point to obtain the target internal structure texture map; the internal structure texture map is the texture map corresponding to the internal structure model. Render the surface of the internal structure model according to the target internal structure texture map; Wherein, the current viewing direction is the orientation of the virtual camera, and determining the virtual pixel points corresponding to the original pixel points on the surface of the inner structure model in the virtual inner surface based on the current viewing direction includes: The line connecting the virtual camera to each original pixel on the surface of the internal model is extended to intersect with the virtual internal surface, and the intersection point corresponding to each original pixel is determined as the virtual pixel corresponding to each original pixel.

2. The method according to claim 1, characterized in that, Before generating a virtual inner surface based on the inner model surface used to display the inner structure model in the target model to be rendered, the method further includes: Generate a bounding box corresponding to the surface of the internal model in the target model to be rendered, which is used to display the internal model. Obtain the bounding box texture coordinate information and associate the bounding box texture coordinate information with the inner structure texture map.

3. The method according to claim 2, characterized in that, The bounding box corresponding to the surface of the internal model used to display the internal model in the generated and rendered target model includes: By constructing a cube and adjusting its position, size, and orientation, the projection of the cube onto the target model coincides with the surface of the inner model. Based on the position, size, and orientation of the cube, a bounding box corresponding to the surface of the internal model is generated.

4. The method according to claim 3, characterized in that, The step of sampling the internal texture map based on the target pixel points to obtain the target internal texture map includes: Determine the pixel texture coordinates within the bounding box corresponding to the target pixel; The target internal texture map is obtained by sampling the internal texture map based on the pixel texture coordinates.

5. The method according to claim 4, characterized in that, After sampling the internal texture map according to the pixel texture coordinates to obtain the target internal texture map, the method further includes: Obtain a preset internal structure mask texture of the target model; the preset internal structure mask texture is a black and white texture, and the boundary of the white area in the preset internal structure mask texture corresponds to the boundary of the surface of the internal structure model; The target internal structure texture map is sampled based on the preset internal structure mask map to update the target internal structure texture map.

6. The method according to any one of claims 1-5, characterized in that, The step of rendering the surface of the internal structure model according to the target internal structure texture map includes: Obtain the first lighting information of the target internal texture map; The surface of the internal structure model is rendered based on the first lighting information and the target internal structure texture map.

7. The method according to any one of claims 1-5, characterized in that, The step of rendering the surface of the internal structure model according to the target internal structure texture map includes: Obtain the first lighting information of the target internal texture map; A first rendering result is generated based on the first lighting information and the target internal texture map; Obtain the second lighting information of the surface of the internal structure model and the surface texture of the surface of the internal structure model; A second rendering effect is generated based on the second lighting information and the surface texture. By fusing the first rendering result and the second rendering result, the rendering result of the internal structure model surface is obtained.

8. A rendering device for interior structure effects, characterized in that, The device includes: The virtual inner surface generation module is used to generate a virtual inner surface based on the inner structure model surface used to display the inner structure model in the target model to be rendered. The shape of the virtual inner surface is consistent with the shape of the inner structure model surface, and there is a preset distance between the virtual inner surface and the inner structure model surface. The virtual pixel point determination module is used to determine the virtual pixel points in the virtual inner surface that correspond to the original pixel points on the surface of the inner structure model according to the current viewing direction; The internal texture sampling module is used to determine the target pixel point that the virtual pixel point is mapped to on the surface of the internal model based on the normal direction of the virtual pixel point, and to sample the internal texture map based on the target pixel point to obtain the target internal texture map; the internal texture map is the texture map corresponding to the internal model. The internal structure model rendering module is used to render the surface of the internal structure model according to the target internal structure texture map; Wherein, the current viewing direction is the orientation of the virtual camera, and determining the virtual pixel points corresponding to the original pixel points on the surface of the inner structure model in the virtual inner surface based on the current viewing direction includes: The line connecting the virtual camera to each original pixel on the surface of the internal model is extended to intersect with the virtual internal surface, and the intersection point corresponding to each original pixel is determined as the virtual pixel corresponding to each original pixel.

9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the rendering method of the interior effect as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the rendering method for interior effects as described in any one of claims 1-7.