Crystal rendering method, device, equipment and storage medium

By copying the crystal model and smoothing its edges, a dual-normal model is generated. Rendering is then performed using two sets of normal information, solving the problem of high computational overhead in crystal model rendering and achieving efficient rendering results.

CN115272551BActive Publication Date: 2026-03-27CHONGQING PERFECT WORLD INTERACTIVE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-11
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Current technologies require a large number of triangles for crystal model rendering, resulting in high computational overhead and failing to effectively reduce the computational burden of the rendering process.

Method used

A preprocessed model is generated by copying the original crystal model and smoothing its edges. Then, the normal information of the preprocessed model is written into the original model to form a dual-normal model, and the two sets of normal information are used for rendering.

Benefits of technology

It reduces the computational overhead of the rendering process while achieving a smooth crystal edge effect, achieving better rendering results without requiring a large number of triangle faces.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115272551B_ABST
    Figure CN115272551B_ABST
Patent Text Reader

Abstract

The application relates to a crystal rendering method, device and equipment and a storage medium. The method comprises the following steps: obtaining data of an original crystal model; copying the data of the original crystal model to obtain data of a copied model, performing edge smoothing processing on the data of the copied model to obtain data of a pretreated model; writing first normal information in the data of the pretreated model into the data of the original crystal model to obtain data of a double-normal model, wherein the data of the double-normal model comprises the first normal information and second normal information in the data of the original crystal model; and performing crystal rendering based on the data of the double-normal model. The application is used to solve the problem that a large number of triangular faces are used for rendering of a crystal model, thereby causing a large calculation cost.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a crystal rendering method and device, equipment and storage medium. BACKGROUND

[0002] In a game work, it is often necessary to render a crystal. In an existing rendering scheme, a large number of triangular faces need to be added to a crystal model to achieve a better rendering effect.

[0003] For example, in order to achieve rendering of a crystal without hard edges, a large number of triangular faces need to be added to a local part of the crystal model, and a chamfering process is performed on the edges of the crystal model, so that the finally rendered crystal model has relatively soft edges, avoiding the rendered crystal edges being hard.

[0004] The crystal model uses a large number of triangular faces, which results in a large amount of calculation overhead in the rendering process. SUMMARY

[0005] The present application provides a crystal rendering method, device, equipment and storage medium to solve the problem of large calculation overhead caused by rendering of a crystal model using a large number of triangular faces.

[0006] In a first aspect, an embodiment of the present application provides a crystal rendering method, comprising:

[0007] obtaining data of an original crystal model;

[0008] copying the data of the original crystal model to obtain data of a copied model, performing edge smoothing processing on the data of the copied model to obtain data of a preprocessed model;

[0009] writing first normal information in the data of the preprocessed model into the data of the original crystal model to obtain data of a double-normal model, the data of the double-normal model including the first normal information and second normal information in the data of the original crystal model;

[0010] performing crystal rendering based on the data of the double-normal model.

[0011] Optionally, the edge smoothing processing on the data of the copied model to obtain the data of the preprocessed model comprises:

[0012] performing smoothing processing and / or chamfering processing on the data of the copied model to obtain the data of the preprocessed model.

[0013] Optionally, the writing of the first normal information in the data of the preprocessed model into the data of the original crystal model to obtain the data of the double-normal model comprises:

[0014] obtaining first normal information in data of the pre-processing model, wherein the first normal information comprises a three-dimensional vector of each normal;

[0015] converting the first normal information into third normal information, wherein the third normal information comprises a two-dimensional vector of each normal, the two-dimensional vector being obtained by converting the three-dimensional vector;

[0016] writing the third normal information into UV information in data of the original crystal model to obtain data of the dual-normal model.

[0017] Optionally, the three-dimensional vector of the normal comprises an X-axis component, a Y-axis component and a Z-axis component; and the two-dimensional vector of the normal comprises a first component and a second component.

[0018] converting the first normal information into third normal information, comprising:

[0019] respectively processing each normal in the first normal information as follows:

[0020] converting a value of the X-axis component according to a preset conversion rule to obtain an X-axis conversion value; wherein the X-axis conversion value is not less than zero.

[0021] combining a sign bit of the Z-axis component with the X-axis conversion value as the first component in the two-dimensional vector of the normal.

[0022] taking the Y-axis component as the second component in the two-dimensional vector of the normal.

[0023] Optionally, writing the third normal information into UV information in data of the original crystal model to obtain data of the dual-normal model, comprises:

[0024] respectively writing the two-dimensional vector of each normal included in the third normal information into UV information at a designated position of the original crystal model to obtain data of the dual-normal model.

[0025] wherein the writing process of any normal in the third normal information comprises: taking the first component of the normal as a U coordinate component and the second component as a V coordinate component, and writing into the UV information at the designated position of the original crystal model.

[0026] Optionally, performing crystal rendering based on the data of the dual-normal model, comprises:

[0027] extracting the third normal information from the UV information at the designated position in the data of the dual-normal model, and extracting the second normal information from the data of the dual-normal model.

