3D font realization method and terminal

文档序号:1141739 发布日期:2020-09-11 浏览:20次 中文

阅读说明:本技术 一种3d字体的实现方法及终端 (3D font realization method and terminal ) 是由 刘德建 李上杰 薛香铄 方振华 姚隽楠 郭玉湖 陈宏� 于 2020-04-17 设计创作,主要内容包括:本发明公开一种3D字体的实现方法及终端,读取2D字体文件,根据所述2D字体文件获取所述2D字体的轮廓线点集;根据所述轮廓线点集生成3D文本模型数据,根据所述3D文本模型数据生成字体数据文件,根据所述字体数据文件生成3D字体文件;读取所述3D字体文件,获取所述3D字体文件中的3D文本模型数据;根据所述3D文本模型数据渲染3D文本模型以生成3D字体;通过2D字体的轮廓线点集的整合以生成用于3D文本模型渲染的3D文本模型数据,3D文本模型数据能够方便用于对3D字体的各种设置,提高了3D字体实现上的灵活度,丰富了3D显示效果。(The invention discloses a method and a terminal for realizing a 3D font, wherein a 2D font file is read, and a contour line point set of the 2D font is obtained according to the 2D font file; generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file; reading the 3D font file, and acquiring 3D text model data in the 3D font file; rendering a 3D text model according to the 3D text model data to generate a 3D font; integration through the contour line point set of 2D typeface is in order to generate the 3D text model data that is used for 3D text model to render, and 3D text model data can conveniently be used for the various settings to the 3D typeface, has improved the flexibility ratio on the 3D typeface realizes, has richened 3D display effect.)

1. A method for realizing 3D fonts is characterized by comprising the following steps:

s1, reading a 2D font file, and acquiring a contour line point set of the 2D font according to the 2D font file;

s2, generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file;

s3, reading the 3D font file, and acquiring 3D text model data in the 3D font file;

and S4, rendering the 3D text model according to the 3D text model data to generate a 3D font.

2. The method for implementing the 3D font according to claim 1, wherein the obtaining the set of contour line points of the 2D font according to the 2D font file comprises:

obtaining font image information of the 2D font according to the 2D font file;

obtaining the contour line of the 2D font from the font image information, and determining the point set of the contour line according to the contour line;

optimizing the set of points using a Bezier curve algorithm.

3. The method for implementing 3D font according to claim 1, wherein the generating 3D text model data according to the contour line point set comprises:

generating a closed geometric region according to the contour line point set by utilizing a triangulation algorithm;

generating a front model, a back model and a side model of the 3D text according to the closed geometric area;

and generating 3D text model data according to the front model, the back model and the side model of the 3D text.

4. The method for implementing 3D font according to claim 1, wherein the step S2 further includes:

receiving skin settings for the 3D font, the skin settings including material settings, texture settings, color settings, and/or renderer settings;

generating a font skin file according to the skin setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font skin file;

the step S3 is followed by:

reading the 3D font file, and acquiring skin setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing skin setting on the 3D text model according to the skin setting of the 3D font to generate the 3D font.

5. The method for implementing 3D font according to claim 1, wherein the step S2 further includes:

receiving animation settings for the 3D font, the animation settings including keyframe animation, vertex animation, and/or UV animation;

generating a font animation file according to the animation setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font animation file;

the step S3 is followed by:

reading the 3D font file, and acquiring animation setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing animation setting on the 3D text model according to the animation setting on the 3D font to generate the 3D font.

6. A terminal for implementing 3D fonts, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:

s1, reading a 2D font file, and acquiring a contour line point set of the 2D font according to the 2D font file;

s2, generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file;

s3, reading the 3D font file, and acquiring 3D text model data in the 3D font file;

and S4, rendering the 3D text model according to the 3D text model data to generate a 3D font.

7. The terminal for implementing the 3D font according to claim 6, wherein the obtaining the set of contour line points of the 2D font according to the 2D font file comprises:

obtaining font image information of the 2D font according to the 2D font file;

