CN107918646B - A kind of three-dimensional modeling data processing method and processing device based on protocol mode - Google Patents

A kind of three-dimensional modeling data processing method and processing device based on protocol mode Download PDF

Info

Publication number
CN107918646B
CN107918646B CN201711091692.5A CN201711091692A CN107918646B CN 107918646 B CN107918646 B CN 107918646B CN 201711091692 A CN201711091692 A CN 201711091692A CN 107918646 B CN107918646 B CN 107918646B
Authority
CN
China
Prior art keywords
data
vertex
face
model
grouping information
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
CN201711091692.5A
Other languages
Chinese (zh)
Other versions
CN107918646A (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.)
Zhuhai Baifeng Network Technology Co Ltd
Original Assignee
Zhuhai Baifeng Network 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 Zhuhai Baifeng Network Technology Co Ltd filed Critical Zhuhai Baifeng Network Technology Co Ltd
Priority to CN201711091692.5A priority Critical patent/CN107918646B/en
Publication of CN107918646A publication Critical patent/CN107918646A/en
Application granted granted Critical
Publication of CN107918646B publication Critical patent/CN107918646B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse files

Abstract

The present invention provides a kind of highly efficient data processing method and device, storage order and storage content are defined by way of agreement, use binary storage data, only retain most important grid data, some invalid data are rejected, and achieve the effect that compressed data by way of memory space dynamic allocation.The technical scheme is that a kind of three-dimensional modeling data processing method based on protocol mode, comprising: coding step encodes model file data, is divided into model file head, grouping information and grid data;Compression step parses three-dimensional model gridding data, and the model face data after parsing is converted to gore data, and dynamic arranges standard geometric data and data texturing and rejects invalid data, re-writes grouping information and grid data.

Description