[0028] convert the third normal information into the first normal information;

[0029] perform crystal rendering on the double normal model based on the first normal information and the second normal information.

[0030] Optionally, converting the third normal information into the first normal information comprises:

[0031] extracting UV information of the specified position in data of the double normal model;

[0032] performing the following processing on any extracted UV information:

[0033] extracting a U coordinate component and a V coordinate component of the any UV information;

[0034] performing reverse conversion on an absolute value of the U coordinate component according to the preset conversion rule to obtain an X axis component;

[0035] taking the V coordinate component as a Y axis component;

[0036] determining an absolute value of a Z axis component based on the X axis component, the Y axis component, and a preset constraint relationship; the preset constraint relationship comprises that a sum of squares of the X axis component, the Y axis component, and the Z axis component is equal to 1;

[0037] combining a sign bit of the U coordinate component and the absolute value of the Z axis component to obtain the Z axis component;

[0038] combining the X axis component, the Y axis component, and the Z axis component into a three-dimensional vector of any normal in the first normal information.

[0039] Optionally, obtaining the first normal information in data of the pretreatment model comprises:

[0040] when a number of vertices of the pretreatment model is inconsistent with a number of vertices of the original crystal model, taking data of a copy model obtained by copying data of the original crystal model as data of an intermediate transfer model;

[0041] directly writing the first normal information in data of the pretreatment model into data of the intermediate transfer model, so that a number of vertices of the intermediate transfer model is consistent with a number of vertices of the original crystal model and the first normal information is included; the first normal information is normal information of each vertex in data of the pretreatment model;

[0042] taking fourth normal information in data of the intermediate transfer model as the first normal information in data of the pretreatment model; the fourth normal information is normal information of each vertex in data of the intermediate transfer model.

[0043] Optionally, the crystal rendering is performed on the double normal model based on the first normal information and the second normal information, including:

[0044] mixing vertex colors or maps corresponding to the first normal information and the second normal information to obtain a mixed crystal model;

[0045] obtaining a simulated thickness based on the first normal information and the second normal information;

[0046] setting a transparency of the mixed crystal model based on the simulated thickness to obtain a rendered crystal model; wherein the thicker the simulated thickness is, the lower the transparency is.

[0047] In a second aspect, an embodiment of the present application provides a crystal rendering device, including:

[0048] an obtaining module configured to obtain data of an original crystal model;

[0049] a preprocessing module configured to copy the data of the original crystal model to obtain data of a copied model, and perform edge smoothing processing on the data of the copied model to obtain data of a preprocessed model;

[0050] a writing module configured to write first normal information in the data of the preprocessed model into the data of the original crystal model to obtain data of a double normal model, wherein the data of the double normal model includes the first normal information and second normal information in the data of the original crystal model;

[0051] a rendering module configured to perform crystal rendering based on the data of the double normal model.

[0052] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory and a communication bus, wherein the processor and the memory complete mutual communication through the communication bus;

[0053] the memory is configured to store a computer program;

[0054] the processor is configured to execute the program stored in the memory to implement the crystal rendering method in any one of the first aspect.

[0055] In a fourth aspect, an embodiment of the present application provides an electronic device, including a processor, a memory and a communication bus, wherein the processor and the memory complete mutual communication through the communication bus;

[0056] the memory is configured to store a computer program;

[0057] The processor is configured to execute a program stored in the memory to implement the water crystal rendering method of any one of the first aspect.

[0058] In a fifth aspect, the embodiments of the present application provide a computer readable storage medium storing a computer program, and the computer program is configured to implement the water crystal rendering method of any one of the first aspect when executed by a processor.

[0059] The above technical solution provided by the embodiments of the present application has the following advantages compared with the prior art: the method provided by the embodiments of the present application copies the data of the original water crystal model, performs edge smoothing on the copied model to obtain the data of the preprocessed model, writes the first normal information in the data of the preprocessed model into the data of the original water crystal model to obtain the data of the double-normal model including two sets of normal information, that is, the first normal information of the preprocessed model and the second normal information of the original water crystal model, and performs water crystal rendering based on the double-normal model to achieve the purpose of rendering the original water crystal model using two sets of normal information. Since the first normal information of the preprocessed model after edge smoothing is included in the two sets of normal information, the edges of the rendered water crystal also present a smooth effect, so that a better rendering effect can be achieved without using a large number of triangular faces, thereby reducing the computing overhead occupied by the entire water crystal rendering process. BRIEF DESCRIPTION OF DRAWINGS

[0060] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and serve to explain the principles of the present application together with the specification.

[0061] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced as follows. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.

[0062] Figure 1 FIG. 1 is a schematic diagram of the architecture of the water crystal rendering method application system in the embodiments of the present application;

[0063] Figure 2 FIG. 2 is a schematic diagram of the flow of the water crystal rendering method in the embodiments of the present application;