obtaining the contour line of the 2D font from the font image information, and determining the point set of the contour line according to the contour line;

optimizing the set of points using a Bezier curve algorithm.

8. The terminal for implementing 3D font according to claim 6, wherein the generating 3D text model data according to the contour line point set comprises:

generating a closed geometric region according to the contour line point set by utilizing a triangulation algorithm;

generating a front model, a back model and a side model of the 3D text according to the closed geometric area;

and generating 3D text model data according to the front model, the back model and the side model of the 3D text.

9. The terminal for implementing 3D font according to claim 6, wherein the step S2 further includes:

receiving skin settings for the 3D font, the skin settings including material settings, texture settings, color settings, and/or renderer settings;

generating a font skin file according to the skin setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font skin file;

the step S3 is followed by:

reading the 3D font file, and acquiring skin setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing skin setting on the 3D text model according to the skin setting of the 3D font to generate the 3D font.

10. The terminal for implementing 3D font according to claim 6, wherein the step S2 further includes:

receiving animation settings for the 3D font, the animation settings including keyframe animation, vertex animation, and/or UV animation;

generating a font animation file according to the animation setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font animation file;

the step S3 is followed by:

reading the 3D font file, and acquiring animation setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing animation setting on the 3D text model according to the animation setting on the 3D font to generate the 3D font.

Technical Field

The invention relates to the technical field of 3D, in particular to a method and a terminal for realizing 3D fonts.

Background

In recent years, with the rapid development of computer technology, the development and application of 3D technology are going to be mature and improved continuously from the previous exploration stage. Through rapid development and wide application for many years, the 3D technology is increasingly popularized in the work and life of people, the development and the manufacture of cultural and artistic products for visual expressions such as movie and television animations, cartoons and games are realized, the design and the generation of physical products such as automobiles, airplanes, household appliances and furniture are realized, and the simulation of virtual reality for human-environment interaction are realized. Specifically, the system comprises a 3D software industry, a 3D hardware industry, a digital entertainment industry, a manufacturing industry, a building industry, virtual reality, a Geographic Information System (GIS), a 3D internet and the like.

With the remarkable improvement of the performance of hardware such as a CPU, an internal memory, a display card and the like of a modern computer, the computing capability, the rendering capability and the storage capability of the modern computer are greatly developed, so that a foundation is laid for the traditional application to span to the 3D application, and in order to improve the daily office experience of a user, in the process that the user uses office software, a 3D figure, such as artistic characters, can be regarded as a 3D font, or the three-dimensional font is realized through a PS technology, and the evolution from the traditional font to the 3D font is realized, however, the flexibility of the existing 3D font is not high, and the 3D effect is single.

Disclosure of Invention

The technical problem to be solved by the invention is as follows: the 3D font realization method and the terminal are provided, the flexibility of 3D font realization is improved, and the 3D display effect is enriched.

In order to solve the technical problems, the invention adopts a technical scheme that:

a method for realizing 3D fonts comprises the following steps:

s1, reading a 2D font file, and acquiring a contour line point set of the 2D font according to the 2D font file;

s2, generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file;

s3, reading the 3D font file, and acquiring 3D text model data in the 3D font file;

and S4, rendering the 3D text model according to the 3D text model data to generate a 3D font.

In order to solve the technical problem, the invention adopts another technical scheme as follows:

a terminal for implementing 3D fonts, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:

s1, reading a 2D font file, and acquiring a contour line point set of the 2D font according to the 2D font file;

s2, generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file;

s3, reading the 3D font file, and acquiring 3D text model data in the 3D font file;

and S4, rendering the 3D text model according to the 3D text model data to generate a 3D font.

The invention has the beneficial effects that: through the contour line point set that acquires the 2D typeface, generate 3D text model data according to the contour line point set, generate 3D typeface file according to 3D text model data, when generating the 3D typeface, directly read 3D typeface file, it carries out the rendering of 3D text model with generating the 3D typeface to acquire 3D text model data wherein, integration in order to generate the 3D text model data that is used for 3D text model rendering through the contour line point set of 2D typeface, 3D text model data can conveniently be used for the various settings to the 3D typeface, the flexibility that the 3D typeface realized has been improved, 3D display effect has been enriched.

