CN106355635A - Method and device for displaying sky sphere in game scene - Google Patents
Method and device for displaying sky sphere in game scene Download PDFInfo
- Publication number
- CN106355635A CN106355635A CN201610771971.5A CN201610771971A CN106355635A CN 106355635 A CN106355635 A CN 106355635A CN 201610771971 A CN201610771971 A CN 201610771971A CN 106355635 A CN106355635 A CN 106355635A
- Authority
- CN
- China
- Prior art keywords
- ball
- sky
- sphere
- model
- triangle
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/08—Volume rendering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/04—Texture mapping
Abstract
An embodiment of the invention discloses a method and a device for displaying a sky sphere in the game scene. The method comprises the steps as follows: the radius of the sky sphere is determined on the basis of a predetermined game visual field range, and a regular icosahedron model with vertex located on the spherical surface determined according to the radius of the sky sphere is built; each triangle of the regular icosahedron model is subjected to repeated recursion subdivision, and a sphere model is formed, wherein each recursion subdivision includes steps that splitting is performed from the middle point of each edge of each triangle, and plane coordinates of the split point are mapped to the spherical surface; texture mapping is performed on the sphere model, so that the sky sphere is generated and is displayed in a screen through perspective projection. According to the embodiment, the sphere model is formed on the basis of the regular icosahedron through recursion subdivision and is enabled to have uniform texture density, more consumption of the texture size is reduced, more consumption is reduced in terms of texture size, and the memory space can be reduced.
Description
Technical field
The present invention relates to graphics art, particularly to a kind of method showing sky ball in scene of game and dress
Put.
Background technology
The development advanced by leaps and bounds with computer soft and hardware, computer graphicss industry-by-industry application also obtain fast
Speed is popularized and is goed deep into.At present, oneself entrance of the computer graphicss three-dimensional epoch, 3-D graphic is omnipresent around people.Science
Calculation visualization, computer animation and virtual reality have become as three big hot topic topics of computer graphicss in recent years, and this
The technological core of three big hot topic topics is 3-D graphic.
Sky is an important part in current Graphics engine setting work, by it can expression time, weather, mould
Atmosphere etc..At present, the method for display sky includes day sylphon and two kinds of sky ball.
Traditional sky ball, using through parallel division methods, has south poles and equatorial portion.However, through parallel division side
In method, in corresponding texture mapping, the texture density of whole sphere is skimble-scamble.It is excessive in south poles texure density,
Have packing phenomenon, texure density is too small under the line, have stretching phenomenon.
Fig. 1 is based on the sphere model generating through parallel division methods in prior art.As seen from Figure 1, because texture is close
Degree is uneven, thus results in video card load excessive.
Content of the invention
In view of this, it is an object of the invention to provide a kind of method and apparatus showing sky ball in scene of game, carry
High texture density uniformity, thus reduce video card load.
A kind of method showing sky ball in scene of game, the method includes:
The sky radius of a ball is determined based on predetermined game field range, and sets up summit and be located at by this sky radius of a ball institute really
Regular dodecahedron model on fixed sphere;
Each triangle for described regular dodecahedron model executes multiple recursion to form sphere model, its
In every time recursion include: split in the midpoint of each edge of triangle, and the plane coordinates of split point be mapped to ball
On face;
For sphere model execution texture mapping to generate sky ball, and described sky is shown in perspective projection in screen
Ball.
In one embodiment, described multiple recursion is: four recursions.
In one embodiment, the midpoint of the described each edge in triangle splits, and the plane of split point is sat
Mark is mapped to and includes on sphere:
For each triangle, split in the midpoint of each edge and calculate the plane coordinates at midpoint, and by plane coordinates
Represented vector carries out unitization;
Described vector is multiplied by the sky radius of a ball, plane coordinates is mapped to as summit true based on the described sky radius of a ball
On fixed sphere.
In one embodiment, included with generating sky ball for sphere model execution texture mapping:
Execute the texture mapping of 512 × 512 resolution for sphere model to generate sky ball.
A kind of device showing sky ball in scene of game, this device includes:
Model building module, for determining the sky radius of a ball based on predetermined game field range, and sets up summit and is located at
By the regular dodecahedron model on this sphere determined by sky radius of a ball;
Recurrence module, executes multiple recursion with shape for each triangle for described regular dodecahedron model
Become sphere model, wherein recursion includes every time: split in the midpoint of each edge of triangle, and the plane by split point
Coordinate is mapped on sphere;
Display module, for executing texture mapping to generate sky ball for sphere model, and perspective projection in screen
Show described sky ball.
In one embodiment, described multiple recursion is: four recursions.
In one embodiment, recurrence module, for for each triangle, splitting in the midpoint of each edge and counting
Calculate the plane coordinates at midpoint, and the vector represented by plane coordinates is carried out unitization;Described vector is multiplied by the sky radius of a ball,
Plane coordinates is mapped on the sphere based on the determination of the described sky radius of a ball as summit.
In one embodiment, display module, for executing the texture patch of 512 × 512 resolution for sphere model
Figure is to generate sky ball.
From technique scheme as can be seen that in embodiments of the present invention: determined based on predetermined game field range
The sky radius of a ball, and set up summit positioned at by the regular dodecahedron model on this sphere determined by sky radius of a ball;For institute
Each triangle stating regular dodecahedron model executes multiple recursion to form sphere model, wherein each recursion
Including: split in the midpoint of each edge of triangle, and the plane coordinates of split point is mapped on sphere;For spheroid mould
Type execution texture mapping is to generate sky ball, and described sky ball is shown in perspective projection in screen.It can be seen that, embodiment party of the present invention
Formula is based on regular dodecahedron recursion and constitutes sphere model, has been allowed to even grain density, has saved more in texture dimensions
Consumption, video memory space can be reduced.
Brief description
The following drawings only does schematic illustration and explanation to the present invention, not delimit the scope of the invention.
Fig. 1 is the sphere model schematic diagram generating through parallel partitioning in prior art.
Fig. 2 is the method flow diagram showing sky ball according to the present invention in scene of game.
Fig. 3 is the schematic diagram according to regular dodecahedron model of the present invention.
Fig. 4 is the recursion schematic diagram according to the present invention to triangle.
Fig. 5 is the sphere model schematic diagram drawing fractionation according to the present invention based on regular dodecahedron recurrence.
Fig. 6 is the structure drawing of device showing sky ball according to the present invention in scene of game.
Specific embodiment
In order to be more clearly understood to the technical characteristic of invention, purpose and effect, now compare the brief description present invention
Specific embodiment, in the various figures identical label represent identical part.
Herein, " schematic " expression " serving as example, example or explanation ", should not will be described herein as " showing
Any diagram of meaning property ", embodiment are construed to a kind of preferred or more advantage technical scheme.
For making simplified form, each in figure only schematically show part related to the present invention, and do not represent it
Practical structures as product.In addition, so that simplified form readily appreciates, have the portion of identical structure or function in some in figures
Part, only symbolically depicts one of, or has only marked one of.
In some large-scale 3d game, there are several requisite elements, such as sky and the earth, these elements
Presence can increase the sense of reality of 3d scene.Sky is exactly a very big container in fact, All Around The World is all covered on following, greatly
Ground is exactly a plane, and in scene, all of element is shown in the space that the two is surrounded.
The technology of three-dimensional sky mainly includes three types: one kind is plane sky (sky plane), is only put down with one
Cover is on the crown of all elements.This technology somewhat weak it is easy to be penetrated, sense of reality is also very low, sometimes also need to use mist
To cover distant view to increase sense of reality, but effect and technology content are still very low.One kind is sky vault hut (sky dome), has
When be also referred to as sky ball, that is, being put on the situation elements crown is a curved surface, can be all generally a hemisphere, this technology
Verity and third dimension are strong;Another is a day empty packet (sky box), sky is made a cube, all of unit
Element all covers under it.
The sky ball of prior art is using through parallel division methods.However, through, in parallel division methods, corresponding to texture
During pinup picture, the texture density of whole sphere is skimble-scamble.Excessive in south poles texure density, have packing phenomenon,
Equatorial portion texture density is too small, has stretching phenomenon.
In embodiments of the present invention, sphere model is constituted based on regular dodecahedron recursion, be allowed to even grain
Density.
Fig. 2 is the method flow diagram showing sky ball according to the present invention in scene of game.
As shown in Fig. 2 the method includes:
Step 201: the sky radius of a ball is determined based on predetermined game field range, and sets up summit positioned at by this sky ball
Regular dodecahedron model on sphere determined by radius.
Here, it is primarily based on predetermined game field range and determines the sky radius of a ball, and summit can be set up and be located at
By the regular dodecahedron model on this sphere determined by sky radius of a ball.
Fig. 3 is the schematic diagram according to regular dodecahedron model of the present invention.
As shown in figure 3, the regular polygon that regular dodecahedron model is made up of 20 equilateral triangles, have 12 tops
Point, 30 ribs, 20 faces.
Step 202: each triangle for regular dodecahedron model executes multiple recursion to form spheroid mould
Type, wherein recursion includes every time: split in the midpoint of each edge of triangle, and the plane coordinates mapping by split point
To on sphere.
Here, for each of regular dodecahedron model equilateral triangle, tear open between the midpoint of each edge
Point, finally the vector represented by newly-generated apex coordinate is carried out unitization, this vector is multiplied by the radius of ball, will be newly-generated
Apex coordinate mapping sphere on.
Fig. 4 is the recursion schematic diagram according to the present invention to triangle.
As shown in figure 4, with one of regular dodecahedron model triangle p0p1p2As a example illustrate, triangle p0p1p2
The coordinate on each summit is respectively p0、p1And p2.This triangle p0p1p2There are three equilateral, respectively p0p1、p0p2And p1p2.
First time recursion includes:
First, calculate triangle p0p1p2Three equilateral each middle point coordinates.Specifically, calculate equilateral p0p1Midpoint
Coordinate is it is assumed that midpoint is p01, then p01=(p0+p1)/2;Calculate equilateral p0p2Middle point coordinates it is assumed that midpoint be p20, then p20=
(p0+p2)/2;Calculate equilateral p1p2Middle point coordinates it is assumed that midpoint be p12, then p12=(p1+p2)/2.
And, triangle p0p1p2It is split as four trianglees, be respectively as follows: triangle p0p01p20, triangle p1p01p12、
Triangle p2p20p12With triangle p01p20p12.
Then, by newly-generated apex coordinate p01、p20And p12Represented vector carries out unitization, and this vector is multiplied by
The radius of ball, by newly-generated apex coordinate mapping sphere.
Second recursive procedure includes: calculates triangle p0p01p20Three equilateral each middle point coordinates, will be newly-generated
The vector represented by apex coordinate carry out unitization, this vector is multiplied by the radius of ball, by newly-generated apex coordinate mapping
On sphere;Calculate triangle p1p01p12Three equilateral each middle point coordinates, by represented by newly-generated apex coordinate to
Amount carries out unitization, this vector is multiplied by the radius of ball, by newly-generated apex coordinate mapping sphere;Calculate triangle
p2p20p12Three equilateral each middle point coordinates, the vector represented by newly-generated apex coordinate is carried out unitization, by this
Vector is multiplied by the radius of ball, by newly-generated apex coordinate mapping sphere;Calculate triangle p01p20p12Three equilateral each
From middle point coordinates, the vector represented by newly-generated apex coordinate is carried out unitization, this vector is multiplied by the radius of ball, will be new
On the apex coordinate mapping sphere generating.
And, triangle p0p01p20, triangle p1p01p12, triangle p2p20p12With triangle p01p20p12Each of
All it is split as four little trianglees, thus constituting altogether 16 little trianglees.
Similarly, third time recursive procedure includes, and for each of this 16 little trianglees, calculates three sides respectively
Each middle point coordinates.Vector represented by newly-generated apex coordinate is carried out unitization, this vector is multiplied by the radius of ball,
By on newly-generated apex coordinate mapping sphere.16 little trianglees are each split as four less trianglees, from
And constitute 64 less trianglees.
Repeatedly passed it is likewise possible to each of this 64 less trianglees being carried out respectively with midpoint and splitting with executing
Return.
It has been found that it is already possible to form good sphere model after four recurrence.
Fig. 5 is the sphere model schematic diagram drawing fractionation according to the present invention based on regular dodecahedron recurrence.This sphere model can
To have even grain density.On regular dodecahedron model, four iterative recursives split triangular facet, form suitable triangular facet number
The sphere model of amount.Substitute the model generating through parallel partitioning of the prior art using this model, archetype needs
The texture of 1024*1024 resolution can be only achieved ideal effect, only be can reach using the texture of 512*512 resolution after replacement
Effect same, saves 75% video memory space.
Step 203: for sphere model execution texture mapping to generate sky ball, and sky is shown in perspective projection in screen
Empty ball.
Here, because sky ball is texture even density, save more consumption therefore in texture dimensions.?
Afterwards, in screen, sky ball is shown in perspective projection.
Based on foregoing description, embodiment of the present invention also proposed a kind of device showing sky ball in scene of game.
Fig. 6 is the structure drawing of device showing sky ball according to the present invention in scene of game.
As shown in fig. 6, this device 600 includes:
Model building module 601, for determining the sky radius of a ball based on predetermined game field range, and sets up summit position
In by the regular dodecahedron model on this sphere determined by sky radius of a ball;
Recurrence module 602, executes multiple recursion for each triangle for described regular dodecahedron model
To form sphere model, wherein recursion includes every time: split in the midpoint of each edge of triangle, and by split point
Plane coordinates is mapped on sphere;
Display module 603, for executing texture mapping to generate sky ball for sphere model, and perspective is thrown in screen
Described sky ball is shown in film show.
In one embodiment, multiple recursion is: four recursions.
In one embodiment, recurrence module 602, for for each triangle, splitting in the midpoint of each edge
And calculate the plane coordinates at midpoint, and the vector represented by plane coordinates is carried out unitization;Described vector is multiplied by sky ball
Radius, plane coordinates is mapped on the sphere based on the determination of the described sky radius of a ball as summit.
In one embodiment, display module 603, for executing the texture of 512 × 512 resolution for sphere model
Pinup picture is to generate sky ball.
In sum, in embodiments of the present invention: the sky radius of a ball is determined based on predetermined game field range, and builds
Vertical summit is located at by the regular dodecahedron model on this sphere determined by sky radius of a ball;For described regular dodecahedron model
Each triangle execute multiple recursion to form sphere model, wherein every time recursion includes: in triangle
The midpoint of each edge splits, and the plane coordinates of split point is mapped on sphere;Execute texture mapping for sphere model
To generate sky ball, and described sky ball is shown in perspective projection in screen.It can be seen that, embodiment of the present invention is based on positive icosahedro
Body recursion constitutes sphere model, has been allowed to even grain density, saves more consumption, can reduce in texture dimensions
Video memory space.
Herein, " one " is not offered as being limited to " only this " quantity of relevant portion of the present invention, and " one
Individual " do not indicate that the situation of the quantity " more than one " excluding relevant portion of the present invention.
Herein, " on ", D score, "front", "rear", "left", "right", " interior ", " outward " etc. be only used for representing relevant portion
Between relative position relation, and the absolute position of these relevant portions non-limiting.
The a series of detailed description of those listed above is only for the feasibility embodiment of the present invention specifically
Bright, and and be not used to limit the scope of the invention, all equivalent embodiments made without departing from skill spirit of the present invention or
Change, such as combination, segmentation or the repetition of feature, should be included within the scope of the present invention.
Claims (8)
1. a kind of method showing sky ball in scene of game is it is characterised in that the method includes:
The sky radius of a ball is determined based on predetermined game field range, and sets up summit and be located at determined by this sky radius of a ball
Regular dodecahedron model on sphere;
Each triangle for described regular dodecahedron model executes multiple recursion to form sphere model, wherein often
Secondary recursion includes: splits in the midpoint of each edge of triangle, and the plane coordinates of split point is mapped on sphere;
For sphere model execution texture mapping to generate sky ball, and described sky ball is shown in perspective projection in screen.
2. the method showing sky ball in scene of game according to claim 1 is it is characterised in that described multiple recurrence
It is subdivided into: four recursions.
3. the method showing sky ball in scene of game according to claim 1 it is characterised in that described in triangle
Each edge midpoint split, and by the plane coordinates of split point be mapped on sphere include:
For each triangle, split in the midpoint of each edge and calculate the plane coordinates at midpoint, and by plane coordinates institute table
The vector showing carries out unitization;
Described vector is multiplied by the sky radius of a ball, plane coordinates is mapped to based on the determination of the described sky radius of a ball as summit
On sphere.
4. the method showing sky ball in scene of game according to claim 1 is it is characterised in that be directed to sphere model
Execution texture mapping is included with generating sky ball:
Execute the texture mapping of 512 × 512 resolution for sphere model to generate sky ball.
5. a kind of device showing sky ball in scene of game is it is characterised in that this device includes:
Model building module, for determining the sky radius of a ball based on predetermined game field range, and sets up summit positioned at by this
Regular dodecahedron model on sphere determined by the sky radius of a ball;
Recurrence module, executes multiple recursion to form ball for each triangle for described regular dodecahedron model
Body Model, wherein recursion includes every time: split in the midpoint of each edge of triangle, and the plane coordinates by split point
It is mapped on sphere;
Display module, for executing texture mapping to generate sky ball for sphere model, and perspective projection is shown in screen
Described sky ball.
6. the device showing sky ball in scene of game according to claim 5 is it is characterised in that described multiple recurrence
It is subdivided into: four recursions.
7. the device showing sky ball in scene of game according to claim 5 it is characterised in that
Recurrence module, for for each triangle, splitting in the midpoint of each edge and calculating the plane coordinates at midpoint, and will
Vector represented by plane coordinates carries out unitization;Described vector is multiplied by the sky radius of a ball, plane coordinates is reflected as summit
It is mapped on the sphere based on the determination of the described sky radius of a ball.
8. the device showing sky ball in scene of game according to claim 5 it is characterised in that
Display module, for executing the texture mapping of 512 × 512 resolution to generate sky ball for sphere model.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610771971.5A CN106355635A (en) | 2016-08-30 | 2016-08-30 | Method and device for displaying sky sphere in game scene |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610771971.5A CN106355635A (en) | 2016-08-30 | 2016-08-30 | Method and device for displaying sky sphere in game scene |
Publications (1)
Publication Number | Publication Date |
---|---|
CN106355635A true CN106355635A (en) | 2017-01-25 |
Family
ID=57856503
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610771971.5A Pending CN106355635A (en) | 2016-08-30 | 2016-08-30 | Method and device for displaying sky sphere in game scene |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106355635A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019157923A1 (en) * | 2018-02-13 | 2019-08-22 | 视辰信息科技(上海)有限公司 | Environment mapping method and apparatus |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514393A (en) * | 2012-06-20 | 2014-01-15 | 上海市上海中学 | Method for achieving three-dimensional verification code |
US9299127B2 (en) * | 2012-09-21 | 2016-03-29 | ImmerVision | Splitting of elliptical images |
-
2016
- 2016-08-30 CN CN201610771971.5A patent/CN106355635A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103514393A (en) * | 2012-06-20 | 2014-01-15 | 上海市上海中学 | Method for achieving three-dimensional verification code |
US9299127B2 (en) * | 2012-09-21 | 2016-03-29 | ImmerVision | Splitting of elliptical images |
Non-Patent Citations (1)
Title |
---|
孙文静: "虚拟场景实时生成技术研究", 《中国优秀博硕士学位论文全文数据库 (硕士) 信息科技辑》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019157923A1 (en) * | 2018-02-13 | 2019-08-22 | 视辰信息科技(上海)有限公司 | Environment mapping method and apparatus |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11461958B2 (en) | Scene data obtaining method and model training method, apparatus and computer readable storage medium using the same | |
CN107018336B (en) | The method and apparatus of method and apparatus and the video processing of image procossing | |
CN104966312B (en) | A kind of rendering intent, device and the terminal device of 3D models | |
CN107330962B (en) | Automatic generation method, device and equipment for interactive virtual reality scene | |
CN102289845B (en) | Three-dimensional model drawing method and device | |
CN102831631A (en) | Rendering method and rendering device for large-scale three-dimensional animations | |
CN104200506A (en) | Method and device for rendering three-dimensional GIS mass vector data | |
CN105913471B (en) | The method and apparatus of picture processing | |
CN104318605B (en) | Parallel lamination rendering method of vector solid line and three-dimensional terrain | |
CN102663808A (en) | Method for establishing rigid body model based on three-dimensional model in digital home entertainment | |
Wang | Landscape design of coastal area based on virtual reality technology and intelligent algorithm | |
CN109087369A (en) | Virtual objects display methods, device, electronic device and storage medium | |
CN103247072A (en) | Method and device for realizing three-dimensional rotating interface based on Android system | |
CN103065353A (en) | Three-dimensional model feature extraction method and system and three-dimensional model retrieval method and system | |
CN107038745A (en) | A kind of 3D tourist sights roaming interaction method and device | |
CN107403459A (en) | Real terrain fast modeling method and landslide visualization technique | |
CN114494570A (en) | Rendering method and device of three-dimensional model, storage medium and computer equipment | |
CN104036539B (en) | View frustum projection clipping method for large-scale terrain rendering | |
CN111494945A (en) | Virtual object processing method and device, storage medium and electronic equipment | |
CN103617593B (en) | The implementation method of three-dimensional fluid physic animation engine and device | |
CN107590858A (en) | Medical sample methods of exhibiting and computer equipment, storage medium based on AR technologies | |
CN106355635A (en) | Method and device for displaying sky sphere in game scene | |
WO2017174006A1 (en) | Image processing method and device | |
CN108230430A (en) | The processing method and processing device of cloud layer shade figure | |
CN202771491U (en) | Rendering device for large-scale three-dimensional animation |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170125 |