+

CN112184865B - Three-dimensional rendering method, device, electronic device and storage medium - Google Patents

Three-dimensional rendering method, device, electronic device and storage medium Download PDF

Info

Publication number
CN112184865B
CN112184865B CN202010988094.3A CN202010988094A CN112184865B CN 112184865 B CN112184865 B CN 112184865B CN 202010988094 A CN202010988094 A CN 202010988094A CN 112184865 B CN112184865 B CN 112184865B
Authority
CN
China
Prior art keywords
unit
plane
target
target object
merging
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010988094.3A
Other languages
Chinese (zh)
Other versions
CN112184865A (en
Inventor
成杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Miniwan Technology Co ltd
Original Assignee
Shenzhen Miniwan Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Miniwan Technology Co ltd filed Critical Shenzhen Miniwan Technology Co ltd
Priority to CN202010988094.3A priority Critical patent/CN112184865B/en
Publication of CN112184865A publication Critical patent/CN112184865A/en
Application granted granted Critical
Publication of CN112184865B publication Critical patent/CN112184865B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

本公开提供了一种三维渲染的方法、装置、电子设备及存储介质,所述方法包括:获取待渲染的目标物体,所述目标物体由多个单位正方体组成,其中,每个单位正方体的六个单位面均具有颜色;将处于同一平面的颜色相同的且填满长方形区域的至少一个单位面进行合并,得到所述目标物体包含的目标长方形面;调用三维渲染引擎通过渲染所述目标长方形面渲染所述目标物体。本公开实施例能够提高三维渲染引擎的运行效率。

The present disclosure provides a method, device, electronic device and storage medium for three-dimensional rendering, the method comprising: obtaining a target object to be rendered, the target object being composed of a plurality of unit cubes, wherein the six unit faces of each unit cube are all colored; merging at least one unit face with the same color and filling a rectangular area on the same plane to obtain a target rectangular face included in the target object; calling a three-dimensional rendering engine to render the target object by rendering the target rectangular face. The embodiments of the present disclosure can improve the operating efficiency of the three-dimensional rendering engine.

Description

Three-dimensional rendering method, three-dimensional rendering device, electronic equipment and storage medium
Technical Field
The disclosure relates to the field of three-dimensional rendering, and in particular relates to a three-dimensional rendering method, a three-dimensional rendering device, electronic equipment and a storage medium.
Background
In the field of virtual object rendering, a three-dimensional rendering engine needs to be invoked to render a virtual object to achieve a corresponding rendering effect. In the prior art, when rendering an object, a three-dimensional rendering engine needs to independently calculate each surface included in the object. The more the number of independent surfaces, the more the number of surfaces that the three-dimensional rendering engine needs to independently calculate for rendering, the more the three-dimensional rendering engine is computationally loaded, resulting in low running efficiency of the three-dimensional rendering engine and low rendering frame number.
Disclosure of Invention
An object of the present disclosure is to provide a method, an apparatus, an electronic device, and a storage medium for three-dimensional rendering, which can improve the operation efficiency of a three-dimensional rendering engine.
According to an aspect of an embodiment of the present disclosure, a method of three-dimensional rendering is disclosed, the method comprising:
Obtaining a target object to be rendered, wherein the target object consists of a plurality of unit cubes, and six unit surfaces of each unit cube have colors;
merging at least one unit surface which is positioned on the same plane, has the same color and fills the rectangular area to obtain a target rectangular surface contained in the target object;
And calling a three-dimensional rendering engine to render the target object by rendering the target rectangle surface.
According to an aspect of an embodiment of the present disclosure, an apparatus for three-dimensional rendering is disclosed, the apparatus comprising:
the system comprises an acquisition module, a rendering module and a rendering module, wherein the acquisition module is configured to acquire a target object to be rendered, the target object is composed of a plurality of unit cubes, and six unit faces of each unit cube are provided with colors;
The merging module is configured to merge at least one unit surface which is positioned on the same plane, has the same color and fills the rectangular area, so as to obtain a target rectangular surface contained in the target object;
And the rendering module is configured to call a three-dimensional rendering engine to render the target object by rendering the target rectangle surface.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
Selecting a plane to be rendered in the target object as a target plane;
Two unit planes which are the same in color in the target plane and share two vertices are combined two by two based on traversal of vertices of the unit planes in the target plane, wherein each unit plane is combined at most once.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
selecting a plane to be rendered in the target object as a target plane, and selecting a unit plane from all unit planes positioned on the target plane as a starting plane;
Based on the traversal of the vertices of each unit surface within the target plane, each time a further unit surface of the same color as the starting surface and sharing two vertices with the starting surface is traversed, the further unit surface is incorporated into the starting surface.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
Selecting a plane to be rendered in the target object as a target plane, and setting the cycle merging times to be 0;
Combining two mutually independent faces which have the same color and share two vertexes in the target plane in a two-to-two mode based on traversal of vertexes of the mutually independent faces in the target plane in the process of combining each cycle, wherein each independent face is combined at most once in the process of combining each cycle;
and adding the cycle merging times together after each cycle merging is completed, and continuing the next cycle merging until the cycle merging times reach a preset time threshold value, and terminating the cycle merging.
In an exemplary embodiment of the present disclosure, the apparatus is configured to keep consistent the merge order in which the two-by-two merges during each cycle merge.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
acquiring a current visual angle of a user;
And determining the planes to be rendered of the target object in the view angle as the sequence of the target planes, and selecting the target planes according to the sequence.
In an exemplary embodiment of the present disclosure, the apparatus is configured to reject a unit cube having six unit facets each surrounded by other unit cubes from the target object.
In an exemplary embodiment of the disclosure, the apparatus is configured to generate and render a miniature model of the target object based on an equal scale reduction of the rendered target object.
According to an aspect of the disclosed embodiments, an electronic device for three-dimensional rendering is disclosed, comprising a memory storing computer readable instructions, and a processor reading the computer readable instructions stored in the memory to perform the method of any of the above exemplary embodiments.
According to an aspect of the disclosed embodiments, a computer program medium is disclosed, on which computer readable instructions are stored which, when executed by a processor of a computer, cause the computer to perform the method of any of the above exemplary embodiments.
In the embodiment of the disclosure, before a three-dimensional rendering engine is called to render a target object, small square surfaces with the same color to be rendered in the target object are combined into a large rectangular surface, and then the three-dimensional rendering engine is called to render the target object through the large rectangular surface obtained by rendering and combining. By the method, the number of the surfaces which are required to be independently rendered by the three-dimensional rendering engine when the target object is rendered is reduced, so that the calculated amount of the three-dimensional rendering engine is reduced, and the running efficiency of the three-dimensional rendering engine is improved.
Other features and advantages of the present disclosure will be apparent from the following detailed description, or may be learned in part by the practice of the disclosure.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings.
FIG. 1 illustrates a method flow diagram for three-dimensional rendering according to one embodiment of the present disclosure.
Fig. 2 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
Fig. 3 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
Fig. 4 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
Fig. 5 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
Fig. 6 shows a schematic diagram of rendering and scaling a target object according to an embodiment of the present disclosure.
FIG. 7 illustrates an apparatus block diagram of three-dimensional rendering according to one embodiment of the present disclosure.
Fig. 8 illustrates an electronic device hardware diagram of three-dimensional rendering according to one embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the example embodiments may be embodied in many different forms and should not be construed as limited to the examples set forth herein, but rather, the example embodiments are provided so that this disclosure will be more thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more example embodiments. In the following description, numerous specific details are provided to give a thorough understanding of example embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the aspects of the disclosure may be practiced without one or more of the specific details, or with other methods, components, steps, etc. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software or in one or more hardware modules or integrated circuits or in different networks and/or processor devices and/or microcontroller devices.
The present disclosure provides a method of three-dimensional rendering, and in particular, a method of three-dimensional rendering of a target object having a color in a virtual data environment. The kind and arrangement of the colors of the target object are not limited.
FIG. 1 illustrates a method of three-dimensional rendering according to an embodiment of the present disclosure, including, as shown:
step S110, obtaining a target object to be rendered, wherein the target object consists of a plurality of unit cubes, and six unit surfaces of each unit cube have colors;
step S120, merging at least one unit surface which is positioned on the same plane, has the same color and fills the rectangular area, and obtaining a target rectangular surface contained in the target object;
And step S130, calling a three-dimensional rendering engine to render the target object by rendering the target rectangle surface.
In the embodiment of the disclosure, before a three-dimensional rendering engine is called to render a target object, small square surfaces with the same color to be rendered in the target object are combined into a large rectangular surface, and then the three-dimensional rendering engine is called to render the target object through the large rectangular surface obtained by rendering and combining. By the method, the number of the surfaces which are required to be independently rendered by the three-dimensional rendering engine when the target object is rendered is reduced, so that the calculated amount of the three-dimensional rendering engine is reduced, and the running efficiency of the three-dimensional rendering engine is improved.
It should be noted that in the embodiment of the present disclosure, the square is a special rectangle.
The method and the device are mainly applied to a scene of virtual three-dimensional object rendering which interacts with a user, for example, after the user logs in a virtual three-dimensional object control system through a terminal, a target object is built in the system through generating and scheduling unit cubes, and then a cloud server of the system calls a three-dimensional rendering engine to conduct three-dimensional rendering on the target object. Wherein rendering the target object in three dimensions includes rendering a general representation of the surface of the target object, rendering a representation of the surface of the target object under the influence of ambient light shadows.
For the purpose of facilitating explanation of the embodiments of the present disclosure, in the following description of the embodiments of the present disclosure, a cloud server is exemplified as an execution subject, and a target object to be rendered is exemplified as an application scene by a user identified by the cloud server through generating and scheduling a unit cube.
In the embodiment of the disclosure, the obtained target object to be rendered is composed of a plurality of unit cubes, wherein six unit faces of each unit cube have colors. Generally, the colors of the six unit planes of a single unit cube are the same. For example, in a virtual three-dimensional object control system, bricks that are generated and scheduled by a user, each of which is a cube that is a basic unit of a virtual building, have colors. Specifically, there are six blocks with green faces, six blocks with red faces, and six blocks with yellow faces.
In the embodiment of the disclosure, the target object is composed of a plurality of unit cubes, and each unit cube has six unit faces. The target object is rendered, that is, the unit surface that the target object has is rendered. In order to reduce the calculated amount of the three-dimensional rendering engine when rendering the target object, at least one unit surface which is in the same plane, has the same color and fills the rectangular area is combined to obtain a target rectangular surface contained in the target object, and the three-dimensional rendering engine can be further called to render the target object through the rendering target rectangular surface.
In one embodiment, merging at least one unit surface of the same color and filling the rectangular area in the same plane includes:
Selecting a plane to be rendered in the target object as a target plane;
Two unit planes of the same color and sharing two vertices in the target plane are merged two by two based on traversal of vertices of the unit planes in the target plane, wherein each unit plane is merged at most once.
In this embodiment, the combination of at least one unit surface having the same color and filling the rectangular area in the same plane is realized by combining the unit surfaces two by two.
Specifically, the cloud server selects a plane to be rendered in the target object as a target plane, and traverses the vertexes of each unit plane positioned on the target plane, so that it is determined which two unit planes with the same color share two vertexes. Since one unit surface has only four vertexes, if two unit surfaces of the same color share two vertexes, it is explained that the two unit surfaces of the same color together fill one rectangular area, so that the two unit surfaces of the same color are combined. And, each unit surface is merged at most once to avoid merging the same unit surface with two or more other unit surfaces at the same time.
An advantage of this embodiment is that by merging unit planes two by two, a reduction in the number of planes that need to be rendered by the three-dimensional rendering engine can be achieved quickly.
Fig. 2 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
In this embodiment, as shown in fig. 2, at least one unit surface having the same color and filling the rectangular area on the same plane is combined by combining the unit surfaces in pairs.
Specifically, the target plane has 12 unit planes, and each unit plane has a color. Since both the unit surface 1 and the unit surface 2 are red and share two vertices, the unit surface 1 and the unit surface 2 are combined, and in the same way, the unit surface 3 and the unit surface 4, the unit surface 5 and the unit surface 9, the unit surface 10 and the unit surface 11, and the unit surface 8 and the unit surface 12 are combined.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and scope of use of the present disclosure.
In one embodiment, merging at least one unit surface of the same color and filling the rectangular area in the same plane includes:
Selecting a plane to be rendered in the target object as a target plane, and selecting a unit plane from all unit planes positioned in the target plane as a starting plane;
Based on the traversal of the vertices of each unit surface within the target plane, each time a further unit surface of the same color as the starting surface and sharing two vertices with the starting surface is traversed, the further unit surface is incorporated into the starting surface.
In this embodiment, the merging of at least one unit surface having the same color and filling the rectangular area in the same plane is achieved by the continuous merging of the unit surfaces.
Specifically, the cloud server selects a plane to be rendered in the target object as a target plane, and selects a unit plane from all unit planes in the target plane as a starting plane. And traversing the vertexes of each unit surface positioned on the target plane, taking the initial surface as a merging reference, merging the other unit surfaces into the initial surface every time traversing to other unit surfaces which have the same color as the initial surface and share two vertexes with the initial surface, expanding the area of the initial surface merged with the other unit surfaces, and correspondingly changing the vertexes.
Merging is continued until another unit surface of the same color as the start surface and sharing two vertices with the start surface is not found in the target plane.
Further, the cloud server selects one unit surface from the unit surfaces which are not yet combined and are positioned on the target plane as another initial surface, and combines other unit surfaces which have the same color as the other initial surface and share two vertexes with the other initial surface into the other initial surface by using the other initial surface as a combining reference in the same method.
The advantage of this embodiment is that by continuously merging the unit planes, the degree of merging and continuity is improved, further reducing the number of planes that need to be rendered by the three-dimensional rendering engine.
Fig. 3 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
In this embodiment, as shown in fig. 3, the merging of at least one unit surface having the same color and filling the rectangular area in the same plane is achieved by continuously merging the unit surfaces.
Specifically, the target plane has 12 unit planes, and each unit plane has a color. Taking the unit surface 1 as the initial surface, combining the unit surface 2 into the unit surface 1 because the unit surface 1 and the unit surface 2 are red and share two vertexes, enlarging the area of the unit surface 1 and correspondingly changing the vertexes, and continuously combining the unit surface 3 into the unit surface 1 combined with the unit surface 2 because the unit surface 1 and the unit surface 3 combined with the unit surface 2 are red, enlarging the area of the unit surface 1 again and correspondingly changing the vertexes again. Similarly, the subsequent merging process is not described again.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and scope of use of the present disclosure.
In one embodiment, merging at least one unit surface of the same color and filling the rectangular area in the same plane includes:
Selecting a plane to be rendered in the target object as a target plane, and setting the cycle merging times to be 0;
combining two mutually independent faces which have the same color and share two vertexes in the target plane in a two-to-two mode based on traversal of vertexes of the mutually independent faces in the target plane in the process of combining each cycle, wherein each independent face is combined at most once in the process of combining each cycle;
And adding the cycle merging times together after each cycle merging is completed, and continuing the next cycle merging until the cycle merging times reach a preset time threshold value, and terminating the cycle merging.
In this embodiment, at least one unit surface having the same color and filling the rectangular area on the same plane is combined by cyclically combining two independent surfaces.
Specifically, the cloud server may preset a counter to record the number of cycle merging times, and initialize the counter to 0 before the cycle merging starts. Meanwhile, a time threshold is preset, and once the value of the counter reaches the time threshold, loop merging is terminated.
The cloud server selects one plane to be rendered in the target object as a target plane.
In the process of merging in each cycle, the cloud server traverses the vertexes of mutually independent faces positioned on the target plane, so that two mutually independent faces sharing two vertexes and having the same color are merged in pairs. The independent surfaces may be a unit surface a and a unit surface B, which are independent from each other, a unit surface a and a combined surface B, or a combined surface a and a combined surface B, which are independent from each other. And, in the course of merging each cycle, each independent face is merged at most once, in order to avoid the same face to merge with two or more other faces at the same time.
After each cycle of merging is completed, the cloud server adds the value of the counter together to continue the next cycle of merging until the value of the counter reaches the threshold value of the times to terminate the cycle of merging.
An advantage of this embodiment is that by cyclically merging two separate facets, the number of facets that the three-dimensional rendering engine needs to render is nearly minimized, thereby nearly maximizing the operating efficiency of the three-dimensional rendering engine.
Fig. 4 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
In this embodiment, as shown in fig. 4, at least one unit surface having the same color and filling the rectangular area on the same plane is combined by cyclically combining two independent surfaces.
Specifically, the target plane has 12 unit planes, and each unit plane has a color.
During the first round of merging, every two of the 12 mutually independent unit planes are merged. Since the unit surface 1 and the unit surface 2 are red and share two vertexes, the unit surface 1 and the unit surface 2 are combined to obtain a combined surface 13, the unit surface 3 and the unit surface 4 are combined to obtain a combined surface 14, the unit surface 5 and the unit surface 9 are combined to obtain a combined surface 15, the unit surface 10 and the unit surface 11 are combined to obtain a combined surface 16, and the unit surface 8 and the unit surface 12 are combined to obtain a combined surface 17.
In the second cycle of merging, two of the faces 13, 14, 15, 7, 9, 16, and 17 are merged. Since both the surfaces 13 and 14 are red and share two vertices, the surfaces 13 and 14 are combined to obtain a combined surface 18.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and scope of use of the present disclosure.
In one embodiment, the method further comprises:
the merging sequence according to the merging of every two loops is kept consistent.
In this embodiment, the cloud server performs pairwise merging according to the same merging sequence in each cycle merging process, so as to ensure the merging order.
Fig. 5 shows a schematic diagram of merging unit planes according to an embodiment of the present disclosure.
Referring to fig. 5, in this embodiment, during each cycle of merging, merging is performed two by two in the same merging order.
Specifically, the target plane has 12 unit planes, and each unit plane has a color. And the preset merging sequence is that merging is firstly carried out from left to right and then merging is carried out from top to bottom.
In the first cycle merging process, the unit faces which are independent of each other are merged in a left-to-right sequence in advance in the first row, so that a face 13 formed by merging the unit face 1 with the unit face 2 is obtained, a face 14 formed by merging the unit face 3 with the unit face 4 is obtained, the unit faces which are independent of each other are merged in a left-to-right sequence in the second row, so that a face 15 formed by merging the unit face 5 with the unit face 6 is obtained, the unit faces which are independent of each other are merged in a left-to-right sequence in the third row, so that a face 16 formed by merging the unit face 10 with the unit face 11 is obtained, and the unit faces which are not merged and are independent of each other are merged in a top-to-bottom sequence in the second row, so that a face 17 formed by merging the unit face 8 with the unit face 12 is obtained.
In the second cycle merging process, the mutually independent faces are merged in the left-to-right sequence before the first row, so that the face 18 after the face 13 and the face 14 are merged is obtained, and in the same way, the mutually independent faces are merged in the left-to-right sequence after the second row, the mutually independent faces are merged in the left-to-right sequence after the third row, and the mutually independent faces are merged in the top-to-bottom sequence.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and scope of use of the present disclosure.
In one embodiment, selecting a plane to be rendered in the target object as the target plane includes:
acquiring a current visual angle of a user;
And determining the planes to be rendered of the target object in the view angle as the sequence of the target planes, and selecting the target planes according to the sequence.
In this embodiment, the cloud server preferentially selects the target plane from the current view angle of the user.
Specifically, the cloud server can determine at which view angle the user is currently viewing the target object by reading the state of the virtual identity of the user in the virtual three-dimensional control system. After the current view angle of the user is determined, starting from the view angle, determining the sequence of the planes to be rendered in the view angle as target planes, and selecting the target planes according to the sequence.
For example, the cloud server presets the sequence of selecting the target planes as a plane positioned on the front face of the visual angle, a plane positioned on the left side of the visual angle, a plane positioned on the back face of the visual angle, a plane positioned on the right side of the visual angle, a plane positioned on the top face of the visual angle and a plane positioned on the bottom face of the visual angle.
The user builds a cuboid virtual building to be rendered in the system by using the brick, and the six planes to be rendered of the virtual building are respectively a plane A, a plane B, a plane C, a plane D, a plane E and a plane F.
The cloud server determines that in the current view angle of the user, the face B is located on the front face, the face C is located on the left face, the face D is located on the back face, the face A is located on the right face, the face E is located on the top face and the face F is located on the bottom face by reading the state of the virtual identity of the user in the system.
The cloud server performs unit plane combination by taking the plane B as a target plane, and performs unit plane combination by taking the plane C as the target plane after the combination on the plane B is completed. In the same manner, the planes D, E, and F are sequentially set as target planes, and the unit planes are combined.
The embodiment has the advantage that the rendering of the target object can preferentially meet the visual requirements of the user by preferentially selecting the target plane from the current view of the user.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and scope of use of the present disclosure. It will be appreciated that the selection of the target plane may be performed randomly, in addition to preferentially from the current perspective of the user.
In the embodiment of the disclosure, the number of the target rectangular surfaces is smaller than the number of the unit surfaces as long as the merging is successfully performed once, so that the calculated amount required by calling the three-dimensional rendering engine to render the target object through the target rectangular surfaces is smaller than the calculated amount required by calling the three-dimensional rendering engine to render the target object through the unit surfaces, and the running efficiency of the three-dimensional rendering engine is improved.
In one embodiment, before merging at least one unit surface of the same color and filling the rectangular area in the same plane, the method further includes:
And eliminating the unit cubes which are surrounded by other unit cubes on all six unit planes from the target object.
In this embodiment, before merging the unit planes, the cloud server eliminates the unit cubes in which all six unit planes are surrounded by other unit cubes from the target object, that is, eliminates the unit cubes wrapped inside the target object from the target object.
This embodiment has the advantage that the unit cubes wrapped inside the target object can be removed from the target object, since the unit cubes wrapped inside the target object are not visible to the user, and do not need to be rendered from the perspective of the user. Therefore, the calculated amount of the three-dimensional rendering engine is reduced, and the running efficiency of the three-dimensional rendering engine is improved.
In one embodiment, the method further comprises:
and generating and rendering a miniature model of the target object based on the scaling down of the rendered target object.
In this embodiment, after the rendering of the target object is completed, the cloud server reduces the target object in equal proportion according to a preset proportion, generates a miniature model of the target object, and renders the miniature model by the same three-dimensional rendering method.
The embodiment has the advantage that by generating and rendering the miniature model of the target object, the user can watch the whole structure and the whole rendering effect of the target object, and the richness of the visual information of the user is improved.
Fig. 6 shows a schematic diagram of rendering and scaling a target object according to an embodiment of the present disclosure.
Referring to fig. 6, in this embodiment, the user builds the target object shown on the left half of fig. 6 by generating and scheduling bricks. The target rectangular surface is obtained by merging at least one unit surface which is positioned on the same plane and has the same color and is filled in the rectangular area, the target object is rendered by calling a three-dimensional rendering engine through rendering the merged target rectangular surface, the rendering effect is shown on the right side of fig. 6, the target object is reduced in an equal proportion, and a miniature model of the target object is generated and rendered, as shown on the right side of fig. 6.
It should be noted that the embodiment is only an exemplary illustration, and should not limit the function and scope of use of the present disclosure.
Fig. 7 illustrates an apparatus for three-dimensional rendering according to an embodiment of the present disclosure, the apparatus including:
An obtaining module 210 configured to obtain a target object to be rendered, where the target object is composed of a plurality of unit cubes, and six unit planes of each unit cube have colors;
A merging module 220, configured to merge at least one unit surface with the same color and filled in the rectangular area in the same plane, so as to obtain a target rectangular surface contained in the target object;
a rendering module 230 configured to invoke a three-dimensional rendering engine to render the target object by rendering the target rectangular surface.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
Selecting a plane to be rendered in the target object as a target plane;
Two unit planes which are the same in color in the target plane and share two vertices are combined two by two based on traversal of vertices of the unit planes in the target plane, wherein each unit plane is combined at most once.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
selecting a plane to be rendered in the target object as a target plane, and selecting a unit plane from all unit planes positioned on the target plane as a starting plane;
Based on the traversal of the vertices of each unit surface within the target plane, each time a further unit surface of the same color as the starting surface and sharing two vertices with the starting surface is traversed, the further unit surface is incorporated into the starting surface.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
Selecting a plane to be rendered in the target object as a target plane, and setting the cycle merging times to be 0;
Combining two mutually independent faces which have the same color and share two vertexes in the target plane in a two-to-two mode based on traversal of vertexes of the mutually independent faces in the target plane in the process of combining each cycle, wherein each independent face is combined at most once in the process of combining each cycle;
and adding the cycle merging times together after each cycle merging is completed, and continuing the next cycle merging until the cycle merging times reach a preset time threshold value, and terminating the cycle merging.
In an exemplary embodiment of the present disclosure, the apparatus is configured to keep consistent the merge order in which the two-by-two merges during each cycle merge.
In an exemplary embodiment of the present disclosure, the apparatus is configured to:
acquiring a current visual angle of a user;
And determining the planes to be rendered of the target object in the view angle as the sequence of the target planes, and selecting the target planes according to the sequence.
In an exemplary embodiment of the present disclosure, the apparatus is configured to reject a unit cube having six unit facets each surrounded by other unit cubes from the target object.
In an exemplary embodiment of the disclosure, the apparatus is configured to generate and render a miniature model of the target object based on an equal scale reduction of the rendered target object.
The electronic device 30 for three-dimensional rendering according to an embodiment of the present disclosure is described below with reference to fig. 8. The electronic device 30 shown in fig. 8 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 8, the electronic device 30 is in the form of a general purpose computing device. The components of the electronic device 30 may include, but are not limited to, the at least one processing unit 310, the at least one memory unit 320, and a bus 330 that connects the various system components, including the memory unit 320 and the processing unit 310.
Wherein the storage unit stores program code that is executable by the processing unit 310 such that the processing unit 310 performs the steps according to various exemplary embodiments of the present invention described in the description of the exemplary methods described above in this specification. For example, the processing unit 310 may perform the various steps as shown in fig. 1.
Storage unit 320 may include readable media in the form of volatile storage units, such as Random Access Memory (RAM) 3201 and/or cache memory 3202, and may further include Read Only Memory (ROM) 3203.
Storage unit 320 may also include a program/utility 3204 having a set (at least one) of program modules 3205, such program modules 3205 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 330 may be one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 30 may also communicate with one or more external devices 400 (e.g., keyboard, pointing device, bluetooth device, etc.), one or more devices that enable a user to interact with the electronic device 30, and/or any device (e.g., router, modem, etc.) that enables the electronic device 30 to communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 350. An input/output (I/O) interface 350 is connected to the display unit 340. Also, electronic device 30 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 360. As shown, the network adapter 360 communicates with other modules of the electronic device 30 over the bus 330. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 30, including, but not limited to, microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a terminal device, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon computer-readable instructions, which, when executed by a processor of a computer, cause the computer to perform the method described in the method embodiment section above.
According to an embodiment of the present disclosure, there is also provided a program product for implementing the method in the above method embodiments, which may employ a portable compact disc read only memory (CD-ROM) and comprise program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of a readable storage medium include an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable signal medium may include a data signal propagated in baseband or as part of a carrier wave with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
It should be noted that although in the above detailed description several modules or units of a device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit in accordance with embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into a plurality of modules or units to be embodied.
Furthermore, although the steps of the methods in the present disclosure are depicted in a particular order in the drawings, this does not require or imply that the steps must be performed in that particular order, or that all illustrated steps be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step to perform, and/or one step decomposed into multiple steps to perform, etc.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, including several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any adaptations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (10)

1. A method of three-dimensional rendering, the method comprising:
Obtaining a target object to be rendered, wherein the target object consists of a plurality of unit cubes, and six unit surfaces of each unit cube have colors;
Merging at least one unit surface which is positioned on the same plane, has the same color and fills the rectangular area to obtain a target rectangular surface contained in the target object, wherein the target rectangular surface consists of adjacent unit surfaces with the same color;
And calling a three-dimensional rendering engine to render the target object by rendering the target rectangle surface.
2. The method of claim 1, wherein merging at least one unit surface of the same color and filling the rectangular area in the same plane comprises:
Selecting a plane to be rendered in the target object as a target plane;
Two unit planes which are the same in color in the target plane and share two vertices are combined two by two based on traversal of vertices of the unit planes in the target plane, wherein each unit plane is combined at most once.
3. The method of claim 1, wherein merging at least one unit surface of the same color and filling the rectangular area in the same plane comprises:
selecting a plane to be rendered in the target object as a target plane, and selecting a unit plane from all unit planes positioned on the target plane as a starting plane;
Based on the traversal of the vertices of each unit surface within the target plane, each time a further unit surface of the same color as the starting surface and sharing two vertices with the starting surface is traversed, the further unit surface is incorporated into the starting surface.
4. The method of claim 1, wherein merging at least one unit surface of the same color and filling the rectangular area in the same plane comprises:
Selecting a plane to be rendered in the target object as a target plane, and setting the cycle merging times to be 0;
Combining two mutually independent faces which have the same color and share two vertexes in the target plane in a two-to-two mode based on traversal of vertexes of the mutually independent faces in the target plane in the process of combining each cycle, wherein each independent face is combined at most once in the process of combining each cycle;
and adding the cycle merging times together after each cycle merging is completed, and continuing the next cycle merging until the cycle merging times reach a preset time threshold value, and terminating the cycle merging.
5. The method according to claim 4, wherein the method further comprises:
the merging sequence according to the merging of every two loops is kept consistent.
6. The method according to claim 2, 3 or 4, wherein selecting one of the planes to be rendered in the target object as a target plane comprises:
acquiring a current visual angle of a user;
And determining the planes to be rendered of the target object in the view angle as the sequence of the target planes, and selecting the target planes according to the sequence.
7. The method of claim 1, wherein prior to merging at least one unit face of the same color and filling the rectangular area in the same plane, the method further comprises:
And eliminating the unit cubes which are surrounded by other unit cubes on all six unit planes from the target object.
8. The method according to claim 1, wherein the method further comprises:
and generating and rendering a miniature model of the target object based on the isovolumetric reduction of the rendered target object.
9. An apparatus for three-dimensional rendering, the apparatus comprising:
the system comprises an acquisition module, a rendering module and a rendering module, wherein the acquisition module is configured to acquire a target object to be rendered, the target object is composed of a plurality of unit cubes, and six unit faces of each unit cube are provided with colors;
The merging module is configured to merge at least one unit surface which is positioned on the same plane, has the same color and fills the rectangular area, so as to obtain a target rectangular surface contained in the target object, wherein the target rectangular surface consists of adjacent unit surfaces with the same color;
And the rendering module is configured to call a three-dimensional rendering engine to render the target object by rendering the target rectangle surface.
10. An electronic device for three-dimensional rendering, comprising:
a memory storing computer readable instructions;
A processor reading computer readable instructions stored in a memory to perform the method of any one of claims 1-8.
CN202010988094.3A 2020-09-18 2020-09-18 Three-dimensional rendering method, device, electronic device and storage medium Active CN112184865B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010988094.3A CN112184865B (en) 2020-09-18 2020-09-18 Three-dimensional rendering method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010988094.3A CN112184865B (en) 2020-09-18 2020-09-18 Three-dimensional rendering method, device, electronic device and storage medium

Publications (2)

Publication Number Publication Date
CN112184865A CN112184865A (en) 2021-01-05
CN112184865B true CN112184865B (en) 2025-03-04

Family

ID=73956447

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010988094.3A Active CN112184865B (en) 2020-09-18 2020-09-18 Three-dimensional rendering method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN112184865B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115409944B (en) * 2022-09-01 2023-06-02 浙江巨点光线智慧科技有限公司 Three-dimensional scene rendering and data correction system based on low-code digital twin

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109961498A (en) * 2019-03-28 2019-07-02 腾讯科技(深圳)有限公司 Image rendering method, device, terminal and storage medium
CN111143018A (en) * 2019-12-31 2020-05-12 北京旷视机器人技术有限公司 Front-end image rendering method and device and electronic equipment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI446315B (en) * 2011-01-13 2014-07-21 Chunghwa Picture Tubes Ltd Thee dimensional display
KR102327144B1 (en) * 2014-11-26 2021-11-16 삼성전자주식회사 Graphic processing apparatus and method for performing tile-based graphics pipeline thereof
CN105894551B (en) * 2016-03-31 2020-02-14 百度在线网络技术(北京)有限公司 Image drawing method and device
CN106528174B (en) * 2016-11-25 2019-11-08 上海野火网络科技有限公司 Flash rendering method and rendering engine based on cocos2dx
CN111145329B (en) * 2019-12-25 2024-03-22 北京像素软件科技股份有限公司 Model rendering method, system and electronic device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109961498A (en) * 2019-03-28 2019-07-02 腾讯科技(深圳)有限公司 Image rendering method, device, terminal and storage medium
CN111143018A (en) * 2019-12-31 2020-05-12 北京旷视机器人技术有限公司 Front-end image rendering method and device and electronic equipment

Also Published As

Publication number Publication date
CN112184865A (en) 2021-01-05

Similar Documents

Publication Publication Date Title
Bethel et al. Using high-speed WANs and network data caches to enable remote and distributed visualization
JP4230456B2 (en) 3D image processing
US20220241689A1 (en) Game Character Rendering Method And Apparatus, Electronic Device, And Computer-Readable Medium
US20170154468A1 (en) Method and electronic apparatus for constructing virtual reality scene model
CN113457160A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN115814407B (en) Information processing method, device, storage medium and electronic device
US20240062453A1 (en) Generation of tight world space bounding regions
KR20240027813A (en) View synthesis system and method using depth map
CN112184865B (en) Three-dimensional rendering method, device, electronic device and storage medium
CN114119797A (en) Data processing method and device, computer readable medium, processor and electronic equipment
CN112070868B (en) Animation playing method based on iOS system, electronic equipment and medium
WO2023207354A1 (en) Special effect video determination method and apparatus, electronic device, and storage medium
WO2018049682A1 (en) Virtual 3d scene production method and related device
WO2024255620A1 (en) Image processing method and apparatus, and device, medium and program product
CN118175389A (en) Video processing method, system, electronic device and storage medium
WO2024067159A1 (en) Video generation method and apparatus, electronic device, and storage medium
US12256098B1 (en) Real time simplification of meshes
CN116485969A (en) Voxel object generation method, voxel object generation device and computer-readable storage medium
CN115937396A (en) Image rendering method and device, terminal equipment and computer readable storage medium
KR20180053494A (en) Method for constructing game space based on augmented reality in mobile environment
CN113553287B (en) A method, device and computer-readable storage medium for node partitioning of a computational graph
CN112149298B (en) Method and device for driving objects in a virtual data environment
CN118135079B (en) Three-dimensional scene roaming drawing method, device and equipment based on cloud fusion
US20250118337A1 (en) Video processing method and apparatus
CN117956220B (en) Rendering method, device, equipment, computer-readable storage medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载