CN111612883B - Processing method, device and storage medium for cube map - Google Patents
Processing method, device and storage medium for cube map Download PDFInfo
- Publication number
- CN111612883B CN111612883B CN201910138664.7A CN201910138664A CN111612883B CN 111612883 B CN111612883 B CN 111612883B CN 201910138664 A CN201910138664 A CN 201910138664A CN 111612883 B CN111612883 B CN 111612883B
- Authority
- CN
- China
- Prior art keywords
- cube map
- coordinate system
- target object
- local coordinate
- rotation
- 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
Links
- 238000003672 processing method Methods 0.000 title abstract description 11
- 238000000034 method Methods 0.000 claims abstract description 44
- 230000007613 environmental effect Effects 0.000 claims abstract description 25
- 238000006243 chemical reaction Methods 0.000 claims description 12
- 238000004590 computer program Methods 0.000 claims description 10
- 230000000694 effects Effects 0.000 abstract description 30
- 238000009877 rendering Methods 0.000 abstract description 15
- 238000010586 diagram Methods 0.000 description 16
- 238000005516 engineering process Methods 0.000 description 3
- 238000005070 sampling Methods 0.000 description 3
- 238000009825 accumulation Methods 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 239000003086 colorant Substances 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000011435 rock Substances 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Graphics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- Processing Or Creating Images (AREA)
Abstract
The invention provides a processing method, a device and a storage medium for cube maps, wherein the method comprises the following steps: acquiring a cube map corresponding to the environmental reflection of the target object; according to the motion state of the target object, controlling the cube map to rotate; and reflecting the rotated cube map to the target object to obtain environment reflection data. The processing method, the processing device and the storage medium for the cube map can improve the reflection effect, enable the reflection of the cube environment to be more real when the object moves, and improve the rendering effect of the object.
Description
Technical Field
The present invention relates to image processing technologies, and in particular, to a method, an apparatus, and a storage medium for processing cube maps.
Background
With the development of virtual reality technology, game play based on virtual reality is also an important way, and various virtual objects, such as rocks, vehicles, lawns, etc., often need to be built in a virtual reality scene during game play, and rendering is a very important step, and rendering is a process of generating images from models, so that a final display effect of the virtual objects in the virtual reality scene can be achieved.
Since the scenes of the virtual reality game have a highly free characteristic, the player can very freely observe the scenes in the game in the virtual reality game scene, which makes it possible for the player to often require and expect a realistic-looking 3D virtual environment.
The prior art generally relates to an environment reflection generated based on cube map in the process of image rendering, so as to render images. That is, the reflection vector of the line of sight with respect to the normal line of the vertex of the object is used as the sampling direction, and the texture map of the corresponding point on the cube map can obtain the effect of environment reflection, so that each image is rendered.
However, since the cube map is a fixed picture and the environmental reflection generated based on the cube map is offset to some extent according to the line of sight, the reflection manner described above cannot exhibit the reflection effect of the object when it is moving rapidly, resulting in poor rendering effect of the object.
Disclosure of Invention
In order to solve the problems in the prior art, the invention provides a processing method, a device and a storage medium for cube map.
In a first aspect, an embodiment of the present invention provides a method for processing a cube map, including:
acquiring a cube map corresponding to the environmental reflection of the target object;
according to the motion state of the target object, controlling the cube map to rotate;
and reflecting the rotated cube map to the target object to obtain environment reflection data.
In one possible implementation manner, before the controlling the cube map to rotate according to the motion state of the target object, the method further includes:
establishing a local coordinate system;
determining a conversion relation between a local coordinate system and a world coordinate system;
converting coordinate values of the cube map in a world coordinate system into coordinate values in the local coordinate system;
and controlling the cube map to rotate according to the motion state of the target object, wherein the method comprises the following steps:
and controlling the cube map to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system.
In a possible implementation manner, the controlling the rotation of the cube map in the local coordinate system according to the motion state of the target object in the local coordinate system includes:
and if the motion state of the target object is the X-axis motion along the local coordinate system, controlling the cube map to rotate around the Z-axis of the local coordinate system.
In one possible implementation, the controlling the rotation of the cube map about the Z-axis of the local coordinate system includes:
determining the movement direction and the movement speed of the target object;
determining a direction of rotation of the cube map based on the direction of motion;
determining a rotation angle of the cube map according to the movement speed;
and controlling the cube map to rotate around the Z axis of the local coordinate system according to the rotation direction and the rotation angle.
In a possible implementation manner, the determining the rotation direction of the cube map according to the movement direction includes:
if the target object moves along the positive direction of the X axis of the local coordinate system, determining the rotation direction of the cube map to rotate clockwise around the Z axis; or,
and if the target object moves in the negative direction along the X axis of the local coordinate system, determining the rotation direction of the cube map to be anticlockwise rotation around the Z axis.
In a possible implementation manner, the controlling the rotation of the cube map in the local coordinate system according to the motion state of the target object in the local coordinate system includes:
and if the motion state of the target object is turning motion, controlling the cube map to rotate around the Y axis of the local coordinate system.
In one possible implementation, the controlling the rotation of the cube map about the Y-axis of the local coordinate system includes:
determining the turning direction and the turning angle of the target object;
determining a rotation direction of the cube map according to the turning direction;
determining a rotation angle of the cube map according to the turning angle;
and controlling the cube map to rotate around the Y axis of the local coordinate system according to the rotation direction and the rotation angle.
In a second aspect, an embodiment of the present invention provides a processing apparatus for cube map, including:
the acquisition module is used for acquiring a cube map corresponding to the environmental reflection of the target object;
the rotation module is used for controlling the cube map to rotate according to the motion state of the target object;
and the processing module is used for reflecting the rotated cube map to a target object to obtain environment reflection data.
In one possible implementation, the apparatus further includes:
the building module is used for building a local coordinate system;
the determining module is used for determining the conversion relation between the local coordinate system and the world coordinate system;
the conversion module is used for converting coordinate values of the cube map in a world coordinate system into coordinate values in the local coordinate system;
the rotating module is specifically used for:
and controlling the cube map to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system.
In one possible implementation, the rotation module is specifically configured to:
and if the motion state of the target object is the X-axis motion along the local coordinate system, controlling the cube map to rotate around the Z-axis of the local coordinate system.
In one possible implementation, the rotation module is specifically configured to:
determining the movement direction and the movement speed of the target object;
determining a direction of rotation of the cube map based on the direction of motion;
determining a rotation angle of the cube map according to the movement speed;
and controlling the cube map to rotate around the Z axis of the local coordinate system according to the rotation direction and the rotation angle.
In one possible implementation manner, the determining module is further configured to:
if the target object moves along the positive direction of the X axis of the local coordinate system, determining the rotation direction of the cube map to rotate clockwise around the Z axis; or,
and if the target object moves in the negative direction along the X axis of the local coordinate system, determining the rotation direction of the cube map to be anticlockwise rotation around the Z axis.
In one possible implementation, the rotation module is specifically configured to:
and if the motion state of the target object is turning motion, controlling the cube map to rotate around the Y axis of the local coordinate system.
In one possible implementation, the rotation module is specifically configured to:
determining the turning direction and the turning angle of the target object;
determining a rotation direction of the cube map according to the turning direction;
determining a rotation angle of the cube map according to the turning angle;
and controlling the cube map to rotate around the Y axis of the local coordinate system according to the rotation direction and the rotation angle.
In a third aspect, an embodiment of the present invention provides a client, including:
a processor;
a memory for storing a computer program of the processor; the method comprises the steps of,
a display for displaying the cube map according to control of the processor;
wherein the processor is configured to implement the method of processing a cube map according to the first aspect by executing the computer program.
In a fourth aspect, embodiments of the present invention provide a computer-readable storage medium storing a computer program that causes a client to perform the method of the first aspect.
According to the processing method, the processing device and the storage medium of the cube map, the cube map corresponding to the environmental reflection of the target object is obtained, the cube map is controlled to rotate according to the motion state of the target object, and the rotated cube map is reflected to the target object to obtain the environmental reflection data. The cube map can be controlled to rotate according to the motion state of the target object, so that the reflecting effect of the target object in the motion state can be reflected by the cube map, the reflection of the cube environment can be more real when the object moves, and the rendering effect of the object is improved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions of the prior art, the drawings which are used in the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the description below are only some embodiments of the invention, and that other drawings can be obtained according to these drawings without inventive faculty for a person skilled in the art.
FIG. 1 is a schematic flow chart of a first embodiment of a method for processing cube maps according to an embodiment of the present invention;
FIG. 2a is a schematic diagram of a cube map;
FIG. 2b is another schematic view of a cube map;
FIG. 3 is a schematic illustration of ambient reflection;
FIG. 4 is a schematic flow chart of a second embodiment of a method for processing cube maps according to the present invention;
FIG. 5 is a schematic diagram of a cube map rotation;
FIG. 6 is another schematic view of a cube map rotation;
FIG. 7 is yet another schematic diagram of a cube map rotation;
FIG. 8 is yet another schematic diagram of a cube map rotation;
FIG. 9 is a schematic diagram of a first embodiment of a cube map processing apparatus according to the present invention;
FIG. 10 is a schematic diagram of a second embodiment of a cube map processing apparatus according to the present invention;
fig. 11 is a schematic diagram of a client structure according to another embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The terms "first," "second," "third," and "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The processing method of the cube map provided by the embodiment of the invention can be applied to an image processing scene, and is particularly suitable for a scene for rendering an image in a game scene. The rendering refers to processing visual effects on the model in the game making process, for example, the effect of the model in the three-dimensional environment can be simulated by setting relevant parameters such as light, materials, textures, colors and environment of the model, and therefore the virtual object in the game is obtained. In the prior art, environmental reflection is usually generated based on a cube map, so that images are rendered, that is, a reflection vector of a line of sight with respect to a normal line of an object vertex is used as a sampling direction, and a texture map of a corresponding point on the cube map is sampled to obtain an effect of environmental reflection, so that each image is rendered. However, since the cube map is a fixed picture and the environmental reflection generated based on the cube map is offset to some extent according to the line of sight, the reflection manner described above will not show the reflection effect of the object when the object is moving fast, resulting in poor rendering effect of the object.
In view of the above problems, an embodiment of the present invention provides a method for processing a cube map, where the cube map corresponding to an environmental reflection of a target object is obtained, and according to a motion state of the target object, the cube map is controlled to rotate, and the rotated cube map is reflected to the target object, so as to obtain environmental reflection data. The cube map can be controlled to rotate according to the motion state of the target object, so that the reflecting effect of the target object in the motion state can be reflected by the cube map, the reflection of the cube environment can be more real when the object moves, and the rendering effect of the object is improved.
The technical scheme of the invention is described in detail below by specific examples. The following embodiments may be combined with each other, and some embodiments may not be repeated for the same or similar concepts or processes.
Fig. 1 is a schematic flow chart of an embodiment of a method for processing a cube map according to an embodiment of the present invention, where the method may be executed by any device that executes the method for processing a cube map, and the device may be implemented by software and/or hardware. In this embodiment, the apparatus may be integrated in the client. As shown in fig. 1, the processing method for cube maps provided by the embodiment of the invention includes the following steps:
step 101: and acquiring a cube map corresponding to the environmental reflection of the target object.
Fig. 2a is a schematic diagram of a cube map, fig. 2b is another schematic diagram of a cube map, and as shown in fig. 2 a-2 b, the cube map is a special texture map technology, and 6 2D texture maps (including front, back, left, right, up and down) are used to form a cube texture set centered on an origin, and each 2D texture map forms a face of a cube. Each segment, texture coordinates (s, t, r) are treated as a direction vector, and each texture unit represents an image on the cube map texture as seen from the origin.
Further, the front, rear, left, right, upper and lower surrounding environments of the target object may be respectively shot by 6 cameras to obtain 6 2D texture maps, and in addition, the 6 2D texture maps may also be obtained by one panoramic camera, and of course, the texture maps may also be obtained by other manners, and the embodiment of the present invention is not limited herein with respect to the specific manner of obtaining the texture maps. After 6 2D texture maps are obtained, each 2D texture map is used as one surface of a cube, so that a cube map corresponding to the environmental reflection of the target object is generated.
Step 102: and controlling the cube map to rotate according to the motion state of the target object.
In this step, when the client determines that the target object is in the motion state, the client may control the cube map to rotate according to the motion state of the target object. Thus, when the target object moves, the cube map is also in a moving state. The motion state of the cube map is matched with the motion state of the target object, so that the unrealistic phenomenon that the target object moves but the cube map does not move is avoided, the unrealistic phenomenon that the existing cube environment reflection does not move when the target object moves is solved, and the reflection effect is improved.
Further, the motion state of the target object may include a motion direction, such as forward, backward, left turn, right turn, etc., and the motion state may also include a motion speed. The client can determine the rotation speed and the rotation direction of the cube map according to the motion state, so as to control the cube map to rotate.
Step 103: and reflecting the rotated cube map to a target object to obtain environment reflection data.
Where the reflection appears as a reflection of the object (or a part of the object) against its surroundings, i.e. the color of the object is more or less equal to its surroundings depending on the viewing angle of the observer. Fig. 3 is a schematic view of the environment reflection, as shown in fig. 3, by calculating the observer/camera direction vector I, calculating the reflection vector R using the direction vector I, and then sampling from the cube map using the reflection vector R, the rotated cube map is reflected to the target object, and the environment reflection data is obtained.
According to the processing method of the cube map, the cube map corresponding to the environmental reflection of the target object is obtained, the cube map is controlled to rotate according to the motion state of the target object, and the rotated cube map is reflected to the target object to obtain the environmental reflection data. The cube map can be controlled to rotate according to the motion state of the target object, so that the reflecting effect of the target object in the motion state can be reflected by the cube map, the reflection of the cube environment can be more real when the object moves, and the rendering effect of the object is improved.
Fig. 4 is a schematic flow chart of a second embodiment of a method for processing a cube map according to an embodiment of the present invention, and the present embodiment describes in detail how to control a process of rotating the cube map according to a motion state of a target object based on the embodiment shown in fig. 3. The processing method of the cube map provided by the embodiment of the invention comprises the following steps:
step 401: and acquiring a cube map corresponding to the environmental reflection of the target object.
Step 401 is similar to step 101 and will not be described again here.
Step 402: a local coordinate system is established.
Step 403: and determining the conversion relation between the local coordinate system and the world coordinate system.
Step 404: the coordinate values of the cube map in the world coordinate system are converted into coordinate values in the local coordinate system.
In practical applications, it is common to acquire a cube map in a world coordinate system, and when the cube map is controlled to rotate, the cube map needs to rotate in a local coordinate system. Therefore, before the cube map is controlled to rotate according to the motion state of the target object, the cube map needs to be converted from the world coordinate system to the local coordinate system.
Specifically, the local coordinate system refers to a self-reference system determined for explaining the position and direction of the object itself with respect to other objects or environments. It is an ordered array built according to a certain rule.
The world coordinate system refers to a unified reference system established for describing the positions and directions of different objects in the same environment. It is an ordered array built according to a certain rule.
After the local coordinate system is established, the conversion relationship between the local coordinate system and the world coordinate system can be determined according to the established local coordinate system.
Step 405: and controlling the cube map to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system.
In this step, after the conversion relationship between the local coordinate system and the world coordinate system is established, the coordinate values of the cube map in the world coordinate system may be converted into the coordinate values in the local coordinate system according to the conversion relationship.
After the coordinate values of the cube map in the world coordinate system are converted into the coordinate values in the local coordinate system, the cube map can be controlled to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system, so that the accuracy of the rotation of the cube map can be improved.
The motion state of the target object in the local coordinate system may include two types: the motion state of the target object is the motion along the X axis of the local coordinate system, or the turning motion of the target object. And controlling the cube map to rotate around a certain vector of the local coordinate system according to the moving direction, the moving speed and the moving angle of the target object in the local coordinate system, wherein the rotating angle and the rotating direction are matched with the moving direction, the moving speed and the moving angle of the target object. The cube map is controlled to rotate around a certain vector of the local coordinate system according to the motion state of the target object under the local coordinate system, so that the unreal phenomenon that the cube map does not move when the existing cube environment is reflected and the target object moves is solved.
In the following, it will be described in detail how the rotation of the cube map is controlled in the two different motion states described above.
First kind: the motion state of the target object is along the X-axis of the local coordinate system.
Specifically, if the motion state of the target object is along the X-axis of the local coordinate system, the cube map is controlled to rotate around the Z-axis of the local coordinate system. Fig. 5 is a schematic diagram of rotation of the cube map, as shown in fig. 5, it can be understood by those skilled in the art that when the target object moves along the X-axis of the local coordinate system, that is, when the target object moves horizontally, it is required to control the rotation of the cube map around the Z-axis of the local coordinate system, so that the effect that when the target object moves, the environmental reflection data obtained after being reflected to the target object also moves along with the target object can be displayed, and thus the rendering effect can be improved.
Further, when the control cube map rotates around the Z axis of the local coordinate system, the following manner can be adopted: determining the movement direction and the movement speed of the target object, determining the rotation direction of the cube map according to the movement direction, determining the rotation angle of the cube map according to the movement speed, and controlling the cube map to rotate around the Z axis of the local coordinate system according to the rotation direction and the rotation angle.
In particular, the direction of movement of the target object may comprise, for example, a positive movement along the X-axis of the local coordinate system or a negative movement along the X-axis of the local coordinate system. If the target object moves along the positive direction of the X axis of the local coordinate system, the rotation direction of the cube map is determined to rotate clockwise around the Z axis, and if the target object moves along the negative direction of the X axis of the local coordinate system, the rotation direction of the cube map is determined to rotate anticlockwise around the Z axis.
The clockwise direction or the counterclockwise direction is a direction in a plan view.
In addition, the rotation angle of the cube map is accumulated or decremented by using a cycle algorithm of updating every frame or updating every other frame, and the magnitude of the accumulated angle can be determined according to the movement speed of the target object, so as to determine the rotation angle of the cube map, wherein the movement speed and the rotation angle are in a direct proportion relation, that is, the larger the movement speed of the target object is, the larger the rotation angle of the cube map is, the smaller the movement speed of the target object is, and the rotation angle of the cube map is smaller. For example, when the traveling speed of the target object is 200km/h, the accumulation angle of the cube map is 60 degrees/s, and when the traveling speed of the target object is 100km/h, the accumulation angle of the cube map is 30 degrees/s.
After determining the rotation direction and rotation angle, the cube map will be controlled to rotate about the Z-axis of the local coordinate system based on the rotation direction and rotation angle.
Fig. 6 is another schematic diagram of rotation of the cube map, as shown in fig. 6, when the vehicle moves along the X axis of the local coordinate system, the corresponding cube map of the vehicle can be controlled to rotate around the Z axis of the local coordinate system, so that the effect that the corresponding cube map moves along with the motion of the vehicle can be exhibited.
In this embodiment, if the motion state of the target object is the motion along the X-axis of the local coordinate system, the motion direction and the motion speed of the target object are determined, the rotation direction of the cube map is determined according to the motion direction, then the rotation angle of the cube map is determined according to the motion speed, and then the rotation of the cube map around the Z-axis of the local coordinate system is controlled according to the rotation direction and the rotation angle, so that the unrealistic phenomenon that the object moves but the cube map does not move in the existing cube environment reflection can be avoided, and the reflection effect can be improved.
Second kind: the movement state of the target object is a turning movement.
Specifically, if the motion state of the target object is turning motion, the cube map is controlled to rotate around the Y axis of the local coordinate system. Fig. 7 is a further schematic diagram of rotation of the cube map, as shown in fig. 7, and it will be understood by those skilled in the art that the cube map needs to be controlled to rotate around the Y axis of the local coordinate system when the target object turns, so that the effect that the cube map turns along with the target object when the target object turns can be displayed, and the rendering effect can be improved.
Further, when the control cube map rotates around the Y axis of the local coordinate system, the following manner may be performed: determining the turning direction and the turning angle of the target object, determining the rotation direction of the cube map according to the turning direction, determining the rotation angle of the cube map according to the turning angle, and controlling the cube map to rotate around the Y axis of the local coordinate system according to the rotation direction and the rotation angle.
Specifically, the turning direction of the target object may include, for example, turning left or turning right. If the target object turns left, the rotation direction of the cube map is determined to be counterclockwise around the Y axis, and if the target object turns right, the rotation direction of the cube map is determined to be clockwise around the Y axis.
The clockwise direction or the counterclockwise direction is the direction in the right view state.
In addition, the rotation angle of the cube map may be determined according to the turning angle of the target object, where the turning angle and the rotation angle may be the same or different. If the turning angle and the rotation angle are different, a certain proportional relation can be displayed between the turning angle and the rotation angle. For example, when the target object is turned 30 degrees to the right, the control cube map is rotated 30 degrees clockwise about the Y-axis of the local coordinate system.
Fig. 8 is a schematic diagram of rotation of the cube map, as shown in fig. 8, when the vehicle turns, the corresponding cube map of the vehicle can be controlled to rotate around the Y axis of the local coordinate system, so that the effect that the cube map turns along with the vehicle turns can be exhibited.
In this embodiment, if the motion state of the target object is turning motion, the turning direction and the turning angle of the target object are determined, the rotation direction of the cube map is determined according to the turning direction, then the rotation angle of the cube map is determined according to the turning angle, and then the rotation of the cube map around the Y axis of the local coordinate system is controlled according to the rotation direction and the rotation angle. The rotation angle of the cube map is the same as the turning angle of the target object in the local coordinate system, so that the unreal phenomenon that the object turns but the cube map does not turn in the existing cube environment reflection can be avoided, and the reflection effect can be improved.
Step 406: and reflecting the rotated cube map to a target object to obtain environment reflection data.
According to the processing method of the cube map, the cube map corresponding to the environmental reflection of the target object is obtained, the cube map is controlled to rotate according to the motion state of the target object, and the rotated cube map is reflected to the target object to obtain the environmental reflection data. The cube map can be controlled to rotate according to the motion state of the target object, so that the reflecting effect of the target object in the motion state can be reflected by the cube map, the reflection of the cube environment can be more real when the object moves, and the rendering effect of the object is improved.
Fig. 9 is a schematic structural diagram of a first embodiment of a cube map processing apparatus according to the present invention, where the apparatus may be located at a client, and referring to fig. 9, the apparatus includes: an acquisition module 11, a rotation module 12 and a processing module 13, wherein:
the acquisition module 11 is used for acquiring a cube map corresponding to the environmental reflection of the target object;
a rotation module 12, configured to control the cube map to rotate according to a motion state of the target object;
the processing module 13 is configured to reflect the rotated cube map to a target object, so as to obtain environmental reflection data.
According to the processing device for cube maps provided by the embodiment of the invention, the acquisition module 11 acquires the cube maps corresponding to the environmental reflection of the target object, the rotation module 12 controls the cube maps to rotate according to the motion state of the target object, and the processing module 13 reflects the rotated cube maps to the target object to obtain environmental reflection data. The cube map can be controlled to rotate according to the motion state of the target object, so that the reflecting effect of the target object in the motion state can be reflected by the cube map, the reflection of the cube environment can be more real when the object moves, and the rendering effect of the object is improved.
Fig. 10 is a schematic structural diagram of a second embodiment of the cube map processing apparatus according to the present invention, and on the basis of the embodiment shown in fig. 9, the apparatus further includes a building module 14, a determining module 15, and a converting module 16, where:
the establishing module 14 is used for establishing a local coordinate system;
the determining module 15 is configured to determine a conversion relationship between the local coordinate system and the world coordinate system;
the conversion module 16 is configured to convert coordinate values of the cube map in a world coordinate system into coordinate values in the local coordinate system;
the rotation module 13 is specifically configured to:
and controlling the cube map to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system.
Optionally, the rotation module 13 is specifically configured to:
and if the motion state of the target object is the X-axis motion along the local coordinate system, controlling the cube map to rotate around the Z-axis of the local coordinate system.
Optionally, the rotation module 13 is specifically configured to:
determining the movement direction and the movement speed of the target object;
determining a direction of rotation of the cube map based on the direction of motion;
determining a rotation angle of the cube map according to the movement speed;
and controlling the cube map to rotate around the Z axis of the local coordinate system according to the rotation direction and the rotation angle.
Optionally, the determining module 15 is further configured to:
if the target object moves along the positive direction of the X axis of the local coordinate system, determining the rotation direction of the cube map to rotate clockwise around the Z axis; or,
and if the target object moves in the negative direction along the X axis of the local coordinate system, determining the rotation direction of the cube map to be anticlockwise rotation around the Z axis.
Optionally, the rotation module 13 is specifically configured to:
and if the motion state of the target object is turning motion, controlling the cube map to rotate around the Y axis of the local coordinate system.
Optionally, the rotation module 13 is specifically configured to:
determining the turning direction and the turning angle of the target object;
determining a rotation direction of the cube map according to the turning direction;
determining a rotation angle of the cube map according to the turning angle;
and controlling the cube map to rotate around the Y axis of the local coordinate system according to the rotation direction and the rotation angle.
The above device may be used to execute the method provided by the corresponding method embodiment, and the specific implementation manner and technical effects are similar, and are not repeated here.
The above processing modules may be configured as one or more integrated circuits implementing the above methods, for example: one or more application specific integrated circuits (Application Specific Integrated Circuit, abbreviated as ASIC), or one or more microprocessors (digital singnal processor, abbreviated as DSP), or one or more field programmable gate arrays (Field Programmable Gate Array, abbreviated as FPGA), or the like. For another example, when a module above is implemented in the form of a processing element scheduler code, the processing element may be a general-purpose processor, such as a central processing unit (CentralProcessing Unit, CPU) or other processor that may invoke the program code. For another example, the modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).
Fig. 11 is a schematic structural diagram of a client according to another embodiment of the present invention, as shown in fig. 11, where the client at least includes:
a processor;
a memory for storing a computer program of the processor; the method comprises the steps of,
a display for displaying the cube map according to control of the processor;
wherein the processor is configured to implement the method of processing a cube map provided by any of the implementations of the method embodiments described above by executing the computer program.
The present invention also provides a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements a method for processing a cube map provided by any of the foregoing method embodiments.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in hardware plus software functional units.
The integrated units implemented in the form of software functional units described above may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform some of the steps of the methods according to the embodiments of the invention. And the aforementioned storage medium includes: u disk, mobile hard disk, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), magnetic disk or optical disk, etc.
Claims (12)
1. A method for processing a cube map, comprising:
acquiring a cube map corresponding to the environmental reflection of the target object;
according to the motion state of the target object, controlling the cube map to rotate;
reflecting the rotated cube map to the target object to obtain environment reflection data;
and controlling the cube map to rotate according to the motion state of the target object, wherein the method comprises the following steps:
if the motion state of the target object is the motion along the X axis of the local coordinate system, controlling the cube map to rotate around the Z axis of the local coordinate system;
and if the motion state of the target object is turning motion, controlling the cube map to rotate around the Y axis of the local coordinate system.
2. The method of claim 1, wherein prior to controlling the cube map to rotate based on the motion state of the target object, the method further comprises:
establishing a local coordinate system;
determining a conversion relation between a local coordinate system and a world coordinate system;
converting coordinate values of the cube map in a world coordinate system into coordinate values in the local coordinate system;
and controlling the cube map to rotate according to the motion state of the target object, wherein the method comprises the following steps:
and controlling the cube map to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system.
3. The method of claim 1, wherein the controlling the rotation of the cube map about the Z-axis of the local coordinate system comprises:
determining the movement direction and the movement speed of the target object;
determining a direction of rotation of the cube map based on the direction of motion;
determining a rotation angle of the cube map according to the movement speed;
and controlling the cube map to rotate around the Z axis of the local coordinate system according to the rotation direction and the rotation angle.
4. A method according to claim 3, wherein said determining a direction of rotation of said cube map from said direction of movement comprises:
if the target object moves along the positive direction of the X axis of the local coordinate system, determining the rotation direction of the cube map to rotate clockwise around the Z axis; or,
and if the target object moves in the negative direction along the X axis of the local coordinate system, determining the rotation direction of the cube map to be anticlockwise rotation around the Z axis.
5. The method of claim 1, wherein the controlling the rotation of the cube map about the Y-axis of the local coordinate system comprises:
determining the turning direction and the turning angle of the target object;
determining a rotation direction of the cube map according to the turning direction;
determining a rotation angle of the cube map according to the turning angle;
and controlling the cube map to rotate around the Y axis of the local coordinate system according to the rotation direction and the rotation angle.
6. A cube map processing apparatus, comprising:
the acquisition module is used for acquiring a cube map corresponding to the environmental reflection of the target object;
the rotation module is used for controlling the cube map to rotate according to the motion state of the target object;
the processing module is used for reflecting the rotated cube map to a target object to obtain environment reflection data;
the rotating module is specifically used for:
if the motion state of the target object is the motion along the X axis of the local coordinate system, controlling the cube map to rotate around the Z axis of the local coordinate system;
the rotating module is specifically used for:
and if the motion state of the target object is turning motion, controlling the cube map to rotate around the Y axis of the local coordinate system.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the building module is used for building a local coordinate system;
the determining module is used for determining the conversion relation between the local coordinate system and the world coordinate system;
the conversion module is used for converting coordinate values of the cube map in a world coordinate system into coordinate values in the local coordinate system;
the rotating module is specifically used for:
and controlling the cube map to rotate in the local coordinate system according to the motion state of the target object in the local coordinate system.
8. The device according to claim 7, characterized in that said rotation module is in particular adapted to:
determining the movement direction and the movement speed of the target object;
determining a direction of rotation of the cube map based on the direction of motion;
determining a rotation angle of the cube map according to the movement speed;
and controlling the cube map to rotate around the Z axis of the local coordinate system according to the rotation direction and the rotation angle.
9. The apparatus of claim 8, wherein the determining module is further configured to:
if the target object moves along the positive direction of the X axis of the local coordinate system, determining the rotation direction of the cube map to rotate clockwise around the Z axis; or,
and if the target object moves in the negative direction along the X axis of the local coordinate system, determining the rotation direction of the cube map to be anticlockwise rotation around the Z axis.
10. The device according to claim 6, characterized in that said rotation module is in particular adapted to:
determining the turning direction and the turning angle of the target object;
determining a rotation direction of the cube map according to the turning direction;
determining a rotation angle of the cube map according to the turning angle;
and controlling the cube map to rotate around the Y axis of the local coordinate system according to the rotation direction and the rotation angle.
11. A client, comprising:
a processor;
a memory for storing a computer program of the processor; the method comprises the steps of,
a display for displaying the cube map according to control of the processor;
wherein the processor is configured to implement the method of processing a cube map of any of claims 1 to 5 by executing the computer program.
12. A computer-readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the method of processing a cube map according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910138664.7A CN111612883B (en) | 2019-02-25 | 2019-02-25 | Processing method, device and storage medium for cube map |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910138664.7A CN111612883B (en) | 2019-02-25 | 2019-02-25 | Processing method, device and storage medium for cube map |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111612883A CN111612883A (en) | 2020-09-01 |
CN111612883B true CN111612883B (en) | 2024-02-02 |
Family
ID=72201247
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910138664.7A Active CN111612883B (en) | 2019-02-25 | 2019-02-25 | Processing method, device and storage medium for cube map |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111612883B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103635939A (en) * | 2011-02-22 | 2014-03-12 | 索尼电脑娱乐美国公司 | Indirect lighting process for virtual environments |
US9911395B1 (en) * | 2014-12-23 | 2018-03-06 | Amazon Technologies, Inc. | Glare correction via pixel processing |
CN107886552A (en) * | 2016-09-29 | 2018-04-06 | 网易(杭州)网络有限公司 | Stick picture disposing method and apparatus |
-
2019
- 2019-02-25 CN CN201910138664.7A patent/CN111612883B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103635939A (en) * | 2011-02-22 | 2014-03-12 | 索尼电脑娱乐美国公司 | Indirect lighting process for virtual environments |
US9911395B1 (en) * | 2014-12-23 | 2018-03-06 | Amazon Technologies, Inc. | Glare correction via pixel processing |
CN107886552A (en) * | 2016-09-29 | 2018-04-06 | 网易(杭州)网络有限公司 | Stick picture disposing method and apparatus |
Non-Patent Citations (1)
Title |
---|
胡维和 ; 曾巧明 ; .一个高效的动态场景算法.计算机与现代化.2009,(01),全文. * |
Also Published As
Publication number | Publication date |
---|---|
CN111612883A (en) | 2020-09-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107966693B (en) | Vehicle-mounted laser radar simulation method based on depth rendering | |
CN108401461B (en) | Three-dimensional mapping method, device and system, cloud platform, electronic equipment and computer program product | |
CN105404393B (en) | Low latency virtual reality shows system | |
US11074755B2 (en) | Method, device, terminal device and storage medium for realizing augmented reality image | |
WO2017113731A1 (en) | 360-degree panoramic displaying method and displaying module, and mobile terminal | |
CN111737518B (en) | Image display method and device based on three-dimensional scene model and electronic equipment | |
CN110176032A (en) | A kind of three-dimensional rebuilding method and device | |
CN113361365B (en) | Positioning method, positioning device, positioning equipment and storage medium | |
EP3622484A1 (en) | Application of edge effects to 3d virtual objects | |
CN111199573B (en) | Virtual-real interaction reflection method, device, medium and equipment based on augmented reality | |
CN110689626A (en) | Game model rendering method and device | |
Okura et al. | Mixed-reality world exploration using image-based rendering | |
Kolivand et al. | Cultural heritage in marker-less augmented reality: A survey | |
CN111161398A (en) | Image generation method, device, equipment and storage medium | |
CN113345063A (en) | PBR three-dimensional reconstruction method, system and computer storage medium based on deep learning | |
CN114549289A (en) | Image processing method, image processing device, electronic equipment and computer storage medium | |
WO2017113729A1 (en) | 360-degree image loading method and loading module, and mobile terminal | |
CN115187729A (en) | Three-dimensional model generation method, device, equipment and storage medium | |
CN114742956A (en) | Model processing method, device, equipment and computer readable storage medium | |
Schwandt et al. | Glossy reflections for mixed reality environments on mobile devices | |
KR100489572B1 (en) | Image processing method | |
CN111612883B (en) | Processing method, device and storage medium for cube map | |
CN112862981B (en) | Method and apparatus for presenting a virtual representation, computer device and storage medium | |
CN115578432A (en) | Image processing method, image processing device, electronic equipment and storage medium | |
CN109828818B (en) | Primitive style transformation method based on browser-side display engine |
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 |