Drawings

FIG. 1 is a flowchart illustrating steps of a method for implementing a 3D font according to an embodiment of the present invention;

fig. 2 is a schematic structural diagram of a 3D font implementing terminal according to an embodiment of the present invention;

FIG. 3 is a first schematic diagram illustrating Bezier curve algorithm optimization on a point set of a font according to an embodiment of the present invention;

FIG. 4 is a second schematic diagram of optimizing a Bezier curve algorithm on a point set of a font according to an embodiment of the present invention;

FIG. 5 is a schematic diagram of a closed geometric region generated by a triangulation algorithm according to a set of contour line points according to an embodiment of the present invention;

FIG. 6 is a diagram illustrating implementation of keyframe animation settings, in accordance with an embodiment of the present invention;

FIG. 7 is a flowchart illustrating steps for generating a 3D font from a 3D font file according to an embodiment of the present invention;

description of reference numerals:

1. A3D font realization terminal; 2. a memory; 3. a processor.

Detailed Description

In order to explain technical contents, achieved objects, and effects of the present invention in detail, the following description is made with reference to the accompanying drawings in combination with the embodiments.

Referring to fig. 1, a method for implementing a 3D font includes the steps of:

s1, reading a 2D font file, and acquiring a contour line point set of the 2D font according to the 2D font file;

s2, generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file;

s3, reading the 3D font file, and acquiring 3D text model data in the 3D font file;

and S4, rendering the 3D text model according to the 3D text model data to generate a 3D font.

As can be seen from the above description, the beneficial effects of the present invention are: through the contour line point set that acquires the 2D typeface, generate 3D text model data according to the contour line point set, generate 3D typeface file according to 3D text model data, when generating the 3D typeface, directly read 3D typeface file, it carries out the rendering of 3D text model with generating the 3D typeface to acquire 3D text model data wherein, integration in order to generate the 3D text model data that is used for 3D text model rendering through the contour line point set of 2D typeface, 3D text model data can conveniently be used for the various settings to the 3D typeface, the flexibility that the 3D typeface realized has been improved, 3D display effect has been enriched.

Further, the obtaining of the contour line point set of the 2D font according to the 2D font file includes:

obtaining font image information of the 2D font according to the 2D font file;

obtaining the contour line of the 2D font from the font image information, and determining the point set of the contour line according to the contour line;

optimizing the set of points using a Bezier curve algorithm.

According to the description, the contour line is obtained based on the font image information of the 2D font, the point set is determined according to the contour line, meanwhile, the point set is optimized through the Bezier curve algorithm to form the final contour line point set of the 2D font, the fineness degree of the point set can be optimized, and the presenting effect of the 3D font is further improved.

Further, the generating 3D text model data according to the contour line point set includes:

generating a closed geometric region according to the contour line point set by utilizing a triangulation algorithm;

generating a front model, a back model and a side model of the 3D text according to the closed geometric area;

and generating 3D text model data according to the front model, the back model and the side model of the 3D text.

It can be known from the above description that a closed geometric region is generated first based on a contour line point set, then a front model, a back model and a side model of a 3D text are generated based on the closed geometric region, and then the front model, the back model and the side model of the 3D text are combined to form 3D text model data, so that the generated 3D font is ensured to be stereoscopic, and the 3D effect is better.

Further, the step S2 further includes:

receiving skin settings for the 3D font, the skin settings including material settings, texture settings, color settings, and/or renderer settings;

generating a font skin file according to the skin setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font skin file;

the step S3 is followed by:

reading the 3D font file, and acquiring skin setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing skin setting on the 3D text model according to the skin setting of the 3D font to generate the 3D font.

According to the description, the generated 3D font can be set in aspects of material, texture, color and/or rendering mode through skin setting, and the display effect of the 3D font is further enriched.

Further, the step S2 further includes:

receiving animation settings for the 3D font, the animation settings including keyframe animation, vertex animation, and/or UV animation;