[0064] Figure 3 FIG. 3 is a schematic diagram of the original water crystal model, the smoothed model and the chamfered model in the embodiments of the present application;

[0065] Figure 4 FIG. 4 is a schematic diagram of the plug-in writing the third normal information to the specified UV in the embodiments of the present application;

[0066] Figure 5 This is a schematic diagram illustrating the transmission of normal information via an intermediate transfer model in an embodiment of this application;

[0067] Figure 6 This is a schematic diagram of UV coordinates for writing normal information in an embodiment of this application;

[0068] Figure 7 This is a schematic flowchart of the method for processing UV information in an embodiment of this application;

[0069] Figure 8 This is a schematic diagram of the crystal model obtained by mixing the first normal information and the second normal information in an embodiment of this application;

[0070] Figure 9 This is a schematic diagram illustrating the simulated thickness of the crystal model in an embodiment of this application;

[0071] Figure 10 This is a schematic diagram comparing the effects of normal lines in the embodiments of this application;

[0072] Figure 11 This is a schematic diagram of the simulated thickness change of the model after smoothing in the embodiments of this application;

[0073] Figure 12 This is a schematic diagram illustrating the process of crystal rendering using DCC and the engine in an embodiment of this application;

[0074] Figure 13 This is a schematic diagram of the crystal rendering device structure in the embodiments of this application;

[0075] Figure 14 This is a schematic diagram of the structure of the electronic device in the embodiments of this application. Detailed Implementation

[0076] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0077] This application provides a crystal rendering method that can be applied to, for example... Figure 1 The hardware environment shown consists of terminal 10 and server 11. For example... Figure 1As shown, the server 11 is connected with the terminal 10 through a network, which can be used to provide services (such as game services, application services, etc.) for the terminal or the client installed on the terminal, and a database can be set on the server or independently of the server, which is used to provide data storage services for the server 11. The network includes but is not limited to a wide area network, a metropolitan area network or a local area network, and the terminal 10 is not limited to a PC (Personal Computer), a mobile phone, a tablet computer, etc.

[0078] The crystal rendering method of the embodiment of the present application can be executed by the server 11, or by the terminal 10, or by the server 11 and the terminal 10 together. Wherein, the terminal 10 executes the crystal rendering method of the embodiment of the present application, or the client installed thereon executes the crystal rendering method of the embodiment of the present application.

[0079] In the embodiment of the present application, the first normal information and the second normal information both refer to the normal information of the position of each vertex in the data of the model.

[0080] The normal information in the embodiment of the present application refers to a triangle normal (Normal), which is a three-dimensional vector information representing the pointing direction of the current triangle, and is stored in the vertex attribute of the model. According to the accuracy requirement, it can be float3.

[0081] In the embodiment of the present application, each model of the crystal refers to a 3D model, also known as a three-dimensional model, a solid model, etc.

[0082] In the embodiment of the present application, the data of each model refers to the data of each point of the model in the virtual scene. The data of each point of the model at least includes the normal information and the UV information (UV coordinate information) of each vertex of the model. In addition, the model includes a plurality of triangular faces, and the data of each point of the model can also include the UV information (UV coordinate information) of each triangular face of the model.

[0083] Based on the system architecture, as shown in Figure 2 The method flow of the crystal rendering mainly includes the following steps:

[0084] Step 201, obtaining the data of the original crystal model.

[0085] The data of the original crystal model is obtained by an art designer or pre-stored in a graphics or image processing software. The specific obtaining method of the data of the original crystal model is not limited.

[0086] The data of the original crystal model includes the vertex coordinate information and the normal information of the 3D crystal model.

[0087] Step 202, copying the data of the original crystal model to obtain the data of the copied model, performing edge smoothing processing on the copied model to obtain the data of the preprocessed model.

[0088] In the example embodiment, the data of the copied model is edge-smoothed to obtain a preprocessed model, including: smoothing and / or chamfering the data of the copied model to obtain the preprocessed model. The data of the copied model can be only smoothed or only chamfered, or the copied model can be smoothed and chamfered at the same time. The purpose of the smoothing and / or chamfering is to make the edges of the copied model smooth, and in the application, the processing method can be selected according to the edge-smoothing effect.

[0089] The smoothing and chamfering can be performed by using the vertex coordinate information of the 3D crystal model included in the original crystal model, for example, three new vertices are formed around the vertex of the original crystal model, and the triangular face formed by the three new vertices is used to replace the vertex of the original crystal model to achieve the chamfering effect. For example, the edge formed by the two adjacent vertices is translated to form a new edge of the crystal model to achieve the smoothing effect. Of course, this is only an example for easy understanding, and the model can also be smoothed and / or chamfered by using the algorithm provided by the engine or DCC.

[0090] As shown in the three crystal model diagrams of FIG. 2, Figure 3 The middle model is the original crystal model, the left model is obtained by smoothing the copied model, and the right model is obtained by chamfering the copied model. It can be seen that the smoothing and chamfering will have different degrees of smoothing effect on the edges of the copied model. The coordinates below the original crystal model are the coordinate axes of the DCC software (also known as digital asset production software), and the model displayed in the software will display the coordinate axes when selected by the mouse.