A kind of three-dimensional modeling data processing method and processing device based on protocol mode
Technical field
The present invention relates to the processing methods of three-dimensional modeling data coding and compression, belong to the technology of three-dimensional graphics images processing Field.
Background technique
, often there are several apparent defects in commonly used threedimensional model format such as obj, dae etc. on the market, first is that They are all plain text formats, so that seldom data need to provide a large amount of space and stored, second is that plain text leads to text Part parsing needs to expend more times, third is that redundant data is relatively more.This model is not easy to directly in transmission over networks, past It is previously downloaded to the enterprising enforcement use of user computer in the application toward needing to be packaged in advance.
In practical applications, have and much need the demand of real-time loading threedimensional model, such as be presented three on the website WebGL When dimension module, this requires the sizes of model must lack as far as possible, to prevent user in access because the load time is too long And lead to poor user experience.
Summary of the invention
The present invention provides a kind of highly efficient data processing method, defined by way of agreement storage order and Storage content only retains most important grid data using binary storage data, rejects some invalid data, and lead to The mode for crossing memory space dynamic allocation achievees the effect that compressed data.
On the one hand technical solution of the present invention is a kind of three-dimensional modeling data processing method based on protocol mode.This method Include:
Coding step encodes model file data, is divided into model file head, grouping information and grid data;
Compression step parses three-dimensional model gridding data, the model face data after parsing is converted to gore data, Dynamic arranges standard geometric data and data texturing and rejects invalid data, re-writes grouping information and grid data.
Further, in the coding step: model file head includes format version number, marshalling number, whether enables ring Border light covers channel, each grouping information the space occupied;Grouping information includes group names, grouping vertex data start bit Set, normal data initial position, texture coordinate initial position, environment light masking channel texture coordinate initial position, vertex number, Face number, each face data occupy byte number;Grid data includes vertex, normal, texture coordinate and the face data of all groupings, And it is indexed by grouping information.
Further, the compression step reads library tool including the use of threedimensional model and solves to the model file of coding Analysis, obtains the grid data of model, and it includes Assimp open source library which, which reads library tool,.
Further, the compression step includes: to unify to convert triangle for the face of quadrangle of model or the face of polygon Shape face;The grid data of arrangement standard is simultaneously stored in array, then precalculates data volume;Judge whether file has environment Light covers texture coordinate channel, has and then stores the related data of environment light masking channel texture coordinate into array.
Further, in the compression step, write-in grouping information includes: the vertex data since first marshalling Initial position be file header and grouping information occupied space sum, wherein File header information occupied space is recorded as Hsize, Marshalling number is denoted as Gcount, single grouping information length is denoted as Gsize, first marshalling vertex data initial position is denoted as Pbegin, Then Pbegin=Gcount×Gsize+Hsize;Vertex data number is the length of the grouping vertex data array, is denoted as Pcount;When Each vertex data is one by x, y, z, the three-dimensional vector of composition, and each value occupies 4 bytes, and thus vertex data accounts for Space is Psize=Pcount×3×4;The data start of normal is Nbegin=Pbegin+Pcount+Psize;The number of normal It is consistent according to the data amount check of number, the data amount check on vertex and texture coordinate, is unified for Pcount;Normal data is equally It is made of a three-dimensional vector, the initial position of texture coordinate data is Ubegin=Nbegin+Psize;Texture coordinate is a two dimension Vector composition, then the initial position of face data is Fbegin=Ubegin+Pcount×2×4;Grouping information is written one by one, until all New file is written in marshalling.
Further, dynamically changing the occupied byte number of face data when arranging grid data;For each face data Record defines the index on three vertex;When vertex data number is less than 215, the space of two bytes just indicates all face ropes enough When drawing, the space of two bytes is distributed to each face data;Otherwise the space of nybble is distributed.
Technical solution of the present invention second aspect is a kind of three-dimensional modeling data processing unit based on protocol mode, packet Include: coding module is divided into model file head, grouping information and grid data for encoding model file data;Compression Model face data after parsing is converted to gore data, dynamic arranges for parsing three-dimensional model gridding data by module Standard geometric data and data texturing and invalid data is rejected, re-writes grouping information and grid data.
Further, the compression module includes: the first submodule, face or polygon for the unified quadrangle by model Face be converted into gore;Then second submodule is counted in advance for arranging the grid data of standard and being stored in array Calculate data volume;Third submodule has for judging whether file has environment light masking texture coordinate channel, environment light is hidden The related data for covering channel texture coordinate is stored into array.
The technical solution of the present invention third aspect is a kind of three-dimensional modeling data processing unit based on protocol mode, packet It includes: memory, storage instruction;Processor realizes the above method for executing the instruction.
Technical solution of the present invention fourth aspect is a kind of computer readable storage medium, is stored thereon with computer journey Sequence, the program realize the above method when being executed by processor.
The beneficial effects of the present invention are: by model meshes data with compact binary form storage, and by dynamic State change the occupied byte number of face data, reach reduction data space, thus enable model rapidly in internet into Row transmission, parsing, improve the access speed of Web site.
Beneficial effects of the present invention also reside in: first is that using binary storage mode, so that the utilization rate of file is higher, Make less hard-disk capacity occupied by identical data;Second is that the space of face data storage is modified by dynamic, so that model volume It is smaller;Third is that being stored in a binary fashion, it is easier to parse than text storage.
Detailed description of the invention
Fig. 1 is main flow block diagram according to the method for the present invention;
Fig. 2 is the model file data structure schematic diagram of middle coding step process according to the method for the present invention;
Fig. 3 is compression step flow chart according to the method for the present invention.
Specific embodiment
It is carried out below with reference to technical effect of the embodiment and attached drawing to design of the invention, specific structure and generation clear Chu, complete description, to be completely understood by the purpose of the present invention, scheme and effect.It should be noted that the case where not conflicting Under, the features in the embodiments and the embodiments of the present application can be combined with each other.
Fig. 1 show the main flow block diagram of method of the invention.Main according to the method for the present invention includes coding and compression Two major parts.It is described in greater detail below by some embodiments.
1, the three-dimensional model gridding data-encoding scheme based on agreement
Model file data are divided into three parts by this method: model file head, grouping information, grid data (marshalling 1 ... Organize into groups N), as shown in Figure 2.
(1) model file head
Comprising format version number, marshalling number, whether enable the channel AO, a grouping information the space occupied.Model head File specific coding mode is as follows:
VERSION: the first 4 byte, storage model format version number
GROUP_COUNT: the second 4 byte, the number of storage model marshalling
HAS_AO: 4 bytes of third, whether storage model, which has the relevant texture of Ambient Occlusion Map, is sat Mark channel
GROUP_INFO_SIZE: the four 4 byte stores the occupied space size of grouping information, to facilitate not To extend
(2) grouping information
It includes group names, grouping vertex data initial position, normal data initial position, the texture coordinate start bit It sets, the channel AO texture coordinate initial position, vertex number, face number, a face data occupies byte.
Each marshalling has grouping information, for recording the position of marshalling title and marshals data storage within the data block, Its data structure is as follows:
NAME: occupying 20 bytes, and for storing marshalling noun, therefore 20 bytes cannot be greater than by organizing into groups title, otherwise can be cut It is disconnected
POSITION_BEGIN: occupying 4 bytes, indicates vertex data in the initial position of data block
NORMAL_BEGIN: occupying 4 bytes, indicates normal data in the initial position of data block
UV_BEGIN: occupying 4 bytes, indicates texture coordinate data in the initial position of data block
UV2_BEGIN: occupying 4 bytes, indicates the data of Ambient Occlusion Map texture coordinate in data block Initial position
FACE_BEGIN: occupying 4 bytes, indicates face data in the initial position of data block
POSITION_COUNT: 4 bytes are occupied, indicate the quantity on the marshalling vertex
FACE_COUNT: 4 bytes are occupied, indicate the quantity in the marshalling face
FACE_SIZE: occupying 4 bytes, indicate the occupied byte number of marshalling face data individual data, if marshalling institute The model data face number of expression is less than UINT16_MAX, and then FACE_SIZE is equal to 2, is otherwise equal to 4.
(3) grid data
This part includes the vertex of all groupings, normal, texture coordinate, face data, and is indexed by grouping information.
2, three-dimensional model gridding data compression process
In embodiment as shown in Figure 3, include the following steps according to the method for the present invention.
Step S1: carrying out file format judgement to the model file of input, see whether for threedimensional model format (obj, Dae etc.) or whether according to above-described embodiment carried out coding.
Step S2: Current Model File parsing.
The present invention parses Current Model File using assimp, obtain the vertex of model, normal, texture coordinate, The data such as face index, material information.
Step S3: model face data conversion.
Whether judgment models face is triangle.Subsequent processing and storage for convenience, the present invention are unified by the four of model The face of side shape or the face of polygon are converted into gore.
Step S4: normal data arranges.
The data such as vertex, normal, texture coordinate, face are stored in array, calculate data volume to make subsequent use.
Step S5: environment light covers (Ambient Occlusion, AO) channel data and arranges
Judge whether file has ao texture coordinate channel, has then by the storage of AO texture coordinate related data into array.
Step S6: write-in file header
By version number, marshals data, if enable the channel AO, file is written in the information such as single grouping information occupied space.
Step S7: write-in grouping information
Grouping information, which records, organizes into groups the storage location of relevant data within the data block, by recording each middle data Initial position and data amount check, to be taken out data from data block when resolution file.
Since first marshalling, the initial position of vertex data is the sum of file header and grouping information occupied space, File header information occupied space is recorded as Hsize, marshalling number is denoted as Gcount, single grouping information length extremely Gsize, first A marshalling vertex data initial position is denoted as Pbegin, then:
Pbegin=Gcount×Gsize+Hsize
Vertex data number is the length of the grouping vertex data array, is denoted as Pcount
Since each vertex data is one by x, y, z, the three-dimensional vector of composition, and each value occupies 4 bytes, because This vertex data the space occupied are as follows:
Psize=Pcount×3×4
The data start of normal are as follows:
Nbegin=Pbegin+Pcount+Psize
The data amount check of the data amount check of normal and the data amount check on vertex and texture coordinate is consistent, in order to save Memory space does not record the data amount check of normal, texture coordinate, unified to use Pcount
Normal data is equally made of a three-dimensional vector, therefore the initial position of texture coordinate data is
Ubegin=Nbegin+Psize
Texture coordinate is a bivector composition, therefore the initial position of face data is
Fbegin=Ubegin+Pcount×2×4。
It should be noted that the number in face and vertex are inconsistent, value is the array length of face data, is denoted as Fcount.? In the present invention, the space occupied of face data is variable.Because what each face data recorded is the index on 3 vertex, because The value in this face is in a limited space, when vertex data number is less than 215, i.e., the space of 2 bytes just indicates all enough When face indexes, it is only necessary to which therefore the space for distributing 2 bytes to each face data needs exist for opposite vertexes data and judged, such as Fruit vertex data number is less than or equal to 215Then single face data occupied space is 2 bytes, and otherwise occupied space is 4 bytes.
The foregoing describe first organize into groups associated information calculation method, and so on can calculate each marshalling Information.
Step S8: write-in grid data
The data such as vertex, normal, texture coordinate, face are written to specific position according to position as defined in above-mentioned grouping information It sets.
It should be appreciated that the embodiment of the present invention can be by computer hardware, the combination of hardware and software or by depositing The computer instruction in non-transitory computer-readable memory is stored up to be effected or carried out.Standard volume can be used in the method Journey technology-includes that the non-transitory computer-readable storage media configured with computer program is realized in computer program, In configured in this way storage medium make computer operated in a manner of specific and is predefined-according to describing in a particular embodiment Method and attached drawing.Each program can be realized with the programming language of level process or object-oriented with logical with computer system Letter.However, if desired, the program can be realized with compilation or machine language.Under any circumstance, the language can be compiling or The language of explanation.In addition, the program can be run on the specific integrated circuit of programming for this purpose.
Further, this method can be realized in being operably coupled to suitable any kind of computing platform, including But it is not limited to PC, mini-computer, main frame, work station, network or distributed computing environment, individual or integrated It computer platform or is communicated with charged particle tool or other imaging devices etc..Each aspect of the present invention can be with storage No matter machine readable code on non-transitory storage medium or equipment is moveable or is integrated to calculate and put down to realize Platform, such as hard disk, optically read and/or write-in storage medium, RAM, ROM, so that it can be read by programmable calculator, when depositing Storage media or equipment can be used for configuration and operation computer to execute process described herein when being read by computer.In addition, Machine readable code, or part thereof can be transmitted by wired or wireless network.When such media include in conjunction with microprocessor or When other data processors realize the instruction or program of steps described above, invention as described herein includes that these and other are different The non-transitory computer-readable storage media of type.When methods and techniques according to the present invention programming, the present invention is also Including computer itself.
Computer program can be applied to input data to execute function as described herein, to convert input data with life At storing to the output data of nonvolatile memory.Output information can also be applied to one or more output equipments as shown Device.In the preferred embodiment of the invention, the data of conversion indicate physics and tangible object, including the object generated on display Reason and the particular visual of physical objects are described.

