Indoor effect generation method and device and electronic equipment

By setting the patch model in the virtual space and determining the texture sampling parameters, and sampling the cube map, the problem of large equipment performance consumption and poor effect when rendering indoor scenes in the prior art is solved, and efficient and flexible indoor effect rendering is achieved.

CN120070704APending Publication Date: 2025-05-30NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411947915.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-05-30

AI Technical Summary

Technical Problem

The prior art uses large equipment performance when rendering indoor scenes and cannot flexibly adjust the indoor space proportion, resulting in low rendering efficiency and poor effect.

Method used

By setting the patch model in the virtual space, and determining the texture sampling parameters based on the relative position of the virtual camera and the patch model and the preset indoor space dimension parameters, sampling the cube map, determining the rendering parameters, and rendering the patch model to achieve the display of indoor effects.

Benefits of technology

It improves the flexibility and efficiency of rendering indoor effects, ensures the accuracy and consistency of indoor effects, avoids distortion, and reduces equipment performance consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120070704A_ABST
    Figure CN120070704A_ABST
Patent Text Reader

Abstract

The invention provides an indoor effect generation method and apparatus, and an electronic device. The method comprises the steps of setting a patch model in a virtual space; based on the relative position of the virtual camera and the patch model and a preset size parameter of the indoor space, determining a texture sampling parameter corresponding to the patch model; the display effect of the indoor space is stored through a preset cube map; sampling the cube chartlet based on the texture sampling parameters, and determining rendering parameters of the patch model; and rendering the surface patch model based on the rendering parameters to enable the surface patch model to display the display effect of the indoor space. In the mode, when the texture sampling parameters corresponding to the patch model are determined, the size parameters of the simulated indoor space are considered, the cube chartlet is sampled through the texture sampling parameters, and the indoor effect obtained by rendering the patch model is consistent with the effect of the indoor space, so that distortion is avoided; the flexibility of rendering the indoor effect is improved, and the rendering efficiency of the indoor effect is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of rendering technology, and in particular, to a method, an apparatus, and an electronic device for generating an indoor effect. Background Art

[0002] In a game, an object model is usually composed of triangular faces. When the number of triangular faces is too large, it will cause a great consumption of the device's performance. In some games, there are usually a large number of indoor scenes. If these scenes are represented in the form of a three-dimensional model, the device will not be able to bear the high computational consumption caused by a large number of triangular faces. In the related art, an indoor space can be represented by a two-dimensional texture map, but obvious flaws will occur when the player changes the viewing angle. The Interior Mapping technology can also restore a three-dimensional scene on a two-dimensional patch model by sampling six texture maps in different directions, however, this method can only implement a cube space and cannot flexibly adjust the proportion of the indoor space. Summary of the Invention

[0003] In view of this, an object of the present disclosure is to provide a method, an apparatus, and an electronic device for generating an indoor effect, so as to improve the flexibility of rendering the indoor effect and improve the rendering efficiency of the indoor effect.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for generating an indoor effect, the method including: setting a patch model in a virtual space; the virtual space includes a pre-set virtual camera; determining texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the size parameters of a pre-set indoor space; the display effect of the indoor space is saved by a pre-set cube texture map; sampling the cube texture map based on the texture sampling parameters to determine the rendering parameters of the patch model; rendering the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space.

[0005] In a second aspect, an embodiment of the present disclosure provides an apparatus for generating an indoor effect, the apparatus including: a patch model setting module for setting a patch model in a virtual space; the virtual space includes a pre-set virtual camera; a texture sampling parameter determining module for determining texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the size parameters of a pre-set indoor space; the display effect of the indoor space is saved by a pre-set cube texture map; a rendering module for sampling the cube texture map based on the texture sampling parameters to determine the rendering parameters of the patch model, and rendering the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space.

[0006] In a third aspect, an embodiment of the present invention provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-mentioned method for generating an indoor effect.

[0007] In a fourth aspect, an embodiment of the present invention provides a machine-readable storage medium. The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement the above-mentioned method for generating an indoor effect.

[0008] The embodiments of the present invention bring the following beneficial effects:

[0009] In the above-mentioned method, apparatus, and electronic device for generating an indoor effect, a patch model is set in a virtual space; based on the relative position between a virtual camera and the patch model and the preset size parameters of an indoor space, texture sampling parameters corresponding to the patch model are determined; the display effect of the indoor space is saved by a preset cube map; based on the texture sampling parameters, the cube map is sampled to determine the rendering parameters of the patch model; and based on the rendering parameters, the patch model is rendered so that the patch model displays the display effect of the indoor space. In this way, when determining the texture sampling parameters corresponding to the patch model, the size parameters of the simulated indoor space are considered. The indoor effect obtained by sampling the cube map through the texture sampling parameters and rendering the patch model is consistent with the effect of the indoor space, without distortion, improving the flexibility of rendering the indoor effect and the rendering efficiency of the indoor effect.

[0010] Other features and advantages of the present disclosure will be described in the following specification, and, in part, will be obvious from the specification, or will be understood by implementing the present disclosure. The objectives and other advantages of the present disclosure are achieved and obtained by the structures specifically pointed out in the specification, claims, and drawings.

[0011] To make the above objectives, features, and advantages of the present disclosure more obvious and understandable, the following specific preferred embodiments are given, and in conjunction with the accompanying drawings, the details are described as follows. Description of the Drawings

[0012] To more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the following will briefly introduce the drawings required for use in the description of the specific embodiments or the prior art. Obviously, the following drawings are some embodiments of the present disclosure. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0013] Figure 1 It is a flowchart of a method for generating an indoor effect provided by an embodiment of the present disclosure;

[0014] Figure 2 Schematic diagram of a bay window effect provided by an embodiment of the present disclosure;

[0015] Figure 3 Schematic diagram of the process of determining the intersection point of the ray emitted by the virtual camera provided by an embodiment of the present disclosure and the three-dimensional bounding box;

[0016] Figure 4 Schematic diagram of the structure of a device for generating an indoor effect provided by an embodiment of the present disclosure;

[0017] Figure 5 Schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners

[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions of the present disclosure will be clearly and completely described below with reference to the accompanying drawings. Apparently, the described embodiments are some but not all of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present disclosure without creative efforts shall fall within the protection scope of the present disclosure.

[0019] During the game rendering process, the object model is usually composed of triangular faces. When the number of triangular faces is too large, it will bring a great burden to the device. In some game scenes, the scene has a large amount of indoor space, and these indoor spaces will not interact with the player. At this time, if the traditional modeling process is used to represent these indoor scenes, the device will not be able to bear the high computing consumption caused by a large number of triangular faces.

[0020] In the related art, the indoor space can be represented by texture sampling and rendering the patch model on a two-dimensional texture map, but this method will have an obvious problem of revealing the true situation when the player changes the viewing angle. The Interior Mapping technology can also be used, by sampling the textures in six different directions in the 3D space, so as to simulate a three-dimensional indoor scene on a two-dimensional patch.

[0021] However, this method cannot be applied to indoor spaces other than cubes, nor can it achieve more variations, such as inclined windows, resulting in poor flexibility.

[0022] Based on this, an indoor effect generation method, device, and electronic device provided by the embodiments of the present disclosure can be applied to scenarios that require generating indoor effects.

[0023] See Figure 1 , first, an indoor effect generation method provided by an embodiment of the present invention will be introduced. The method includes the following steps:

[0024] Step S102, set a patch model in the virtual space; the virtual space includes a pre-set virtual camera.

[0025] The above-mentioned patch model is usually used to simulate a certain building, which usually has windows, or the wall has damage, and it is necessary to display the interior space of the building through the windows or the damage. The above-mentioned patch can also be only used to simulate the windows or damaged parts of the building, and can also simulate virtual objects such as "magic mirrors" that can display the indoor space of the building, which is not limited here.

[0026] The building simulated by the patch model is a three-dimensional model, and the patch model is a plane model. The position of the building in the virtual space is usually fixed, and a three-dimensional bounding box corresponding to the building can be set in advance at this position. In order to ensure that the display effect of the patch model does not show flaws when the virtual camera moves, the patch model can be set on each side of the three-dimensional bounding box, or according to requirements, the patch model can be set on a certain or several planes of the three-dimensional bounding box.

[0027] When the patch model is used to simulate a building, in addition to the area representing the windows, the patch model usually also includes the area representing the outer surface of the building. Usually, the method is required to render the area representing the windows in the patch model to generate the display effect of the interior space.

[0028] Step S104, determine the texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the preset size parameters of the indoor space; the display effect of the indoor space is saved by a preset cube map.

[0029] The above-mentioned preset indoor space usually refers to the indoor space of the building simulated by the patch model. The display effect of this indoor space is saved by a cube map. The three-dimensional bounding box of the indoor space can be a cube or a cuboid. The size parameters of the indoor space can be the length, width, and height of its three-dimensional bounding box. The three-dimensional bounding box of the indoor space corresponds to the cube space formed by the cube map. When the three-dimensional bounding box of the indoor space is a cuboid, by setting corresponding scaling parameters for the length, width, and height of the three-dimensional bounding box, the three-dimensional bounding box can be made to correspond to the cube space formed by the cube map.

[0030] Since the display effect of the indoor space is saved by a cube map, and when sampling the cube map, it is necessary to determine the incident point and sampling direction for sampling the cube space formed by the cube map, so the above-mentioned texture sampling parameters need to include the texture position information of the incident point for the cube space and the information of the sampling direction.

[0031] The area on the patch model for representing a window usually includes multiple positions to be rendered. For each position to be rendered, the texture sampling parameters corresponding to the position to be rendered can be determined. Since the patch model is set on a three-dimensional bounding box, and the three-dimensional bounding box corresponds to the cubic space formed by the cube map, the position parameters of the position to be rendered on the patch model on the surface of the cubic space, that is, the texture position information of the incident point, can be determined based on the above corresponding relationship. And the direction of the line connecting the virtual camera and the position to be rendered can usually be used as the sampling direction corresponding to the position to be rendered, so that the texture sampling parameters of each position to be rendered can be determined.

[0032] Step S106: Sample the cube map based on the texture sampling parameters, determine the rendering parameters of the patch model, and render the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space.

[0033] After determining the texture sampling parameters, the cube map can be sampled based on the texture sampling parameters. The texture sampling parameters include the texture position information of the incident point for the cubic space and the information of the sampling direction. When sampling, a ray needs to be generated based on the position of the incident point and the sampling direction, and then the intersection point of the ray and the cube map is determined. The texture parameters corresponding to the intersection point are the texture parameters of the position to be rendered. Then the rendering parameters of the position to be rendered can be determined based on the texture parameters, and further the rendering parameters of the patch model can be determined. Finally, rendering the patch model based on the rendering parameters can make the patch model display the display effect of the indoor space.

[0034] The above method for generating an indoor effect sets a patch model in a virtual space; determines the texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the preset size parameters of the indoor space; the display effect of the indoor space is saved through a preset cube map; samples the cube map based on the texture sampling parameters to determine the rendering parameters of the patch model; renders the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space. In this method, when determining the texture sampling parameters corresponding to the patch model, the size parameters of the simulated indoor space are considered. The indoor effect obtained by sampling the cube map through the texture sampling parameters and rendering the patch model is consistent with the effect of the indoor space, without distortion, improving the flexibility of rendering the indoor effect and the rendering efficiency of the indoor effect.

[0035] The above cube map can be generated in the following way: First, build the required three-dimensional indoor space in DCC software and record the length-width-height ratio of the space; then place a virtual camera in the center of the space and render the rendering images of 6 directions (up, down, left, right) of the space, compress all 6 images into a square ratio, and finally synthesize the 6 images into a single cube map (Cubemap).

[0036] It should be noted that the 3D objects included in the Cubemap should be placed as close to the wall as possible to avoid distortion during subsequent sampling. The Cubemap needs to be compressed into 1x1x1 according to the proportion of the 3D space it represents and will be restored to the original space proportion during subsequent sampling.

[0037] The following embodiments provide a specific method for determining the texture sampling parameters corresponding to the patch model based on the relative position of the virtual camera and the patch model and the size parameters of the preset indoor space.

[0038] The above patch model usually includes multiple positions to be rendered. The texture sampling parameters to be determined usually include the sampling direction vector. For each position to be rendered of the patch model, it is usually necessary to determine the initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; then, based on the size parameters of the preset indoor space and the initial direction vector, the sampling direction vector corresponding to the position to be rendered is determined.

[0039] The above patch model has a corresponding three-dimensional bounding box, that is, the three-dimensional bounding box of the above indoor space. The patch model is located on the surface of the three-dimensional bounding box. The size of the three-dimensional bounding box is proportional to the size of the indoor space. The initial direction vector can be represented by the coordinate parameters in the object coordinate system corresponding to the three-dimensional bounding box. If the shape of the indoor space is non-cubic, the initial direction vector is represented by the coordinate parameters in the tangent space corresponding to the three-dimensional bounding box. This method utilizes the characteristics of the tangent space: the positive front of the coordinate axis is always perpendicular to the object surface. By transforming the viewing vector from the model space to the tangent space and using the tangent space for calculation, the space of the curved surface can be obtained, and the inner wall of the space will always be parallel to the surface of the model.

[0040] In order to make the initial direction vector applicable to the cubic space, it is necessary to scale down or scale up the coordinate parameters of the initial direction vector based on the size parameters of the preset indoor space to obtain the processed coordinate parameters; for example, if the length, width, and height of the indoor space correspond to the X, Y, and Z axes respectively, then the X-axis coordinate of the initial direction vector needs to be divided by the length of the indoor space, the Y-axis coordinate needs to be divided by the width of the indoor space, and the Z-axis coordinate needs to be divided by the height of the indoor space. Then, the direction vector represented by the processed coordinate parameters can be determined as the sampling direction vector.

[0041] Specifically, when creating the cubemap, after obtaining the Cubemaps corresponding to indoor spaces of different proportions, it is necessary to perform corresponding scaling on the length and height of the three-dimensional bounding box, and then perform corresponding scaling on the x, y, and z axes of the viewing vector respectively, so as to restore the space represented by the Cubemap itself.

[0042] To display the effect of a bay window, the patch model may also be bent. For the convenience of writing, the bent part of the patch model is called the first region, and the other part is called the second region. The plane where the first region is located is different from the plane where the second region is located. The first region has a corresponding tilt parameter, which is used to indicate the angle between the plane where the first region is located and a preset reference direction. The above preset reference direction usually corresponds to the bending direction of the first region. For example, if the first region is bent in the XY plane and the second region is in the XZ plane, the reference direction is the X-axis direction.

[0043] A corresponding mask texture can be set for the patch model in advance. The mask texture is used to indicate the first region and the second region in the patch model. For example, the pixel value in the texture area corresponding to the first region in the mask texture is 255, and the pixel value in the texture area corresponding to the second region is 0. Specifically, it can be set according to requirements and is not limited here. That is, to achieve the tilt of the window, a texture is needed to identify the tilted area of the window and clarify the tilt angle of the window.

[0044] When determining the initial direction vector of the position to be rendered in the patch model, it is necessary to judge whether the position to be rendered is in the first region based on the mask texture; if so, based on the tilt parameter, the position of the virtual camera, and the position to be rendered, determine the initial direction vector corresponding to the position to be rendered. Specifically, it is necessary to determine the initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; then, based on the tilt parameter, calculate the rotation vector, and update the initial direction vector based on the component of the rotation vector in the reference direction.

[0045] In the specific implementation, the RotateAboutAxis can be used to calculate the rotation vector and apply it to the Z component of the line-of-sight vector, then the rotation caused by the tilt of the window itself can be offset. That is, by constructing a reverse rotation vector in the normal direction to linearly transform the line-of-sight vector to offset the rotation of the window, a tilted window can be achieved, as Figure 2 shown.

[0046] The following embodiments provide a specific method for sampling a cube map based on texture sampling parameters to determine the rendering parameters of the patch model.

[0047] In practical applications, for each position to be rendered, sample the texture space formed by the cube map based on the sampling direction vector corresponding to the position to be rendered to obtain a sampling result; based on the sampling result, determine the rendering parameters of the position to be rendered.

[0048] Specifically, the above process can be regarded as: emitting a ray from the position of the virtual camera towards the position to be rendered of the patch model (also known as the "rendering point"), and the ray will generate an intersection point with the bounding box corresponding to the model, and this intersection point is used to sample the Cubemap prepared in the previous step.

[0049] As Figure 3 shown, assume that point P is the location of the camera, the line-of-sight direction is d, and the ray passes through the bounding box B after time t. Then the following system of equations can be obtained.

[0050]

[0051] Solving the system of equations can obtain

[0052]

[0053] Substituting the solved time t1 into the original formula can obtain the intersection point where the ray exits the bounding box and intersects with the bounding box.

[0054] The above method has the following advantages: reducing the development cost, replacing the modeling of the indoor space in this way can save a large amount of art work; improving the art effect, this solution can have a more realistic art effect compared with simply simulating the indoor space with 2D textures; saving performance overhead, this solution uses one patch to replace a large number of models, greatly reducing the number of triangular faces; compared with traditional indoor mapping, this solution can achieve more diverse indoor spaces, giving artists more freedom.

[0055] For the above method embodiments, refer to Figure 4 the generation device of an indoor effect shown in

[0056] The patch model setting module 402 is used to set the patch model in the virtual space; the virtual space includes a pre-set virtual camera;

[0057] The texture sampling parameter determination module 404 is used to determine the texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the size parameters of the pre-set indoor space; the display effect of the indoor space is saved through a pre-set cube map;

[0058] The rendering module 406 is used to sample the cube map based on the texture sampling parameters, determine the rendering parameters of the patch model, and render the patch model based on the rendering parameters, so that the patch model displays the display effect of the indoor space.

[0059] The above-mentioned indoor effect generation device sets a patch model in the virtual space; determines the texture sampling parameters corresponding to the patch model based on the relative positions of the virtual camera and the patch model and the size parameters of the preset indoor space; the display effect of the indoor space is saved by a preset cube map; samples the cube map based on the texture sampling parameters to determine the rendering parameters of the patch model; renders the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space. In this method, when determining the texture sampling parameters corresponding to the patch model, the size parameters of the simulated indoor space are considered. The indoor effect obtained by sampling the cube map through the texture sampling parameters and rendering the patch model is consistent with the effect of the indoor space, without distortion, improving the flexibility of rendering the indoor effect and the rendering efficiency of the indoor effect.

[0060] The above-mentioned patch model includes multiple positions to be rendered; the texture sampling parameters include a sampling direction vector; the texture sampling parameter determination module is further configured to: for each position to be rendered of the patch model, determine the initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; determine the sampling direction vector corresponding to the position to be rendered based on the size parameters of the preset indoor space and the initial direction vector.

[0061] The above-mentioned patch model has a corresponding three-dimensional bounding box; the patch model is located on the surface of the three-dimensional bounding box; the size of the three-dimensional bounding box is proportional to the size of the indoor space; the initial direction vector is represented by the coordinate parameters in the object coordinate system corresponding to the three-dimensional bounding box; the texture sampling parameter determination module is further configured to: perform reduction or amplification processing on the coordinate parameters of the initial direction vector based on the size parameters of the preset indoor space to obtain the processed coordinate parameters; determine the direction vector represented by the processed coordinate parameters as the sampling direction vector.

[0062] The above-mentioned patch model includes multiple positions to be rendered; the texture sampling parameters include a sampling direction vector; the rendering module is further configured to: for each position to be rendered, sample the texture space formed by the cube map based on the sampling direction vector corresponding to the position to be rendered to obtain a sampling result; determine the rendering parameters of the position to be rendered based on the sampling result.

[0063] The above-mentioned device further includes: an initial direction vector representation module, configured to represent the initial direction vector by the coordinate parameters in the tangent space corresponding to the three-dimensional bounding box if the shape of the indoor space is non-cubic.

[0064] The above patch model has a preset mask texture map; the mask texture map is used to indicate a first area and a second area in the patch model; the plane where the first area is located is different from the plane where the second area is located; the first area has a corresponding tilt parameter; the tilt parameter is used to indicate the angle between the plane where the first area is located and a preset reference direction; the texture sampling parameter determination module is further configured to: determine whether the position to be rendered is in the first area based on the mask texture map; if so, determine an initial direction vector corresponding to the position to be rendered based on the tilt parameter, the position of the virtual camera, and the position to be rendered.

[0065] The above texture sampling parameter determination module is further configured to: determine an initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; calculate a rotation vector based on the tilt parameter; update the initial direction vector based on the component of the rotation vector in the reference direction.

[0066] This embodiment further provides an electronic device, including a processor and a memory, where the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above method for generating the indoor effect, for example:

[0067] Set a patch model in the virtual space; the virtual space includes a preset virtual camera; determine the texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the size parameters of the preset indoor space; the display effect of the indoor space is saved through a preset cube texture map; sample the cube texture map based on the texture sampling parameters to determine the rendering parameters of the patch model; render the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space.

[0068] In the above manner, when determining the texture sampling parameters corresponding to the patch model, the size parameters of the simulated indoor space are considered. The indoor effect obtained by sampling the cube texture map through the texture sampling parameters and rendering the patch model is consistent with the effect of the indoor space, without distortion, improving the flexibility of rendering the indoor effect and the rendering efficiency of the indoor effect.

[0069] Optionally, the above patch model includes multiple positions to be rendered; the texture sampling parameters include sampling direction vectors; the step of determining the texture sampling parameters corresponding to the patch model based on the relative position between the virtual camera and the patch model and the size parameters of the preset indoor space includes: for each position to be rendered of the patch model, determine an initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; determine the sampling direction vector corresponding to the position to be rendered based on the size parameters of the preset indoor space and the initial direction vector.

[0070] Optionally, the above patch model has a corresponding three-dimensional bounding box; the patch model is located on the surface of the three-dimensional bounding box; the size of the three-dimensional bounding box is proportional to the size of the indoor space; the initial direction vector is represented by the coordinate parameters in the object coordinate system corresponding to the three-dimensional bounding box; the step of determining the sampling direction vector corresponding to the rendering position based on the preset size parameters of the indoor space and the initial direction vector includes: shrinking or enlarging the coordinate parameters of the initial direction vector based on the preset size parameters of the indoor space to obtain the processed coordinate parameters; determining the direction vector represented by the processed coordinate parameters as the sampling direction vector.

[0071] Optionally, the above patch model includes multiple rendering positions; the texture sampling parameters include the sampling direction vector; the step of sampling the cube map based on the texture sampling parameters to determine the rendering parameters of the patch model includes: for each rendering position, sampling the texture space formed by the cube map based on the sampling direction vector corresponding to the rendering position to obtain the sampling result; determining the rendering parameters of the rendering position based on the sampling result.

[0072] Optionally, the above method further includes: if the shape of the indoor space is non-cubic, representing the initial direction vector by the coordinate parameters in the tangent space corresponding to the three-dimensional bounding box.

[0073] Optionally, the above patch model has a preset mask texture; the mask texture is used to indicate the first area and the second area in the patch model; the plane where the first area is located is different from the plane where the second area is located; the first area has a corresponding inclination parameter; the inclination parameter is used to indicate the angle between the plane where the first area is located and the preset reference direction; the step of determining the initial direction vector corresponding to the rendering position based on the position of the virtual camera and the rendering position includes: judging whether the rendering position is in the first area based on the mask texture; if so, determining the initial direction vector corresponding to the rendering position based on the inclination parameter, the position of the virtual camera and the rendering position.

[0074] Optionally, the above step of determining the initial direction vector corresponding to the rendering position based on the inclination parameter, the position of the virtual camera and the rendering position includes: determining the initial direction vector corresponding to the rendering position based on the position of the virtual camera and the rendering position; the initial direction vector points from the position of the virtual camera to the rendering position; calculating the rotation vector based on the inclination parameter; updating the initial direction vector based on the component of the rotation vector in the reference direction.

[0075] See Figure 5 As shown, the electronic device includes a processor 100 and a memory 101. The memory 101 stores machine-executable instructions that can be executed by the processor 100, and the processor 100 executes the machine-executable instructions to implement the above method for generating the indoor effect.

[0076] Further, Figure 5 the illustrated electronic device further includes a bus 102 and a communication interface 103, and the processor 100, the communication interface 103, and the memory 101 are connected through the bus 102.

[0077] Among them, the memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk memory. The communication connection between the system network element and at least one other network element is implemented through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. can be used. The bus 102 may be an ISA bus, a PCI bus, an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 5 only a bidirectional arrow is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0078] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method may be completed by the integrated logic circuit in the hardware of the processor 100 or the instructions in the form of software. The above-mentioned processor 100 may be a general-purpose processor, including a central processing unit (CPU for short), a network processor (NP for short), etc.; it may also be a digital signal processor (DSP for short), an application specific integrated circuit (ASIC for short), a field-programmable gate array (FPGA for short), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present disclosure. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The method disclosed in combination with the embodiments of the present disclosure may be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module may be located in a mature storage medium in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. This storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and combines its hardware to complete the method of the foregoing embodiments.

