3D character display method, medium, equipment and device

文档序号:1543583 发布日期:2020-01-17 浏览:4次 中文

阅读说明:本技术 3d文字展示方法、介质、设备及装置 (3D character display method, medium, equipment and device ) 是由 曹达宏 王译锋 于 2019-09-09 设计创作,主要内容包括:本发明公开了一种3D文字展示方法、介质、设备及装置,其中方法包括:获取用户的输入指令,以便根据所述输入指令生成对应的3D文字三维顶点数据;根据所述3D文字三维顶点数据计算3D文字的顶点与旋转中心之间的最远距离;构建以所述旋转中心为球心、所述最远距离为半径的球体;根据所述球体的半径和摄像机视角计算所述球体与摄像机的四方锥形可视空间相切时所述球心与所述摄像机视点之间的距离;并根据所述球心与所述摄像机视点之间的距离对所述摄像机进行设置,以及通过设置后的摄像机将所述3D文字投影到画布上,以对3D文字进行展示;能够防止3D文字在显示时被截断,保证3D文字的完整显示,提高用户体验,且无论文字多少,均可最大化利用画布。(The invention discloses a 3D character display method, medium, equipment and device, wherein the method comprises the following steps: acquiring an input instruction of a user so as to generate corresponding 3D character three-dimensional vertex data according to the input instruction; calculating the farthest distance between the vertex of the 3D character and the rotation center according to the three-dimensional vertex data of the 3D character; constructing a sphere with the rotation center as a sphere center and the farthest distance as a radius; calculating the distance between the sphere center and the camera viewpoint when the sphere is tangent to the square conical visual space of the camera according to the radius of the sphere and the camera visual angle; setting the camera according to the distance between the center of sphere and the viewpoint of the camera, and projecting the 3D characters onto canvas through the set camera to display the 3D characters; can prevent that the 3D characters from being cut off when showing, guarantee the complete demonstration of 3D characters, improve user experience, and no matter how many characters, all can the maximize utilize canvas.)

1. A3D character display method is characterized by comprising the following steps:

acquiring an input instruction of a user so as to generate corresponding 3D character three-dimensional vertex data according to the input instruction;

calculating the farthest distance between the vertex of the 3D character and the rotation center according to the three-dimensional vertex data of the 3D character;

constructing a sphere with the rotation center as a sphere center and the farthest distance as a radius;

calculating the distance between the sphere center and the camera viewpoint when the sphere is tangent to the square conical visual space of the camera according to the radius of the sphere and the camera visual angle; and setting the camera according to the distance between the center of sphere and the viewpoint of the camera, and projecting the 3D characters onto canvas through the set camera so as to display the 3D characters.

2. The method of 3D text presentation according to claim 1, further comprising, after calculating the distance between the center of the sphere and the viewpoint of the camera when the sphere is tangent to the quadrangular pyramid view space of the camera:

calculating the size of the canvas according to the sphere radius and the camera view angle so as to control the size of the 3D text projection by adjusting the size of the canvas.

3. The 3D text presentation method according to any one of claims 1 or 2, further comprising:

acquiring a rotation operation of a user, and acquiring a rotation angle of the viewpoint of the camera according to the rotation operation;

and calculating the coordinates of the rotated camera viewpoint according to the rotation angle and the distance between the camera viewpoint and the rotation center so as to rotate the camera through the coordinates.

4. A computer-readable storage medium, on which a 3D text presentation program is stored, the 3D text presentation program, when executed by a processor, implementing the 3D text presentation method according to any one of claims 1 to 3.

5. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, implements the 3D text presentation method according to any one of claims 1-3.

6. A3D characters display device, comprising:

the acquisition module is used for acquiring an input instruction of a user;

the generating module is used for generating corresponding 3D character three-dimensional vertex data according to the input instruction;

the calculation module is used for calculating the farthest distance between the vertex of the 3D character and the rotation center according to the three-dimensional vertex data of the 3D character;

the building module is used for building a sphere with the rotation center as a sphere center and the farthest distance as a radius;

the calculation module is further used for calculating the distance between the sphere center and the camera viewpoint when the sphere is tangent with the square conical visual space of the camera according to the radius of the sphere and the camera view angle;

and the display module is used for setting the camera according to the distance between the center of sphere and the viewpoint of the camera, and projecting the 3D characters onto canvas through the set camera so as to display the 3D characters.

7. The 3D text presentation device of claim 6, wherein the calculation module is further configured to, after calculating the distance between the center of the sphere and the viewpoint of the camera when the sphere is tangent to the square pyramid viewing space of the camera, calculate the size of the canvas based on the radius of the sphere and the angle of the camera view to control the size of the 3D text projection by adjusting the size of the canvas.

8. The 3D text presentation device according to claim 6 or 7, wherein the obtaining module is further configured to obtain a rotation operation of a user, and obtain a rotation angle of the viewpoint of the camera according to the rotation operation;

the calculation module is further configured to calculate coordinates of the rotated camera viewpoint according to the rotation angle and the distance between the camera viewpoint and the rotation center, so as to rotate the camera through the coordinates.

14页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:页面光标位置设置方法、装置、移动终端和服务器

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类