generating a font animation file according to the animation setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font animation file;

the step S3 is followed by:

reading the 3D font file, and acquiring animation setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing animation setting on the 3D text model according to the animation setting on the 3D font to generate the 3D font.

As can be seen from the above description, the animation setting can perform setting of aspects such as key frame animation, vertex animation, and/or UV animation on the generated 3D font, so that the 3D font has a dynamic display effect, and the display effect of the 3D font is further enriched.

Referring to fig. 2, a terminal for implementing a 3D font includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the following steps when executing the computer program:

s1, reading a 2D font file, and acquiring a contour line point set of the 2D font according to the 2D font file;

s2, generating 3D text model data according to the contour line point set, generating a font data file according to the 3D text model data, and generating a 3D font file according to the font data file;

s3, reading the 3D font file, and acquiring 3D text model data in the 3D font file;

and S4, rendering the 3D text model according to the 3D text model data to generate a 3D font.

As can be seen from the above description, the beneficial effects of the present invention are: through the contour line point set that acquires the 2D typeface, generate 3D text model data according to the contour line point set, generate 3D typeface file according to 3D text model data, when generating the 3D typeface, directly read 3D typeface file, it carries out the rendering of 3D text model with generating the 3D typeface to acquire 3D text model data wherein, integration in order to generate the 3D text model data that is used for 3D text model rendering through the contour line point set of 2D typeface, 3D text model data can conveniently be used for the various settings to the 3D typeface, the flexibility that the 3D typeface realized has been improved, 3D display effect has been enriched.

Further, the obtaining of the contour line point set of the 2D font according to the 2D font file includes:

obtaining font image information of the 2D font according to the 2D font file;

obtaining the contour line of the 2D font from the font image information, and determining the point set of the contour line according to the contour line;

optimizing the set of points using a Bezier curve algorithm.

According to the description, the contour line is obtained based on the font image information of the 2D font, the point set is determined according to the contour line, meanwhile, the point set is optimized through the Bezier curve algorithm to form the final contour line point set of the 2D font, the fineness degree of the point set can be optimized, and the presenting effect of the 3D font is further improved.

Further, the generating 3D text model data according to the contour line point set includes:

generating a closed geometric region according to the contour line point set by utilizing a triangulation algorithm;

generating a front model, a back model and a side model of the 3D text according to the closed geometric area;

and generating 3D text model data according to the front model, the back model and the side model of the 3D text.

It can be known from the above description that a closed geometric region is generated first based on a contour line point set, then a front model, a back model and a side model of a 3D text are generated based on the closed geometric region, and then the front model, the back model and the side model of the 3D text are combined to form 3D text model data, so that the generated 3D font is ensured to be stereoscopic, and the 3D effect is better.

Further, the step S2 further includes:

receiving skin settings for the 3D font, the skin settings including material settings, texture settings, color settings, and/or renderer settings;

generating a font skin file according to the skin setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font skin file;

the step S3 is followed by:

reading the 3D font file, and acquiring skin setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing skin setting on the 3D text model according to the skin setting of the 3D font to generate the 3D font.

According to the description, the generated 3D font can be set in aspects of material, texture, color and/or rendering mode through skin setting, and the display effect of the 3D font is further enriched.

Further, the step S2 further includes:

receiving animation settings for the 3D font, the animation settings including keyframe animation, vertex animation, and/or UV animation;

generating a font animation file according to the animation setting;

the generating of the 3D font file according to the font data file includes:

generating a 3D font file according to the font data file and the font animation file;

the step S3 is followed by:

reading the 3D font file, and acquiring animation setting of the 3D font in the 3D font file;

the step S4 further includes:

and performing animation setting on the 3D text model according to the animation setting on the 3D font to generate the 3D font.

As can be seen from the above description, the animation setting can perform setting of aspects such as key frame animation, vertex animation, and/or UV animation on the generated 3D font, so that the 3D font has a dynamic display effect, and the display effect of the 3D font is further enriched.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种从合同简体迁移到繁体的光学字符联合训练及识别方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!