[0079] This embodiment also provides a machine-readable storage medium storing machine-executable instructions, which, when called and executed by a processor, cause the processor to implement the above-described method for generating an indoor effect.

[0080] A method, apparatus, and electronic device for generating an indoor effect provided by an embodiment of the present disclosure include a computer-readable storage medium storing program code, and the instructions included in the program code can be used to execute the method described in the foregoing method embodiments. For example:

[0081] Set a patch model in a virtual space; the virtual space includes a pre-set virtual camera; determine texture sampling parameters corresponding to the patch model based on the relative positions of the virtual camera and the patch model and the size parameters of a pre-set indoor space; the display effect of the indoor space is saved by a pre-set cube map; sample the cube map based on the texture sampling parameters to determine rendering parameters for the patch model; render the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space.

[0082] In the above manner, when determining the texture sampling parameters corresponding to the patch model, the size parameters of the simulated indoor space are considered. The indoor effect obtained by sampling the cube map through the texture sampling parameters and rendering the patch model is consistent with the effect of the indoor space, without distortion, improving the flexibility of rendering the indoor effect and the rendering efficiency of the indoor effect.

[0083] Optionally, the above patch model includes multiple positions to be rendered; the texture sampling parameters include a sampling direction vector; the step of determining the texture sampling parameters corresponding to the patch model based on the relative positions of the virtual camera and the patch model and the size parameters of a pre-set indoor space includes: for each position to be rendered of the patch model, determine an initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; determine the sampling direction vector corresponding to the position to be rendered based on the size parameters of the pre-set indoor space and the initial direction vector.