[0091] In step 203, the first normal information in the data of the preprocessed model is written into the data of the original crystal model to obtain the data of the double-normal model, and the data of the double-normal model includes the first normal information and the second normal information in the data of the original crystal model.

[0092] In the example embodiment, the data of the double-normal model includes the first normal information and the second normal information at the same time, so when the first normal information in the data of the preprocessed model is written into the data of the original crystal model, the original second normal information in the data of the original crystal model should not be affected.

[0093] Specifically, the first normal information in the data of the preprocessed model is written into the data of the original crystal model to obtain the data of the double-normal model, including:

[0094] The first normal information in the data of the preprocessed model is obtained, and the first normal information includes the three-dimensional vectors of the normals.

[0095] converting the first normal information into third normal information, wherein the third normal information comprises a two-dimensional vector of each normal, which is obtained by converting the three-dimensional vector;

[0096] writing the third normal information into the UV information in the data of the original crystal model to obtain data of the dual normal model.

[0097] In this embodiment, by converting the three-dimensional vector of each normal in the first normal information into a two-dimensional vector and writing it into the UV information (UV coordinates, which include two components, each component is of a floating-point type) in the data of the original crystal model, the written first normal information does not affect the original second normal information of the original crystal model, so that the dual normal model obtained after writing includes two sets of normal information. Specifically, the two-dimensional vector can be written into the UV information in the data of the original crystal model by a plug-in.

[0098] In the exemplary embodiment, the three-dimensional vector of the normal includes an X-axis component, a Y-axis component and a Z-axis component; the two-dimensional vector of the normal includes a first component and a second component; and converting the first normal information into the third normal information includes:

[0099] processing each normal in the first normal information as follows:

[0100] converting the value of the X-axis component according to a preset conversion rule to obtain an X-axis conversion value; wherein the X-axis conversion value is not less than zero;

[0101] combining the sign bit of the Z-axis component with the X-axis conversion value as the first component in the two-dimensional vector of the normal;

[0102] taking the Y-axis component as the second component in the two-dimensional vector of the normal.

[0103] wherein the three-dimensional vector of the normal satisfies a preset constraint relationship, and the preset constraint relationship includes that the sum of squares of the X-axis component, the Y-axis component and the Z-axis component is equal to 1, i.e., X 2 +Y 2 +Z 2 =1. By using the constraint relationship, when any two vectors in the three-dimensional vector and the sign bit of the third vector are known, the value of the third vector can be obtained by reverse conversion.

[0104] ​In this embodiment, considering that the first normal information extracted in the preprocessing model is a three-dimensional vector with a sign bit, and the UV coordinate is a two-dimensional vector, the first normal information is compressed into two-dimensional information, written into the UV information of the original crystal model through the plug-in, the three-dimensional vector is converted into a two-dimensional vector by using the preset constraint relationship satisfied between the three-dimensional vectors of the normal, and the X-axis conversion value is obtained by converting the X-axis component according to the preset conversion rule, the X-axis conversion value is limited in the value range not less than zero, and the sign bit of the Z-axis is combined with the X-axis conversion value as a component in the two-dimensional vector, so that the subsequent X-axis and Z-axis components can be obtained by using the storage mode and the preset conversion rule to reversely convert the first normal information.

[0105] The value range of the X-axis conversion value can be set to [0, 1] as needed, that is, the value of the X-axis vector is converted from the interval [-1, 1] to the interval [0, 1], so that the value of the X-axis conversion value is not less than zero, so as to be combined with the sign bit of the Z-axis component as one of the two-dimensional vectors. Here, limiting the value range of the X-axis conversion value to the interval [0, 1] is only an example, and other value ranges can be set as needed, as long as they are not less than zero.

[0106] In an exemplary embodiment, the third normal information is written into the UV information in the data of the original crystal model to obtain the data of the double normal model, including:

[0107] After the two-dimensional vector of each normal included in the third normal information is written into the UV information at the specified position of the original crystal model, the data of the double normal model is obtained.

[0108] The writing process of any normal in the third normal information includes: writing the first component of the normal as the U coordinate component and the second component as the V coordinate component into the UV information at the specified position of the original crystal model.

[0109] It should be noted that the user can select the UV information from the data of the original crystal model in the plug-in interface, and the user-selected UV information is used as the UV information at the specified position for writing the third normal information. Alternatively, the plug-in can automatically create a new set of UV for writing the third normal information. The plug-in writes the third normal information vertex by vertex into the UV at the specified position. Figure 4 FIG. 5 shows a schematic diagram of the plug-in writing the third normal information into the specified UV.