Claims (6)

1. a kind of three-dimensional modeling data processing method based on protocol mode, characterized by comprising:
Coding step encodes model file data, is divided into model file head, grouping information and grid data;
Compression step parses three-dimensional model gridding data, the model face data after parsing is converted to gore data, dynamic Arrangement standard geometric data and data texturing and invalid data is rejected, re-writes grouping information and grid data;
Wherein, in the coding step:
Model file head includes format version number, marshalling number, whether enables environment light masking channel, each grouping information occupancy Space;
Grouping information includes group names, grouping vertex data initial position, normal data initial position, texture coordinate start bit It sets, environment light masking channel texture coordinate initial position, vertex number, face number, each face data occupancy byte number;
Grid data includes vertex, normal, texture coordinate and the face data of all groupings, and carries out rope by grouping information Draw;And
In the compression step, write-in grouping information includes:
Since first marshalling, the initial position of vertex data is the sum of file header and grouping information occupied space, wherein File header information occupied space is recorded as Hsize, marshalling number is denoted as Gcount, single grouping information length is denoted as Gsize, first A marshalling vertex data initial position is denoted as Pbegin, then Pbegin=Gcount×Gsize+Hsize
Vertex data number is the length of the grouping vertex data array, is denoted as Pcount
When each vertex data is one by x, the three-dimensional vector of y, z composition, and each value 4 bytes of occupancy, thus vertex Data the space occupied is Psize=Pcount×3×4;
The data start of normal is Nbegin=Pbegin+Pcount+Psize
The data amount check of the data amount check of normal, the data amount check on vertex and texture coordinate is consistent, and is unified for Pcount
Normal data is equally made of a three-dimensional vector, and the initial position of texture coordinate data is Ubegin=Nbegin+Psize
Texture coordinate is a bivector composition, then the initial position of face data is Fbegin=Ubegin+Pcount×2×4;
Grouping information is written one by one, until new file is written in all marshallings.
2. the three-dimensional modeling data processing method according to claim 1 based on protocol mode, which is characterized in that the pressure Contracting step reads library tool including the use of threedimensional model and parses to the model file of coding, obtains the grid data of model, It includes Assimp open source library that the threedimensional model, which reads library tool,.
3. the three-dimensional modeling data processing method according to claim 1 based on protocol mode, which is characterized in that the pressure Contracting step includes:
It is unified to convert gore for the face of quadrangle of model or the face of polygon;
The grid data of arrangement standard is simultaneously stored in array, then precalculates data volume;
Judge whether file has environment light masking texture coordinate channel, has the correlation of environment light masking channel texture coordinate then Data are stored into array.
4. the three-dimensional modeling data processing method according to claim 1 based on protocol mode, which is characterized in that the pressure Contracting step further comprises:
The occupied byte number of face data is dynamically changed when arranging grid data;
The index for defining three vertex is recorded for each face data;
When vertex data number just indicates all faces index less than the space of 215, two bytes enough, to each face data point Space with two bytes;Otherwise the space of nybble is distributed.
5. a kind of three-dimensional modeling data processing unit based on protocol mode, characterized by comprising: memory, storage refer to It enables;Processor, for executing described instruction to realize any one of claim 1-4 the method.
6. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor Any one of claim 1-4 the method is realized when row.
CN201711091692.5A 2017-11-08 2017-11-08 A kind of three-dimensional modeling data processing method and processing device based on protocol mode Active CN107918646B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711091692.5A CN107918646B (en) 2017-11-08 2017-11-08 A kind of three-dimensional modeling data processing method and processing device based on protocol mode

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711091692.5A CN107918646B (en) 2017-11-08 2017-11-08 A kind of three-dimensional modeling data processing method and processing device based on protocol mode

