CN115185523B - Method for converting ProcedurralMesh into static grid capable of being packaged - Google Patents

Method for converting ProcedurralMesh into static grid capable of being packaged Download PDF

Info

Publication number
CN115185523B
CN115185523B CN202211107380.XA CN202211107380A CN115185523B CN 115185523 B CN115185523 B CN 115185523B CN 202211107380 A CN202211107380 A CN 202211107380A CN 115185523 B CN115185523 B CN 115185523B
Authority
CN
China
Prior art keywords
static grid
static
data
construction
array
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
CN202211107380.XA
Other languages
Chinese (zh)
Other versions
CN115185523A (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.)
Beijing Weiling Times Technology Co Ltd
Original Assignee
Beijing Weiling Times 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 Beijing Weiling Times Technology Co Ltd filed Critical Beijing Weiling Times Technology Co Ltd
Priority to CN202211107380.XA priority Critical patent/CN115185523B/en
Publication of CN115185523A publication Critical patent/CN115185523A/en
Application granted granted Critical
Publication of CN115185523B publication Critical patent/CN115185523B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/60Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/34Graphical or visual programming
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/203Drawing of straight lines or curves

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Human Computer Interaction (AREA)
  • Computing Systems (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention provides a method for converting ProceduralMesh into a static grid capable of being packaged, which comprises the following steps: acquiring a ProceduralMesh component to be converted, and generating a static grid construction structural body; judging the effectiveness of the static grid construction structure body; if the static grid construction structure is effective, generating a static grid object, and initializing the static grid object; generating a collision volume for the static mesh object; adding material data to the static grid object; creating a static grid construction parameter object and setting construction parameters; and constructing static grid volume data according to the static grid construction structure body and the static grid construction parameter object, outputting the static grid volume data, converting ProcedurralMesh into a static grid supporting the distance field by the method, converting ProcedurralMesh into a static grid model capable of being packaged by the method, and facilitating the support of the distance field and Lumen functions.

Description

Method for converting ProcedurralMesh into static grid capable of being packaged
Technical Field
The invention relates to the technical field of computers, in particular to a method for converting ProcedurralMesh into a static grid capable of being packaged.
Background
Lumen is a default full-dynamic global illumination and reflection system of the illusion engine 5, can render indirect diffuse reflection in a macro scene with a large amount of details, and ensures infinite times of rebounding and indirect high-luminosity reflection effects; distance fields are a dependent function of Lumen global illumination, and without distance fields, lumen's global illumination and reflection effects cannot be applied.
The ProcedurralMesh is a component for generating and modifying a model when the illusion engine runs, and the model can be conveniently generated according to the vertex UV information; but ProceduralMesh does not support distance field and Lumen rendering. Therefore, after the model is generated and modified by using the ProceduralMesh, the global illumination and reflection effect cannot be realized by means of the Lumen, and the display effect and the user experience of the model are seriously influenced.
Disclosure of Invention
Aiming at the restriction limitation, the invention provides a method for converting ProcedurlMesh into a static grid capable of being packaged, and the ProcedurlMesh is converted into the static grid capable of being packaged and used for supporting distance field and Lumen functions.
In order to achieve the purpose, the invention adopts the following technical scheme:
the invention provides a method for converting ProceduralMesh into a static grid capable of being packaged, which comprises the following steps:
step 1, acquiring a ProceduralMesh component to be converted, and generating a static grid construction structural body;
step 2, judging the effectiveness of the static grid construction structure body; if the static grid construction structure is effective, generating a static grid object, and initializing the static grid object;
step 3, generating a collision body of the static grid object;
step 4, adding material data into the static grid object;
step 5, creating a static grid construction parameter object and setting construction parameters;
and 6, constructing static grid volume data according to the static grid construction structure body and the construction parameters, and outputting the static grid volume data.
Compared with the prior art, the invention has the following advantages:
the invention converts ProcedurlMesh into a static grid model which can be packed, overcomes the problem that the ProcedurlMesh cannot support distance fields and Lumen after generating the model, and lays a foundation for subsequently supporting the distance fields and the Lumen.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical means of the present invention more clearly understood, the present invention may be implemented in accordance with the content of the description, and in order to make the above and other objects, features, and advantages of the present invention more clearly understood, the following preferred embodiments are described in detail with reference to the accompanying drawings.
Drawings
Fig. 1 is a flowchart of a method for converting a procedural mesh into a static grid capable of being packed according to an embodiment of the present invention.
Detailed Description
The present invention is described in terms of particular embodiments, other advantages and features of the invention will become apparent to those skilled in the art from the following disclosure, and it is to be understood that the described embodiments are merely exemplary of the invention and that it is not intended to limit the invention to the particular embodiments disclosed. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. For a further understanding of the present invention, reference will now be made in detail to the preferred embodiments of the present invention.
The following is an explanation of the noun terms involved in the embodiments of the present invention:
UStatICmesh: the UStatICMesh contains data of FMeshDescription, namely, model data required by the static grid can be generated by using the FMeshDescription.
Static grid object: the UStatICmesh class object in the illusion engine system is a core class for storing static grid model data and rendering data; the static grid object comprises two member variables, namely FStatcMeshSourceModel and FStatcMeshRenderData; the FStattic MeshSourceModel comprises data analyzed by FMeshDescription from FBX and is used for storing information such as vertex, UV, normal, point sequence and the like; fstaticmesh renderdata contains rendering information, including the rendering information for each layer LOD of the ustatingmesh.
Procedural mesh component: the ProcedurralMesh component is used for storing the model vertex information by using an FProcMEShSection array; the FProcMeshSection array consists of the following structure:
ProcVertexBuffer (fprocmeshfentex array): for storing vertex related information;
ProcIndexBuffer (uint 32 array): used for storing vertex order information;
section localbox (FBox type): the bounding box size used for saving the current Section is used for calculating the Section range;
bEnableCollision (bool type): the method comprises the steps of identifying whether the current Section starts collision or not;
bSectionVisible (bool type): for identifying whether the current Section is displayed.
The following specifically describes implementations of the present invention in conjunction with the foregoing noun terms:
the invention provides a method for converting ProcedurRalMesh into a static grid capable of being packaged,
referring to fig. 1, the method comprises the steps of:
step 1, obtaining a ProcedurralMesh component to be converted, and generating a static grid construction structure FMeshDescription;
step 2, judging the effectiveness of the FMeshDescription of the static grid construction structure body;
if the static grid construction structure body is invalid, returning a null object and ending the process;
if the static grid construction structure is effective, generating a static grid object UStatcmesh, and initializing the static grid object;
step 3, generating a collision body of the static grid object according to collision information data of the ProceduralMesh component;
step 4, adding all material data of the ProceduralMesh component into the static grid object;
step 5, creating a static grid construction parameter object and setting construction parameters;
and 6, constructing static grid volume data according to the static grid construction structure FMeshDescription and the construction parameters, and outputting the static grid volume data.
The static grid construction structural body is used for storing FBX file analysis data.
The data of the static grid construction structure body consists of one or more of vertex positions, a plurality of vertex examples, side data, triangle data, polygon data and polygon groups;
wherein the vertex instances include UV, normal, tangent, secondary normal, vertex color data; the edge data is used for describing whether the edge is a hard edge or not.
The static grid has a data structure of distance fields and Lumen, and lays a foundation for realizing global illumination and reflection effects by means of Lumen subsequently.
As an embodiment, the static network construction structure in step 1 is constructed by calling a build mesh description method;
the BuidMeshDescription method is an FMeshDescription method, is used for converting the selection data of the ProcedurMeshComponent into FMeshDescription data, and is referred to as a ProcedurMeshComponent component pointer.
As an example, the determination of the effectiveness of the static grid structure in step 2 is implemented by:
acquiring polygon group data in the static grid construction structure FMeshDescription;
if all elements in the polygon group data are larger than 0, the static grid construction structural body is effective; otherwise the static grid construction structure is not valid.
As an embodiment, initializing the static grid object in step 2 initializes rendering resources of the usaticmesh by calling a function InitResources of the usaticmesh; the concrete mode is as follows:
(1) Stopping the game thread to update the UV;
(2) Re-caching FStatic MeshRenderData data;
(3) And calling the RHI command to redistribute the GUP rendering data of the current Staticmesh.
As an example, generating the collision volume of the static mesh object in step 3 is implemented by:
calling a createBodySetup function of the static grid object for calling the new static grid object to generate a UBodySetup structure body; and calling a CreatePhysics Meshes method of the static grid object to generate Physics Meshes.
The UBodySetup is used for storing static physical data, and real physical data is generated during running; the parameters of the ubody setup structure and the corresponding parameter values in the method are described as follows:
bGenerateIrroredColision (pool type): whether necessary data is generated to support collision of mirrored versions of this mesh; setting false in the method;
bDoubleSidedGeometry (bool type): whether the physical triangular mesh uses double faces when the scene query is carried out; the true value is set in the method, so that the problem when the model is a plane or a single surface is prevented;
body setupgui: the UBodySetup is used for uniquely identifying the current UBodySetup;
CollisionTraceFlag (enumerated value): and the collision detection type takes values including: CTF _ UseDefault (default setting, using complex collision), CTF _ usesamplenandcomp (creating simple and complex collision), CTF _ usesamplesplexicomplete (creating simple collision only), CTF _ usesamplexassmple (creating complex collision only);
aggeom (fkaggregateageoom type): for saving simple collision data; in the method, the data parameter of AggGeom is simple collision volume data of collision data in ProceduraLMeshComponent.
Specifically, the CollisionTraceFlag parameter value is determined according to the parameter of the procedural mesh component by the following method:
when bsusecomplexixsamplessimplefision of ProceduralMeshComponent is True (True), the value of CollisionTraceFlag parameter is CTF _ usecomplexixssimplefile;
when bUSeComplexAsSimpleColision of ProcedurMeshComponent is False (False), the value of the Collision TraceFlag parameter is CTF _ UseDefault;
the above-mentioned bUSeComplexAsSimpleCollision is used to mark whether the ProcedurMeshComponent uses only complex collisions.
As an embodiment, step 4 further comprises the steps of:
step 41, creating a temporary material array;
step 42, determining the number of elements of the selection array in the ProcedurlMeshComponent, circularly calling a GetMaterial method to transmit a circular subscript value, obtaining all material arrays, and storing all the material arrays into the temporary material array through an Add method of the material arrays;
and 43, calling a GetStaticmaterials method of the static grid object to obtain a material array, and circularly adding elements in the temporary material array to the material array.
As an embodiment, the construction parameters in step 5 are FBuildMeshDescriptionsParams structural bodies, which are used to define parameters passed to a construction grid description function (buildfrmmeshdescriptors); the values of the construction parameters are as follows:
whether to construct rapidly (bol type): taking the value as True;
whether a simple collision (bol type) is constructed: taking the value as True;
whether CPU access is allowed (pool type): taking the value as True;
whether to use Hash as GUID (pool type): taking a value of False;
if MeshDescription (bool type) was submitted on build: taking the value as True;
it should be noted that, when the parameter value of "whether to construct quickly" is True, it is ensured that the static grid converted by the ProceduralMesh can be packed smoothly; when the parameter takes value of False, the editor code will be used without rapid build, resulting in a non-packageability.
As an embodiment, step 6 further comprises the steps of:
step 61, establishing a temporary static grid construction structure array;
step 62, adding the data of the static grid building structure body in the step 1 into the static grid building structure body array through an Emplace array;
and 63, transmitting the static grid construction structure body array and the construction parameters in the step 5 into a BuildFromMeshDescriptions method to obtain static grid body data.
As an example, the methods of the present invention may be implemented in software and/or a combination of software and hardware, for example, using Application Specific Integrated Circuits (ASICs), a general purpose computer or any other similar hardware devices.
The method of the present invention may be implemented in the form of a software program that is executable by a processor to perform the steps or functions described above. Also, the software programs (including associated data structures) may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like.
Additionally, some of the steps or functions of the methods of the present invention may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various steps or functions.
In addition, a part of the method according to the present invention may be applied as a computer program product, such as computer program instructions, which, when executed by a computer, may invoke or provide the method and/or technical solution according to the present application through the operation of the computer. The program instructions which invoke the methods of the present invention may be stored on a fixed or removable recording medium and/or transmitted via a data stream over a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions.
The present invention also provides, as an embodiment, an apparatus including a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a technical solution according to the foregoing embodiments.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are exemplary embodiments and that the acts and modules referred to are not necessarily required in this application.
Finally, it is noted that, in this document, relational terms such as first and second, and the like are 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. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of another identical element in a process, method, article, or terminal device that comprises the element.
Although the present invention has been described with reference to the preferred embodiments, it will be understood by those skilled in the art that various changes may be made and equivalents may be substituted for elements thereof without departing from the scope of the present invention.

Claims (6)

1. A method of converting ProcedurralMesh into a static grid that can be packed,
the method comprises the following steps:
step 1, obtaining a ProcedurralMesh component to be converted, and calling a BuidMeshDescription method to generate a static grid construction structural body;
step 2, judging the effectiveness of the static grid construction structure body; if the static grid construction structure is effective, generating a static grid object, and initializing the static grid object;
and 3, generating a collision body of the static grid object, wherein the specific mode is as follows:
calling a createBodySetup function of the static grid object to generate a UBodySetup structure body; calling a CreatePhysics Meshes method of the static grid object to generate Physics Meshe;
step 4, adding material data into the static grid object, which specifically comprises the following steps:
step 41, creating a temporary material array;
step 42, determining the element number of the Section array, circularly calling a GetMaterial method to transmit a circular subscript value, obtaining all the material arrays, and storing all the material arrays into the temporary material array by an Add method of the material arrays;
step 43, calling a GetStaticMaterials method of the static grid object to obtain a material array, and circularly adding elements in the temporary material array into the material array;
step 5, creating a static grid construction parameter object and setting construction parameters, wherein the values of the construction parameters are as follows:
whether the value is rapidly constructed as True; whether a simple collision value is constructed as True; whether the CPU is allowed to access and take the value as True; whether the Hash is used as the GUID value is False or not; whether the MeshDescription value is submitted to be True during construction or not;
step 6, constructing static grid volume data according to the static grid construction structure body and the construction parameters, and outputting the static grid volume data, which specifically comprises the following steps:
step 61, establishing a temporary static grid construction structure array;
step 62, adding the data of the static grid building structure body in the step 1 into the static grid building structure body array through an Emplace array;
and 63, transmitting the static grid construction structure body array and the construction parameters in the step 5 into a BuildFromMeshDescriptions method to obtain static grid body data.
2. The method of claim 1,
the static grid construction structure body is used for storing FBX file analysis data;
the data of the static mesh construction structure body is composed of one or more of vertex positions, a plurality of vertex instances, edge data, triangle data, polygon data and polygon groups.
3. The method of claim 1,
the effectiveness of the static grid construction structure body is judged by the following modes:
acquiring a polygon group in the static grid construction structural body;
if all elements in the polygon group are larger than 0, the static grid construction structural body is effective; otherwise the static grid construction structure is not valid.
4. The method of claim 1,
initializing the static grid object is accomplished by:
stopping the game thread to update the UV; re-caching FStatic MeshRenderData data; and calling the RHI command to redistribute the GUP rendering data of the current Staticmesh.
5. The method of claim 1,
in step 3, when generating the collision volume of the static grid object, directly copying and assigning simple collision volume data of collision data in the ProcedurlMeshComponent to AggGeom parameters in the UBodySetup structure.
6. An electronic device is characterized in that a first electronic component is connected to a second electronic component,
the electronic device comprises a memory and a processor; the memory having stored therein a computer program arranged to execute the method of any of claims 1-5; the processor is arranged to execute the computer program to perform the method according to any of claims 1-5.
CN202211107380.XA 2022-09-13 2022-09-13 Method for converting ProcedurralMesh into static grid capable of being packaged Active CN115185523B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211107380.XA CN115185523B (en) 2022-09-13 2022-09-13 Method for converting ProcedurralMesh into static grid capable of being packaged

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211107380.XA CN115185523B (en) 2022-09-13 2022-09-13 Method for converting ProcedurralMesh into static grid capable of being packaged

Publications (2)

Publication Number Publication Date
CN115185523A CN115185523A (en) 2022-10-14
CN115185523B true CN115185523B (en) 2022-11-25

Family

ID=83524545

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211107380.XA Active CN115185523B (en) 2022-09-13 2022-09-13 Method for converting ProcedurralMesh into static grid capable of being packaged

Country Status (1)

Country Link
CN (1) CN115185523B (en)

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180203676A1 (en) * 2015-04-09 2018-07-19 Longsand Limited Removing library objects from a static library
CN109325899B (en) * 2018-09-07 2023-04-04 格兰菲智能科技有限公司 Computer system, graphic processing unit and graphic processing method thereof
CN112337099B (en) * 2020-10-27 2024-01-12 腾讯科技(北京)有限公司 Service management method and device
CN112667234B (en) * 2020-12-22 2021-12-24 完美世界(北京)软件科技发展有限公司 Rendering pipeline creating method and device, storage medium and computing equipment

Also Published As

Publication number Publication date
CN115185523A (en) 2022-10-14

Similar Documents

Publication Publication Date Title
WO2015032282A1 (en) Method and apparatus for testing hardware performance of electronic equipment
US20120174079A1 (en) Systems and methods for simulating a mobile device application
CN103157281B (en) Display method and display equipment of two-dimension game scene
US10248581B2 (en) Guarded memory access in a multi-thread safe system level modeling simulation
US20140359430A1 (en) Animation editing
US9075666B2 (en) Deferred execution in a multi-thread safe system level modeling simulation
Vyatkin et al. A function-based approach to real-time visualization using graphics processing units
US20230410433A1 (en) Navigation mesh update
US9507693B2 (en) Method, device and computer-readable storage medium for closure testing
CN110917617A (en) Method, device and equipment for generating water ripple image and storage medium
WO2023197762A1 (en) Image rendering method and apparatus, electronic device, computer-readable storage medium, and computer program product
US10664943B2 (en) Compound shader object and use thereof
CN110069725A (en) Visualize embedded browser method and apparatus
CN111352627A (en) Page skeleton screen generation method, device, equipment and readable storage medium
CN114742928A (en) Animation rendering method and device, electronic equipment and medium
CN115185523B (en) Method for converting ProcedurralMesh into static grid capable of being packaged
Franklin An exact hidden sphere algorithm that operates in linear time
Togbenou et al. Improved spectral representation method for the simulation of stochastic wind velocity field based on FFT algorithm and polynomial decomposition
CN114065076A (en) Unity-based visualization method, system, device and storage medium
Mendes et al. IMAGO visualization System: an interactive web-based 3D visualization system for cultural heritage applications
CN111756682A (en) Game data determining method, game data acquiring method and game data acquiring device
CN116630552B (en) Optimized rendering method for large-scale three-dimensional process factory model
US20240033625A1 (en) Rendering method and apparatus for virtual scene, electronic device, computer-readable storage medium, and computer program product
CN111009025B (en) Bone animation hiding method, device and equipment
CN117785199A (en) Page layout method, device, system and medium for display equipment

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