[0110] By writing the third normal information into the UV of the model, the technical limitation of vertex color storage in the existing engine is broken, the existing vertex color storage information can only be smooth normal information, and special hard edge information cannot be stored, and the vertex color has only one channel, which leads to that if a set of normal information is stored through vertex color, a second set of normal information cannot be stored, and in the embodiment of the application, the third normal information is written into the UV of the model, so that the vertex color storage method can be skipped, and the UV writing method can be used to write any number of normal information into any channel and read in the engine, so that the normal information that can be stored in a model is free from the number limitation and the limitation of only storing smooth normal.

[0111] In the example embodiment, considering that the UV and the number of vertices in the model are one-to-one, in the case that the number of vertices of the pretreated model and the original crystal model is inconsistent, the normal information of the pretreated model and the UV of the original crystal model cannot be matched one by one, in order to solve this problem, the normal information of the pretreated model is transmitted to the intermediate transmission model through the DCC type software, the intermediate transmission model has the same number of vertices as the original crystal model, and then the normal information is written into the UV of the original crystal model through the intermediate transmission model, thereby giving a higher degree of freedom.

[0112] Specifically as follows:

[0113] Obtaining first normal information in data of a pretreated model, comprising:

[0114] When the number of vertices of the pretreated model and the number of vertices of the original crystal model are inconsistent, data of a copied model obtained by copying data of the original crystal model is used as data of an intermediate transmission model;

[0115] Directly writing first normal information in data of the pretreated model into data of the intermediate transmission model, so that the number of vertices of the intermediate transmission model is consistent with the number of vertices of the original crystal model and includes the first normal information; the first normal information is normal information of each vertex in the data of the pretreated model;

[0116] Fourth normal information in data of the intermediate transmission model is used as the first normal information in data of the pretreated model; the fourth normal information is normal information of each vertex in the data of the intermediate transmission model.

[0117] As Figure 5Fig. 2 shows a schematic diagram of transferring normal information through an intermediate transfer model, from left to right in order are the original crystal model, the intermediate transfer model copied from the original crystal model, and the pretreatment model after smoothing, the arrow shows the direction of normal transfer, the normal information of the vertex in the pretreatment model is transferred to the intermediate transfer model, and then from the intermediate transfer model to the original crystal model. As shown in Fig. 2, the original crystal model is a model with sharp edges, and the normal information of the vertex in the original crystal model is written in the UV coordinate. The UV coordinate of the original crystal model is shown in Fig. 3. As shown in Fig. 3, each point in the UV coordinate corresponds to a normal of the intermediate transfer model. Figure 6 Fig. 4 shows a schematic diagram of writing normal information in the UV coordinate of the original crystal model, in which each point corresponds to a normal of the intermediate transfer model.

[0118] Step 204, performing crystal rendering based on the data of the double normal model.

[0119] In an example embodiment, performing crystal rendering based on the data of the double normal model comprises:

[0120] extracting third normal information from the UV information of the specified position in the data of the double normal model, and extracting second normal information from the data of the double normal model;

[0121] converting the third normal information into first normal information;

[0122] performing crystal rendering on the double normal model based on the first normal information and the second normal information.

[0123] In this embodiment, the third normal information is extracted from the UV information of the double normal model, and the first normal information of the pretreatment model is obtained by converting the third normal information, so that the first normal information and the second normal information are obtained through the double normal model at the same time, and the original normal information and the normal information after edge smoothing are included, and then rendering is performed based on the first normal information and the second normal information, so that the final crystal rendering effect has the display effect of edge smoothing.

[0124] In an example embodiment, converting the third normal information into the first normal information comprises: extracting the UV information of the specified position in the data of the double normal model; for any UV information extracted, respectively adopting Figure 7 The flow shown in Fig. 5 comprises:

[0125] Step 701, extracting the U coordinate component and the V coordinate component of the any UV information;

[0126] Step 702, inversely converting the absolute value of the U coordinate component according to a preset conversion rule to obtain an X axis component;

[0127] Step 703, taking the V coordinate component as a Y axis component;

[0128] At step 704, based on the X-axis component, the Y-axis component, and a preset constraint relationship, the absolute value of the Z-axis component is determined; the preset constraint relationship includes that the sum of the squares of the X-axis component, the Y-axis component, and the Z-axis component is equal to 1.

[0129] At step 705, the sign bit of the U coordinate component is combined with the absolute value of the Z-axis component to obtain the Z-axis component.

[0130] At step 706, the X-axis component, the Y-axis component, and the Z-axis component are combined as a three-dimensional vector of any normal in the first normal information.

[0131] By inversely calculating the UV information of the specified UV in the double normal model to obtain the three-dimensional normal information, that is, the first normal information of each vertex in the preprocessed model, after the normal is compressed from a three-dimensional vector to a two-dimensional vector, the value of the vector can be negative. Therefore, the value of the two-dimensional vector stored in the specified UV information in the double normal model can also be negative, not completely in the [0, 1] interval.