[0084] Optionally, the above patch model has a corresponding three-dimensional bounding box; the patch model is located on the surface of the three-dimensional bounding box; the size of the three-dimensional bounding box is proportional to the size of the indoor space; the initial direction vector is represented by coordinate parameters in the object coordinate system corresponding to the three-dimensional bounding box; the step of determining the sampling direction vector corresponding to the position to be rendered based on the size parameters of the pre-set indoor space and the initial direction vector includes: performing a shrinking or enlarging process on the coordinate parameters of the initial direction vector based on the size parameters of the pre-set indoor space to obtain processed coordinate parameters; determining the direction vector represented by the processed coordinate parameters as the sampling direction vector.

[0085] Optionally, the above patch model includes multiple positions to be rendered; the texture sampling parameter includes a sampling direction vector; the step of determining the rendering parameter of the patch model by sampling the cube map based on the texture sampling parameter includes: for each position to be rendered, sampling the texture space formed by the cube map based on the sampling direction vector corresponding to the position to be rendered to obtain a sampling result; and determining the rendering parameter of the position to be rendered based on the sampling result.

[0086] Optionally, the above method further includes: if the shape of the indoor space is non-cubic, representing the initial direction vector by the coordinate parameters in the tangent space corresponding to the three-dimensional bounding box.

