This relates generally to computers and, particularly, to graphics processors.
The motion of vegetation, usually in the background of a scene, is extremely complex. For example, grass in a field may consist of thousands, if not millions, of individual grass blades. Each of those blades may move in a unique way based on its shape and its position within the landscape, as affected by the wind and its interaction with the ground's shape.
Referring to
Force calculation and application block 12 calculates the collision force for a set of plant units, such as grass blades. Vegetation blocks generation 14 may rebuild graphics objects for blocks in the camera frustrum if the camera position has changed. A vegetation block is a rectangular/region or a tile in a rectangular grid of blocks that together define the overall vegetation depiction. This stage defines which vegetation blocks are displayed with the highest detail level, with moderate detail level, or with the lowest detail level, in an embodiment using three levels of detail.
The levels of detail are calculated (block 16) based on the results from the preceding block. The final list of visualized objects is formed for herbage blocks in the camera frustrum. The animation calculation 18 generates blades, bit maps, and/or textures and visualization unit 20 produces a display, using the graphics processing unit hardware.
Blocks 10-14 may be executed on a central processing unit (CPU) and blocks 16-20 may be executed on the graphics processing unit (GPU), in some embodiments. However, any block can be moved from CPU to GPU or vice versa, depending on the computing system architecture.
In accordance with some embodiments, physics model improvements may improve user experience. Optimized visualization techniques with several levels of detail enable graphics processing, especially for energy constrained graphics processing units, such as those used in mobile applications. The herbage model may introduce inertial animation models with the Featherstone algorithm. This includes true physics blade behavior during interaction with physical phenomena, such as the wind, or external objects, such as wheels and feet. Optimized visualization techniques include automatically changing levels of detail with smooth transitions, automatic filling of terrain blocks with blades, allowing the decrease of the overall number of visualized blades by a factor of 10×, or even more, in some embodiments.
For grass visualization, a geometry-based approach may be used. Accordingly, rectangular terrain blocks 24 are created, each consisting of a set of separate blades of the same kind (
To enable smooth changing of level of detail, a weight coefficient is assigned to each blade in the block (see
w<F(z,φ) (1)
where w is the weight coefficient, F is some function, z is the distance from the camera to the blade, φ is the angle between direction to the camera and normal to the terrain surface in the blade point.
Further, F function is as follows:
where n is the normal to the terrain surface and r is the direction to the camera, d is the camera distance, t=(1−|(n,r)|)α, and α is a big number (e.g. 8).
This function may be used both for discarding grass blades when inequality, equation (1), is valid and for selecting the block's discrete level of detail. In the first case, d is the distance from the camera to the grass blade, in the second, d is the distance to the block center.
Discrete levels are introduced in the following way. Let the number of blades in the block be N=2k. Also the blades may be stored in the memory according to enumeration shown in
An algorithm to generate weight coefficients may be as follows. Split a block into (n/4)*(n/4) fragments (
Approximate distribution of the blocks with various levels of detail within the central square is shown in
To reduce the average number of triangles for one blade, various ways for triangulation on various levels of block detail may be used. Near the camera a blade may be visualized with seven segments (14 triangles). The number of segments is reduced the further the vegetation is from the camera.
The blade model is represented as a chain of n linear segments, connected to each other with joints which have spherical springs (
The coordinate system is assigned to each segment (
The rotations of the segments are defined by two vectors: v vector defines rotation around y axis at ∥v∥ angle. The corresponding rotation matrix is the following:
where θ is the rotation angle equal to ∥v∥ and x, y, z are coordinates of singular vector v/∥v∥ of the rotation axis. The matrix is denoted further as M(v). The inverse transform to get rotation vector from rotation matrix is:
v=V(M)=((m32−m23)/q,(m13−m31)/q,(m21−m12)/q)
q=√{square root over (4−(m11+m22+m33−1)2)}
The external forces fei, which are the sum of the wing force and segment gravity (
The movement equation for ith segment in its coordinate system is the following:
J{dot over (ω)}i=−ωi×(Jωi)−m1×R′iai−1−gi+Ri+1gi+1+1×(2Ri+1fi+1+T′ifie) (1)
a*
i={dot over (ω)}i×1ωi×(ωi×1) (2)
a
i
=a
i−1
+a*
i (3)
{dot over (ψ)}i=ωi (4)
f*
i
=−m(R′iai−1+a*i) (5)
f
i
=f*
i
+T′
i
f
i
e
+R
i+1
f
i+1 (6)
Where J is the inertia tensor (non-diagonal elements are zero),
ωi is the angle velocity vector of ith segment,
ψi is a vector which determines rotation increment of the coordinate system of ith segment, relatively to the coordinate system of (i−1)th segment,
gi is the moment caused by spring in ith joint,
Ri is a matrix converting vectors from the coordinate system of ith segment to the coordinate system of (i−1)th segment (when i=0—to the world coordinate system),
Ri′ is an inverse matrix to Ri, converting vectors from the coordinate system of (i−1)th segment to the coordinate system of ith segment,
Ti′ is a matrix, converting vectors from the world coordinate system to the coordinate system of ith segment. Note that
ai is an acceleration at the end of ith segment, i.e. in (i+1)th joint, but calculated in the coordinates of ith segment,
l=(0,0,l)′, where l—a half of the segment length (all segments have the same length with the center of mass in the middle),
m is a mass of the segment (all segments have the same mass).
For integration of the system (1)-(6) Featherstone algorithm is used. Two passes at each time step are done. At the first pass new values Ri, Ti, ωi, gi are calculated using known values Ri, Ti, ωi, gi, fi from the previous step.
This is done by bottom-up calculations along i, which allows to calculate acceleration ai using equality a0 to zero.
It is assumed that: 1) angle velocities are small; 2) impact of higher segments on lower is much less than reversed impact. So the model is simplified (the first assumption allows to discard members which contain squares of angular velocities in equations (1)-(6), and the second allows to refuse the second pass in Featherstone algorithm. The following algorithm is the result of the simplification:
The described model provides not only the blade bend caused by the forces, but also its torsion around central axis if the wind force is not perpendicular to the blade plane, as shown in
The algorithm keeps good visual illusion of animated grass blades in some embodiments.
Because of the huge number of grass blades it is hard to simulate their mutual collisions. However, the fact is considered that in case of blade inclination the collision of its top with the middle segment of another blade, as shown in
For this purpose additional forces are applied to each blade segment (
f
i
e
=f
i
w
+G
i
T
i′[2,2]
where fiwGi are wind and weight forces relatively.
The velocity of the segment is considered while calculating the wind force for each blade segment:
f
i
w
=k
w(w−vi)γ
Here kw is a coefficient which depends on the blade width, w is a wind velocity, vi is a segment center velocity, γ is a constant which depends on the grass type (for example, γ=4/3 for sedge). The vi value is calculated using vi-1* (velocity of the top of previous segment) according to formula vi=vi-1*+Ti(l×ωi)
Velocities of the segment tops are found from recurrent relations
v
0*=0
v
i
*=v
i-1*+2Ti(l×ωi)
Therefore, algorithm (7) takes the form
In a non-inertial animation model, the static equilibrium of a blade under gravity and wind forces is considered. So the animation is reached because of changing wind force. As well as in the simplified model (7) higher segments' impact onto lower ones may be disregarded.
g
i
=l×T
i
′f
i
e
Taking into account that
T
i
=T
i-1
M(ki−1gi)
the equality for calculating gi moment is:
g
i
=l×(Ti-1M(ki−1gi))′fie
Since gi moment is linearly bound with rotation vector (Hook's law), instead of this equation the following one is considered:
k
iψi=l×M′(ψi)F
where
F=T
i-1
′f
i
e
Evidently, ψi vector's direction coincides with l×F direction. This vector value (
lψ=|F∥l|sin(ψ+φ)
Where
φ=arcsin(|F×l|/|F∥l|)
For solving this equation, a simple iteration method may be used, where an initial approximation which is valid for small ψ values is selected:
ψ=k−1|F∥l|sin(φ)/(1−k−1|F∥l|cos(φ)
Three iterations are enough for coinciding visual results for the approximation, in some embodiments.
Therefore the algorithm is considered that finds Ti′ matrices that define segment mapping to the world coordinate system:
This model is compliant with the visualization method based on allocation of the same block over the entire grass surface, as there is no need to know its previous state for calculating the blade shape under wind.
The virtually-inertial animation model provides results close to inertial model, but it does not require keeping current values of angle velocities and general displacements for each grass blade so enables instancing use during rendering.
The idea of the virtually-inertial model is to carry over inertial component from calculation of the blade shape towards calculation of the wind force for this blade. That may be done if vertical virtual blades (which consist of one segment) are put into centers of wind force texels and their slope is calculated with inertial model. After that the wind force is calculated and it is applied to non-inertial model in order to get the same slope value as a result. This wind force is kept in the virtual wind texture (block 36,
As shown in
The vector's w direction coincides with the vector product of ψ vector and vertical axis, and its value is equal to:
where k is the rigidity of the first blade segment used in inertial model.
The computer system 130, shown in
In the case of a software implementation, the pertinent code may be stored in any suitable semiconductor, magnetic, or optical memory, including the main memory 132 (as indicated at 139) or any available memory within the graphics processor. Thus, in one embodiment, the code to perform the sequences of
The graphics processing techniques described herein may be implemented in various hardware architectures. For example, graphics functionality may be integrated within a chipset. Alternatively, a discrete graphics processor may be used. As still another embodiment, the graphics functions may be implemented by a general purpose processor, including a multicore processor.
References throughout this specification to “one embodiment” or “an embodiment” mean that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one implementation encompassed within the present invention. Thus, appearances of the phrase “one embodiment” or “in an embodiment” are not necessarily referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be instituted in other suitable forms other than the particular embodiment illustrated and all such forms may be encompassed within the claims of the present application.
While the present invention has been described with respect to a limited number of embodiments, those skilled in the art will appreciate numerous modifications and variations therefrom. It is intended that the appended claims cover all such modifications and variations as fall within the true spirit and scope of this present invention.
Filing Document | Filing Date | Country | Kind | 371c Date |
---|---|---|---|---|
PCT/US11/59256 | 11/4/2011 | WO | 00 | 6/14/2013 |