[0132] When converting from the UV coordinate in the double normal model to the three-dimensional vector of the normal, first, the U-axis component is inversely converted according to a preset conversion rule to be mapped to the value interval of [-1, 1] to obtain the X-axis component before compression, the V-axis component is directly taken as the Y vector, and the absolute value of the Z-axis component is calculated according to the X-axis component and the Y-axis component as sqrt(1-X 2 -Y 2 ), and the sign bit of the U-axis component is taken as the sign bit of the Z-axis component, so as to obtain the Z-axis component. Thus, the complete three-dimensional vector of the normal is obtained.

[0133] In the exemplary embodiment, based on the first normal information and the second normal information, the data of the double normal model is subjected to crystal rendering, including:

[0134] For the edge region of the double normal model (different from the original crystal model only in the specified position UV information), the first normal information and the second normal information are used for crystal rendering;

[0135] For the non-edge region of the double normal model, the second normal information is used for crystal rendering.

[0136] Among them, the first normal information used to express the feature of smooth edge is combined when rendering the edge region, so that the edge obtained by crystal rendering can present a smooth display effect, and the second normal information is still used for crystal rendering for the non-edge region.

[0137] For the edge region, the first normal information and the second normal information are mixed to render the edge region of the crystal model. For the non-edge region, the vertex color or the map corresponding to the second normal information is used to render the non-edge region of the crystal model. The mixing can mean superimposing the vertex color corresponding to the first normal information and the vertex color corresponding to the second normal information, or superimposing the map corresponding to the first normal information and the map corresponding to the second normal information. As shown in FIG. 3, the edge region of the crystal model is smooth (the white edges in the figure), not a harsh edge. Figure 8 As shown in FIG. 3, the edge region of the crystal model is smooth (the white edges in the figure), not a harsh edge.

[0138] For the edge region and the non-edge region, the transparency is set after the vertex color or the map is used for coloring, and the rendering process is completed. In an example embodiment, the crystal rendering of the double normal model based on the first normal information and the second normal information includes: mixing the vertex color or the map corresponding to the first normal information and the second normal information to obtain a mixed crystal model; obtaining a simulated thickness based on the first normal information and the second normal information; setting the transparency of the mixed crystal model based on the simulated thickness to obtain a rendered crystal model; and the thicker the simulated thickness, the lower the transparency.

[0139] Specifically, in the material, the PixelNormalWS (pixel global space normal output vector data) of the crystal model (the original crystal model or the double normal model) based on the first normal information and the second normal information represents the direction faced by the pixel based on the current normal; the camera vector obtained by the first normal information and the second normal information relative to the camera is represented as CameraVector; the Dot operation is performed on the PixelNormalWS and the CameraVector to obtain the simulated thickness of the crystal model, which affects the transparency of the crystal model. The thicker the simulated thickness, the lower the transparency, and vice versa. As shown in FIG. 4, the simulated thickness of the crystal model presents a trend of becoming thinner and thinner from the middle to the edge. Figure 9 As shown in FIG. 4, the simulated thickness of the crystal model presents a trend of becoming thinner and thinner from the middle to the edge. Figure 9 The transparency of the crystal model under simulated light irradiation.

[0140] In the example embodiment, the normal is a three-dimensional vector composed of three components of x (X-axis classification), y (Y-axis classification), and z (Z-axis component), that is, (x, y, z). The square sum of the three components is 1, that is, x 2 +y 2 +x 2= 1, so the third component can be calculated by the other two components; the range of the three components of the normal is [-1, 1]; the process of compressing and storing the normal is to store the normal (x, y, z) into UV (u, v), and the range of UV is theoretically infinite, so it can take negative values.

[0141] In the compression process, the Y-axis component of the normal is kept unchanged and directly stored into the V-axis component of UV; the X component of the normal is mapped from [-1, 1] to [0, 1], and the sign bit of the Z component of the normal is combined, and the two parts are stored into the U-axis component of UV.

[0142] In the decompression process, the absolute value of the U-axis component of UV is taken and mapped to [-1, 1] as the X-axis component of the normal; the V-axis component of UV is taken as the Y-axis component of the normal; the absolute value of Z is sqrt(1-X 2 -Y 2 ), and the sign bit of the U-axis component of UV is taken as the Z-axis component of the normal.

[0143] As shown in Figure 10 , it is a comparison diagram of normal effect, and from left to right in the figure, it is the normal effect of the smoothed model, the normal effect of the original crystal model, and the model wireframe. The coordinates under the original crystal model in the figure refer to the coordinate axes of the DCC software (also known as digital asset production software). When the model displayed in the software is selected by the mouse, the coordinate axes will be displayed.

[0144] As shown by the arrow in Figure 11 , the simulated thickness corresponding to the smoothed model presents a trend of becoming thinner and thinner from the middle to the edge, and the bright area in the figure is thick, and the dark area is thin.

[0145] In the exemplary embodiment, as shown in Figure 12 , the original crystal model is smoothed and / or chamfered in DCC to obtain a pretreated model, the pretreated model is compressed to obtain a double normal model, and the double normal model is imported into the engine. After the compressed normal in the UV of the double normal model is read out in the engine, the normal is decompressed, the decompressed normal and the normal of the double normal model itself (the same as the normal of the original crystal model) are used for lighting calculation, and the crystal is rendered based on the result of the lighting calculation.