[0087] Optionally, the above patch model has a preset mask texture; the mask texture is used to indicate a first region and a second region in the patch model; the plane where the first region is located is different from the plane where the second region is located; the first region has a corresponding inclination parameter; the inclination parameter is used to indicate the angle between the plane where the first region is located and a preset reference direction; the step of determining the initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered includes: determining whether the position to be rendered is in the first region based on the mask texture; if so, determining the initial direction vector corresponding to the position to be rendered based on the inclination parameter, the position of the virtual camera, and the position to be rendered.

[0088] Optionally, the step of determining the initial direction vector corresponding to the position to be rendered based on the inclination parameter, the position of the virtual camera, and the position to be rendered includes: determining the initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; calculating a rotation vector based on the inclination parameter; and updating the initial direction vector based on the component of the rotation vector in the reference direction.

[0089] Those skilled in the art can clearly understand that for the convenience and brevity of description, the specific working processes of the above-described systems and devices can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0090] In addition, in the description of the embodiments of the present disclosure, unless otherwise clearly specified and limited, the terms "installation", "connection", and "connection" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two components. For those skilled in the art, the specific meanings of the above terms in the present disclosure can be understood according to specific situations.

[0091] If the above-mentioned functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.

[0092] In the description of the present disclosure, it should be noted that the orientation or positional relationship indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. is based on the orientation or positional relationship shown in the drawings. It is only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to the present disclosure. In addition, the terms "first", "second", "third" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance.