Publications (2)

Publication Number Publication Date
CN107918646A CN107918646A (en) 2018-04-17
CN107918646B true CN107918646B (en) 2019-07-02

Family

ID=61896087

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711091692.5A Active CN107918646B (en) 2017-11-08 2017-11-08 A kind of three-dimensional modeling data processing method and processing device based on protocol mode

Country Status (1)

Country Link
CN (1) CN107918646B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109345628A (en) * 2018-08-07 2019-02-15 云南电网有限责任公司曲靖供电局 A kind of model light-weight technologg method, apparatus and electronic equipment
CN111324587A (en) * 2018-12-14 2020-06-23 北京京东尚科信息技术有限公司 Compression method, analysis method and system for data of OBJ file
CN111583348B (en) * 2020-05-09 2024-03-29 维沃移动通信有限公司 Image data encoding method and device, image data displaying method and device and electronic equipment
CN112162957B (en) * 2020-10-13 2022-05-27 中国空气动力研究与发展中心计算空气动力研究所 Multi-block structure grid data compression storage method, decompression method and device
CN114693817A (en) * 2022-04-13 2022-07-01 广州柏视医疗科技有限公司 Compression and decompression method of 3D grid model

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101123000B (en) * 2007-07-05 2010-06-23 广东中大讯通软件科技有限公司 Three-dimensional graphic data compression processing method
CN102255930B (en) * 2010-05-21 2014-04-02 国际商业机器公司 Method and system for providing scene data of virtual world
CN104094317A (en) * 2012-01-21 2014-10-08 汤姆逊许可公司 Method and apparatus for compressing texture information of three-dimensional (3d) models
US8712179B2 (en) * 2012-08-17 2014-04-29 Disney Enterprises, Inc. Reconstruction of deforming surfaces by canceling ambient occlusion and refining 3-D shape