[0146] The method provided in the embodiments of the present application copies the data of the original crystal model, performs edge smoothing processing on the data of the copied model, obtains the data of the preprocessed model, writes the first normal information in the data of the preprocessed model into the original crystal model, obtains the data of the double-normal model including two sets of normal information, that is, the first normal information of the preprocessed model and the second normal information of the original crystal model, and performs crystal rendering based on the data of the double-normal model, so as to render the original crystal model by using two sets of normal information. Since the first normal information of the preprocessed model after edge smoothing processing is included in the two sets of normal information, the edges of the rendered crystal also present a smooth effect, so that a better rendering effect can be achieved without using a large number of triangular faces, and the computing overhead occupied by the entire crystal rendering process is reduced.

[0147] Based on the same idea, the embodiments of the present application provide a crystal rendering device. The specific implementation of the device can be referred to the description of the method embodiments, and the repeated parts will not be described here again, such as Figure 13 The device mainly includes:

[0148] The obtaining module 1301 is configured to obtain the data of the original crystal model.

[0149] The preprocessing module 1302 is configured to copy the data of the original crystal model to obtain the data of the copied model, perform edge smoothing processing on the data of the copied model, and obtain the data of the preprocessed model.

[0150] The writing module 1303 is configured to write the first normal information in the data of the preprocessed model into the data of the original crystal model, and obtain the data of the double-normal model, wherein the data of the double-normal model includes the first normal information and the second normal information in the data of the original crystal model.

[0151] The rendering module 1304 is configured to perform crystal rendering based on the data of the double-normal model.

[0152] Based on the same idea, the embodiments of the present application also provide an electronic device, as shown in Figure 14 The electronic device mainly includes a processor 1401, a memory 1402 and a communication bus 1403, wherein the processor 1401 and the memory 1402 complete mutual communication through the communication bus 1403. The memory 1402 stores a program executable by the processor 1401, and the processor 1401 executes the program stored in the memory 1402 to implement the following steps:

[0153] Obtain the data of the original crystal model.

[0154] Data of the original crystal model is copied to obtain data of a copied model, and the data of the copied model is edge-smoothed to obtain data of a preprocessed model;

[0155] First normal information in the data of the preprocessed model is written into the data of the original crystal model to obtain data of a double-normal model, and the data of the double-normal model includes the first normal information and second normal information in the data of the original crystal model;

[0156] Crystal rendering is performed based on the data of the double-normal model.

[0157] The communication bus 1403 mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus 1403 can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 14 In the above electronic device, only one thick line is used to represent the communication bus 1403, but it does not mean that there is only one bus or only one type of bus.

[0158] The memory 1402 can include a Random Access Memory (RAM) and can also include a non-volatile memory such as at least one disk memory. Optionally, the memory can also be at least one storage device located away from the aforementioned processor 1401.

[0159] The aforementioned processor 1401 can be a general-purpose processor including a Central Processing Unit (CPU), a Network Processor (NP), etc., and can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component.

[0160] In yet another embodiment of the present application, a computer readable storage medium is also provided, in which a computer program is stored, and when the computer program is run on a computer, the computer is caused to execute the water crystal rendering method described in the above embodiments.

[0161] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network or other programmable apparatus. The computer instructions can be stored in a computer readable storage medium or transferred from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions are transferred from one website, computer, server or data center to another website, computer, server or data center through wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, microwave, etc.) mode. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (such as floppy disk, hard disk, magnetic tape, etc.), optical media (such as DVD) or semiconductor media (such as solid state disk) and the like.

[0162] It should be noted that in this document, relational terms such as "first" and "second", and the like can be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without more limitations, an element defined by the statement "comprising a" does not exclude the existence of additional identical elements in the process, method, article, or apparatus including the element.

[0163] The foregoing is considered as illustrative only of the principles of the application. Numerous modifications and changes will readily occur to those skilled in the art, and it is intended to embrace all such modifications and changes that fall within the scope of the application. Accordingly, the application is not to be restricted in scope to the specific embodiments disclosed herein but is to be accorded the full scope that the principles and novel features request appropriately granted.

Claims

1. A crystal rendering method, characterized in that, include: Obtain the data from the original crystal model; The data of the original crystal model is copied to obtain the data of the copied model. The data of the copied model is then processed to smooth the edges to obtain the data of the preprocessed model. Writing the first normal information from the preprocessed model data into the original crystal model data to obtain the dual-normal model data includes: acquiring the first normal information from the preprocessed model data, wherein the first normal information includes the three-dimensional vectors of each normal; converting the first normal information into third normal information, wherein the third normal information includes the two-dimensional vectors of each normal, the two-dimensional vectors being obtained by converting the three-dimensional vectors; writing the third normal information into the UV information in the original crystal model data to obtain the dual-normal model data; the dual-normal model data includes the first normal information and the second normal information from the original crystal model data. Crystal rendering is performed based on the data from the aforementioned dual normal model.