[0093] Finally, it should be noted that the above embodiments are only specific implementation manners of the present disclosure, used to illustrate the technical solutions of the present disclosure, rather than limiting them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art within the technical scope disclosed by the present disclosure can still modify the technical solutions recorded in the foregoing embodiments, or can easily think of changes, or perform equivalent replacements on some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should all be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be subject to the protection scope of the claims.

Claims

1. A method for generating indoor effects, characterized in that: include: Setting a patch model in a virtual space; the virtual space includes a pre-set virtual camera; Based on the relative position of the virtual camera and the patch model and the size parameters of the preset indoor space, the texture sampling parameters corresponding to the patch model are determined; the display effect of the indoor space is saved by a preset cube map; The cube map is sampled based on the texture sampling parameters, rendering parameters of the patch model are determined, and the patch model is rendered based on the rendering parameters, so that the patch model displays a display effect of the indoor space.

2. The method according to claim 1, characterized in that The patch model includes a plurality of positions to be rendered; the texture sampling parameters include a sampling direction vector; The step of determining texture sampling parameters corresponding to the patch model based on the relative position of the virtual camera and the patch model and the size parameters of the preset indoor space includes: For each position to be rendered of the patch model, based on the position of the virtual camera and the position to be rendered, determining an initial direction vector corresponding to the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; Based on the preset size parameters of the indoor space and the initial direction vector, a sampling direction vector corresponding to the position to be rendered is determined.