Also Published As

Publication number Publication date
CN107918646A (en) 2018-04-17

Similar Documents

Publication Publication Date Title
CN107918646B (en) A kind of three-dimensional modeling data processing method and processing device based on protocol mode
CN109658484A (en) A kind of Automatic Generation of Computer Animation method and Automatic Generation of Computer Animation system
US9245383B2 (en) Accelerated three-dimensional intersection testing using compressed volumes
CN110245368A (en) A kind of the structuring processing and storage method of BIM data
CN109389661B (en) Animation file conversion method and device
CN113255051B (en) Method and device for lightening large-volume BIM (building information modeling) model
CN108597032B (en) Method and system for importing building information model into Unity3D for display
CN105512265A (en) Method and device for displaying data through figure
CN108460056A (en) Method for converting effective graphic elements of DXF file into JSON data
CN110908697A (en) Resource packaging method, device, server and storage medium
CN112260694B (en) Data compression method of simulation file
CN109885301B (en) Method, device, storage medium and equipment for generating scalable vector graphics
CN108292447B (en) Method and terminal device for generating three-dimensional model
Blut et al. CityGML goes mobile: application of large 3D CityGML models on smartphones
Pan et al. A novel hdf-based data compression and integration approach to support bim-gis practical applications
CN113485548B (en) Model loading method and device of head-mounted display equipment and head-mounted display equipment
Terrace et al. Unsupervised conversion of 3D models for interactive metaverses
JP2005149209A5 (en)
CN106610824A (en) Page height self-adaptation method and apparatus
Stolte et al. Parallel spatial enumeration of implicit surfaces using interval arithmetic for octree generation and its direct visualization
CN104183006A (en) Dynamic mapping method based on Web3D model
JP7368623B2 (en) Point cloud processing method, computer system, program and computer readable storage medium
CN113781658A (en) Method and device for processing 3D model data in streaming mode
KR20140030229A (en) Mesh sequence file format
CN108304524B (en) The lightweight webpage method for visualizing and system of extensive fire dynamic smog field

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
CP02 Change in the address of a patent holder
CP02 Change in the address of a patent holder

Address after: Room 411, building 18, Hengqin Macau Youth Entrepreneurship Valley, No. 1889, Huandao East Road, Hengqin New District, Zhuhai City, Guangdong Province

Patentee after: ZHUHAI BEFASH NETWORK TECHNOLOGY Co.,Ltd.

Address before: 519000 Mei Hua Dong Road, Xiangzhou District, Zhuhai, Guangdong Province, No. 491

Patentee before: ZHUHAI BEFASH NETWORK TECHNOLOGY Co.,Ltd.