2. The crystal rendering method according to claim 1, characterized in that, The data of the replicated model is subjected to edge smoothing processing to obtain the data of the preprocessed model, including: The data of the replicated model is smoothed and / or chamfered to obtain the data of the preprocessed model.

3. The crystal rendering method according to claim 1, characterized in that, The three-dimensional vector of the normal includes X-axis components, Y-axis components, and Z-axis components; the two-dimensional vector of the normal includes a first component and a second component. Converting the first normal information into third normal information includes: Each normal in the first normal information is processed as follows: The values ​​of the X-axis components are converted according to a preset conversion rule to obtain the X-axis converted values; wherein the X-axis converted values ​​are not less than zero. The sign bit of the Z-axis component is combined with the X-axis transformation value to form the first component in the two-dimensional vector of the normal. The Y-axis component is used as the second component in the two-dimensional vector of the normal.

4. The crystal rendering method according to claim 3, characterized in that, The third normal information is written into the UV information of the original crystal model data to obtain the data of the double normal model, including: After writing the two-dimensional vectors of each normal included in the third normal information into the UV information at a specified position of the original crystal model, the data of the double normal model is obtained. The writing process of any normal in the third normal information includes: taking the first component of the normal as the U coordinate component and the second component as the V coordinate component, and writing it into the UV information at a specified position of the original crystal model.

5. The crystal rendering method according to claim 4, characterized in that, Crystal rendering based on the data from the dual normal model includes: The third normal information is extracted from the UV information at the specified location in the data of the dual normal model, and the second normal information is extracted from the data of the dual normal model. Convert the third normal information into the first normal information; Based on the first normal information and the second normal information, crystal rendering is performed on the dual normal model.

6. The crystal rendering method according to claim 5, characterized in that, Converting the third normal information into the first normal information includes: Extract the UV information at the specified location from the data of the dual normal model; For any extracted UV information, perform the following processing: Extract the U-coordinate and V-coordinate components of any of the UV information; The absolute value of the U-coordinate component is reverse-converted according to the preset conversion rule to obtain the X-axis component; The V-coordinate component is taken as the Y-axis component; Based on the X-axis component, the Y-axis component, and the preset constraint relationship, the absolute value of the Z-axis component is determined; the preset constraint relationship includes the fact that the sum of the squares of the X-axis component, the Y-axis component, and the Z-axis component is equal to 1. The Z-axis component is obtained by combining the sign bit of the U-axis component with the absolute value of the Z-axis component. The X-axis component, Y-axis component, and Z-axis component are combined to form a three-dimensional vector of any normal in the first normal information.

7. The crystal rendering method according to any one of claims 1 or 3 to 6, characterized in that, Obtaining the first normal information from the data of the preprocessed model includes: When the number of vertices in the preprocessed model is inconsistent with the number of vertices in the original crystal model, the data of the copied model obtained by copying the data of the original crystal model will be used as the data of the intermediate transfer model. The first normal information in the data of the preprocessed model is directly written into the data of the intermediate transfer model, so that the number of vertices in the intermediate transfer model is consistent with the number of vertices in the original crystal model and includes the first normal information; the first normal information is the normal information of each vertex in the data of the preprocessed model. The fourth normal information in the data of the intermediate transit model is used as the first normal information in the data of the preprocessed model; the fourth normal information is the normal information of each vertex in the data of the intermediate transit model.

8. The crystal rendering method according to claim 5, characterized in that, Based on the first normal information and the second normal information, crystal rendering is performed on the dual-normal model, including: By mixing the vertex colors or textures corresponding to the first normal information and the second normal information, a mixed crystal model is obtained. Based on the first normal information and the second normal information, the simulated thickness is obtained; The transparency of the mixed crystal model is set based on the simulated thickness to obtain the rendered crystal model; wherein, the thicker the simulated thickness, the lower the transparency.

9. A crystal rendering device, characterized in that, include: The acquisition module is used to acquire data from the original crystal model; The preprocessing module is used to copy the data of the original crystal model to obtain the data of the copied model, and to perform edge rounding on the data of the copied model to obtain the data of the preprocessed model. The writing module is used to write the first normal information from the data of the preprocessed model into the data of the original crystal model to obtain the data of the dual-normal model: acquiring the first normal information from the data of the preprocessed model, wherein the first normal information includes the three-dimensional vectors of each normal; converting the first normal information into third normal information, wherein the third normal information includes the two-dimensional vectors of each normal, the two-dimensional vectors being obtained after converting the three-dimensional vectors; writing the third normal information into the UV information in the data of the original crystal model to obtain the data of the dual-normal model; the data of the dual-normal model includes the first normal information and the second normal information from the data of the original crystal model. The rendering module is used for crystal rendering based on the data of the dual normal model.

Citation Information

Patent Citations

  • Cartoon rendering undercut smoothing method

    CN110390709A