3. The method according to claim 2, characterized in that The patch model has a corresponding three-dimensional bounding box; the patch model is located on the surface of the three-dimensional bounding box; the size of the three-dimensional bounding box is proportional to the size of the indoor space; The initial direction vector is represented by coordinate parameters in the object coordinate system corresponding to the three-dimensional bounding box; The step of determining the sampling direction vector corresponding to the position to be rendered based on the preset size parameters of the indoor space and the initial direction vector comprises: Based on the preset size parameters of the indoor space, the coordinate parameters of the initial direction vector are reduced or enlarged to obtain processed coordinate parameters; The direction vector represented by the processed coordinate parameters is determined as the sampling direction vector.

4. The method according to claim 1, characterized in that The patch model includes a plurality of positions to be rendered; the texture sampling parameters include a sampling direction vector; The step of sampling the cube map based on the texture sampling parameters to determine the rendering parameters of the patch model comprises: For each position to be rendered, sampling the texture space formed by the cube map based on the sampling direction vector corresponding to the position to be rendered to obtain a sampling result; Based on the sampling result, a rendering parameter of the position to be rendered is determined.

5. The method according to claim 3, characterized in that: The method further comprises: If the shape of the indoor space is non-cubic, the initial direction vector is represented by coordinate parameters in the tangent space corresponding to the three-dimensional bounding box.

6. The method according to claim 2, characterized in that The patch model has a preset mask map; the mask map is used to indicate a first area and a second area in the patch model; a plane where the first area is located is different from a plane where the second area is located; the first area has a corresponding tilt parameter; The tilt parameter is used to indicate the angle between the plane where the first area is located and the preset reference direction; The step of determining an initial direction vector corresponding to the position to be rendered based on the position of the virtual camera and the position to be rendered comprises: Determining whether the position to be rendered is in the first area based on the mask map; If yes, an initial direction vector corresponding to the position to be rendered is determined based on the tilt parameter, the position of the virtual camera and the position to be rendered.

7. The method according to claim 6, characterized in that The step of determining an initial direction vector corresponding to the position to be rendered based on the tilt parameter, the position of the virtual camera and the position to be rendered comprises: Based on the position of the virtual camera and the position to be rendered, determining an initial direction vector corresponding to the position to be rendered; the initial direction vector points from the position of the virtual camera to the position to be rendered; Based on the tilt parameter, calculating a rotation vector; The initial direction vector is updated based on the component of the rotation vector in the reference direction.

8. A device for generating indoor effects, characterized in that: include: A patch model setting module, used to set a patch model in a virtual space; the virtual space includes a pre-set virtual camera; A texture sampling parameter determination module, used to determine the texture sampling parameters corresponding to the patch model based on the relative position of the virtual camera and the patch model and the size parameters of the preset indoor space; the display effect of the indoor space is saved through a preset cube map; A rendering module is used to sample the cube map based on the texture sampling parameters, determine the rendering parameters of the patch model, and render the patch model based on the rendering parameters so that the patch model displays the display effect of the indoor space.

9. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for generating indoor effects according to any one of claims 1 to 7.

10. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the method for generating indoor effects according to any one of claims 1 to 7.