CN113570696B - Mirror image processing method and device of dynamic model and readable storage medium - Google Patents
Mirror image processing method and device of dynamic model and readable storage medium Download PDFInfo
- Publication number
- CN113570696B CN113570696B CN202111111755.5A CN202111111755A CN113570696B CN 113570696 B CN113570696 B CN 113570696B CN 202111111755 A CN202111111755 A CN 202111111755A CN 113570696 B CN113570696 B CN 113570696B
- Authority
- CN
- China
- Prior art keywords
- mirror image
- reflection
- camera
- mirror
- dynamic model
- 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
Images
Classifications
-
- 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/10—Geometric effects
- G06T15/20—Perspective computation
- G06T15/205—Image-based 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
- G06T15/506—Illumination models
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Graphics (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Geometry (AREA)
- Image Processing (AREA)
Abstract
The invention relates to a mirror image processing method, a device and a readable storage medium of a dynamic model, comprising the following steps: acquiring a point-normal equation of the mirror reflection plane, and calculating a reflection transformation matrix of the mirror reflection plane; according to the reflection transformation matrix, dynamically calculating a mirror image camera corresponding to the original camera; dynamically calculating a mirror reflection map of an original object through a reflection transformation matrix and a mirror camera; and (5) performing attenuation treatment on the transparency of the mirror reflection map. The mirror image processing method of the dynamic model dynamically creates a mirror image camera which is in a mirror image with the original camera, images a mirror image object in a mirror image world through the camera, so as to obtain a mirror image reflection mapping, and performs transparency attenuation processing to simulate a mirror image picture. By the method, the object in the mirror image picture can move along with the movement of the original object, the picture is vivid, and the imaging quality of the game can be greatly improved.
Description
Technical Field
The present invention relates to the field of image processing technologies, and in particular, to a method and an apparatus for processing a mirror image of a dynamic model, and a readable storage medium.
Background
The network game is an individual multiplayer online game which takes the Internet as a transmission medium, a game operator server and a user computer as processing terminals and game client software as an information interaction window. In 3D game scenes, it is often necessary to present a mirror image of a game character or object when the character is near the glass, water surface, or in the character selection interface of the game. The existing mirror processing method has the problems that the picture is not vivid and fine enough, and the mirror image can not be dynamically converted along with the movement of an object or a character, so that the imaging experience of the game is greatly influenced.
Disclosure of Invention
In view of the above, it is desirable to provide a method and an apparatus for processing a mirror image of a dynamic model, and a readable storage medium.
On one hand, the invention provides a mirror image processing method of a dynamic model, which comprises the following steps:
s10: acquiring a point-normal equation of the mirror reflection plane, and calculating a reflection transformation matrix of the mirror reflection plane;
s20: according to the reflection transformation matrix, multiplying the original camera coordinate and the original camera world-to-camera matrix by the reflection transformation matrix respectively to obtain a mirror image camera coordinate and a mirror image camera world-to-camera matrix, and dynamically calculating a mirror image camera corresponding to the original camera;
s30: multiplying the original object by the reflection transformation matrix through the reflection transformation matrix and the mirror image camera to obtain a mirror image object, calculating a mirror image reflection chartlet formed by the mirror image object in the mirror image camera through mirror image camera coordinates and a mirror image camera world rotation matrix, and dynamically calculating the mirror image reflection chartlet of the original object;
s40: and (5) performing attenuation treatment on the transparency of the mirror reflection map.
Further, step S40 includes an attenuation process of applying the mirror reflection map as a color value.
In step S40, among others: the farther the point in the mirror reflection map is from the mirror reflection plane, the darker the color value and the higher the transparency; the closer a point in the specular reflection map is to the specular reflection plane, the brighter its color value and the lower its transparency.
Further, in step S40: the color value decay formula is: color ═ Color × (ColorExp × v)3;
Wherein, Color is a Color value of the reflection map, colorExp is a Color attenuation coefficient, V is a V-axis coordinate of a UV coordinate of the reflection map, an origin of the UV coordinate is positioned at the lower left corner of the reflection map, a V value is between 0 and 1, and the V value at the mirror reflection plane is 1;
the transparency attenuation formula is: alpha ═ Alpha × (AlphaExp × v)3;
Where Alpha is the transparency of the reflection map and Alpha exp is the transparency attenuation coefficient.
Furthermore, the image and the reflection map of the original object both store the data of the occlusion relationship.
In another aspect, the present invention provides a mirror image processing apparatus of a dynamic model, including:
a reflection matrix module: acquiring a point-normal equation of the mirror reflection plane, and calculating a reflection transformation matrix of the mirror reflection plane;
a mirror image camera module: according to the reflection transformation matrix, multiplying the original camera coordinate and the original camera world-to-camera matrix by the reflection transformation matrix respectively to obtain a mirror image camera coordinate and a mirror image camera world-to-camera matrix, and dynamically calculating a mirror image camera corresponding to the original camera;
reflection mapping module: multiplying the original object by the reflection transformation matrix through the reflection transformation matrix and the mirror image camera to obtain a mirror image object, calculating a mirror image reflection chartlet formed by the mirror image object in the mirror image camera through mirror image camera coordinates and a mirror image camera world rotation matrix, and dynamically calculating the mirror image reflection chartlet of the original object;
an attenuation processing module: and (5) performing attenuation treatment on the transparency of the mirror reflection map.
In another aspect, the present invention provides a device for processing a mirror image of a dynamic model, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method for processing a mirror image of a dynamic model as described above when executing the computer program.
In yet another aspect, the present invention further provides a readable storage medium for mirror image processing of a dynamic model, on which a computer program is stored, which computer program, when executed by a processor, implements the steps of the mirror image processing method of a dynamic model as described above.
According to the technical scheme, the mirror image camera which is in a mirror image with the original camera is dynamically created, the mirror image object in the mirror image world is imaged through the camera, so that a mirror image reflection map is obtained, transparency attenuation processing is carried out, and a mirror image picture is simulated. By the method, the object in the mirror image picture can move along with the movement of the original object, the picture is vivid, and the imaging quality of the game can be greatly improved.
Drawings
FIG. 1 is a flowchart illustrating steps of a method for processing a mirror image of a dynamic model according to an embodiment of the present invention.
Fig. 2 is a schematic image diagram of a mirror image processing method of a dynamic model according to an embodiment of the present invention.
FIG. 3 is a processing effect diagram of an embodiment of a mirror image processing method of a dynamic model according to the present invention.
In the drawings, the components represented by the respective reference numerals are listed below:
1. a mirror reflection plane; 2. an original camera; 3. a mirror image camera; 4. an original object.
Detailed Description
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below. It is apparent that the specific details set forth in the following description are merely exemplary of the invention, which can be practiced in many other embodiments that depart from the specific details disclosed herein. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without any inventive step, are within the scope of the present invention.
It will be understood that when an element is referred to as being "secured to" another element, it can be directly on the other element or intervening elements may also be present. When an element is referred to as being "connected" to another element, it can be directly connected to the other element or intervening elements may also be present. The terms "vertical," "horizontal," "left," "right," and the like as used herein are for illustrative purposes only and do not represent the only embodiments.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
In an embodiment, referring to fig. 1, fig. 2 and fig. 3, a method for processing a mirror image of a dynamic model includes the steps of:
s10: acquiring a point-normal equation of the mirror reflection plane 1, and calculating a reflection transformation matrix of the mirror reflection plane 1;
it should be noted that a plane pi can be completely defined by any point on pi and any vector perpendicular to pi, and can be expressed in the form of N · P + D ═ 0, which is a point-normal equation of the plane. According to the law of reflection of light and the characteristic that the image formed by the plane mirror and the object are symmetrical about the mirror surface, a point-method equation of the plane is combined, and a transformation matrix for reflection can be deduced.
S20: in the scene of the model, according to the reflection transformation matrix, multiplying the coordinates of the original camera 2 and the world-to-camera matrix of the original camera 2 by the reflection transformation matrix respectively to obtain the coordinates of the mirror image camera 3 and the world-to-camera matrix of the mirror image camera 3, and dynamically calculating the mirror image camera 3 corresponding to the original camera 2; the mirror image camera 3 and the original camera 2 are symmetrical about a plane;
s30: multiplying the original object 4 by the reflection transformation matrix through the reflection transformation matrix and the mirror image camera 3 to obtain a mirror image object, calculating a mirror image reflection map formed by the mirror image object in the mirror image camera 3 through the coordinates of the mirror image camera 3 and the world camera transformation matrix of the mirror image camera 3, and dynamically calculating the mirror image reflection map of the original object 4;
s40: and (5) performing attenuation treatment on the transparency of the mirror reflection map.
According to the technical scheme, the mirror image camera 3 which is in a mirror image with the original camera 2 is dynamically created, a mirror image object in a mirror image world is imaged through the mirror image camera, so that a mirror image reflection map is obtained, transparency attenuation processing is carried out, and a mirror image picture is simulated. By the method, the object in the mirror image picture can move along with the movement of the original object 4, the picture is vivid, and the imaging quality of the game can be greatly improved.
In addition to this embodiment, step S40 further includes an attenuation process of applying the mirror reflection map as a color value.
On the basis of the present embodiment, further, in step S40: the farther the point in the mirror reflection map is from the mirror reflection plane 1, the darker the color value and the higher the transparency; the closer a point in the specular reflection map is to the specular reflection plane 1, the brighter its color value and the lower its transparency.
On the basis of the present embodiment, further, in step S40: the color value decay formula is: color ═ Color × (ColorExp × v)3;
Wherein, Color is a Color value of the reflection map, colorExp is a Color attenuation coefficient, V is a V-axis coordinate of a UV coordinate of the reflection map, an origin of the UV coordinate is positioned at the lower left corner of the reflection map, a V value is between 0 and 1, and the V value at the position of a mirror reflection plane 1 is 1;
the transparency attenuation formula is: alpha ═ Alpha × (AlphaExp × v)3;
Where Alpha is the transparency of the reflection map and Alpha exp is the transparency attenuation coefficient.
It should be noted that, in the fragment shader, the reflection map is blackened and lightened in color value and transparency in the direction of the vertical axis according to a certain attenuation coefficient to simulate the effect that the image is darker than the real image when the object is diffusely reflected on the rough plane. The attenuation coefficient is opened in the Shader for the fine arts to adjust, and the effect can be visually adjusted. The color value attenuation formula and the transparency attenuation formula may be other formulas, which are not limited to the formulas described in this embodiment.
It should be noted that the third power of the transparency attenuation formula and the color value attenuation formula can be adjusted according to the art experience, which is a preferable scheme. But it may also be changed to a quadratic, a quartic, etc., and is not described as a limitation in the present embodiment.
In addition to this embodiment, the image and the reflection map of the original object 4 both store occlusion relationship data.
It can be understood that the two maps, i.e. the picture of the original object 4 and the reflection map, both store depth information, i.e. data of the occlusion relationship, and by this arrangement, there is no need to worry about that the foot plate of the figure, which is inverted, will be transmitted to the upper side of the mirror reflection plane.
In another embodiment of the present invention, the mirror image processing method of the dynamic model further includes, in addition to the above, the steps of: the reflection map is processed by noise and shade, so that the mirror surface presents a mottled feeling of an old mirror. Or shifting the pixels according to the texture of the water surface to simulate ripples of the water surface.
When the noise point is processed, a noise texture is used, the noise texture is sampled when the map is rendered, and then the colors are overlapped or removed according to the sampled colors. And the water wave treatment is as follows: when the noise texture is sampled, the uv coordinate used in sampling is shifted to a certain extent according to time, and the water surface effect can be moved.
Of course, the mirror image processing method may be other, which is not described as a limitation in the embodiment.
In another aspect, the present invention provides a mirror image processing apparatus of a dynamic model, including:
a reflection matrix module: acquiring a point-normal equation of the mirror reflection plane 1, and calculating a reflection transformation matrix of the mirror reflection plane 1;
a mirror image camera module: according to the reflection transformation matrix, dynamically calculating a mirror image camera 3 corresponding to the original camera 2;
reflection mapping module: the mirror reflection mapping of the original object 4 is dynamically calculated through the reflection transformation matrix and the mirror image camera 3;
an attenuation processing module: and (5) performing attenuation treatment on the transparency of the mirror reflection map.
In another aspect, the present invention provides a device for processing a mirror image of a dynamic model, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the method for processing a mirror image of a dynamic model as above when executing the computer program.
In yet another aspect, the present invention further provides a readable storage medium for mirror image processing of a dynamic model, on which a computer program is stored, which computer program, when executed by a processor, implements the steps of the above mirror image processing method of a dynamic model.
By the method, the object in the mirror image can move along with the movement of the original object 4, the image is vivid, the imaging quality of the game can be greatly improved, and various special effects can be achieved through image processing such as transparency attenuation, color value attenuation, noise simulation, water surface simulation and the like, so that the image effect is improved.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only show some embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for those skilled in the art, various changes, substitutions and alterations can be made without departing from the spirit and scope of the invention. Therefore, the protection scope of the present invention should be subject to the claims.
Claims (8)
1. A mirror image processing method of a dynamic model is characterized by comprising the following steps:
s10: acquiring a point-normal equation of the mirror reflection plane, and calculating a reflection transformation matrix of the mirror reflection plane;
s20: according to the reflection transformation matrix, multiplying the original camera coordinate and the original camera world-to-camera matrix by the reflection transformation matrix respectively to obtain a mirror image camera coordinate and a mirror image camera world-to-camera matrix, and dynamically calculating a mirror image camera corresponding to the original camera;
s30: multiplying the original object by the reflection transformation matrix through the reflection transformation matrix and the mirror image camera to obtain a mirror image object, calculating a mirror image reflection chartlet formed by the mirror image object in the mirror image camera through mirror image camera coordinates and a mirror image camera world rotation matrix, and dynamically calculating the mirror image reflection chartlet of the original object;
s40: and (5) performing attenuation treatment on the transparency of the mirror reflection map.
2. The method for processing a mirror image of a dynamic model according to claim 1, wherein step S40 further comprises attenuating the mirror reflection map by a color value.
3. A mirror image processing method of a dynamic model according to claim 2, wherein in step S40: the farther the point in the mirror reflection map is from the mirror reflection plane, the darker the color value and the higher the transparency; the closer a point in the specular reflection map is to the specular reflection plane, the brighter its color value and the lower its transparency.
4. A mirror image processing method of a dynamic model according to claim 3, wherein in step S40: the color value decay formula is: color ═ Color × (ColorExp × v)3
Wherein, Color is a Color value of the reflection map, colorExp is a Color attenuation coefficient, V is a V-axis coordinate of a UV coordinate of the reflection map, an origin of the UV coordinate is positioned at the lower left corner of the reflection map, a V value is between 0 and 1, and the V value at the mirror reflection plane is 1;
the transparency attenuation formula is: alpha ═ Alpha × (AlphaExp × v)3
Where Alpha is the transparency of the reflection map and Alpha exp is the transparency attenuation coefficient.
5. A method for processing a mirror image of a dynamic model according to claim 1, wherein occlusion relation data is stored in both the picture of the original object and the reflection map.
6. A mirror image processing apparatus of a dynamic model, comprising:
a reflection matrix module: acquiring a point-normal equation of the mirror reflection plane, and calculating a reflection transformation matrix of the mirror reflection plane;
a mirror image camera module: according to the reflection transformation matrix, multiplying the original camera coordinate and the original camera world-to-camera matrix by the reflection transformation matrix respectively to obtain a mirror image camera coordinate and a mirror image camera world-to-camera matrix, and dynamically calculating a mirror image camera corresponding to the original camera;
reflection mapping module: multiplying the original object by the reflection transformation matrix through the reflection transformation matrix and the mirror image camera to obtain a mirror image object, calculating a mirror image reflection chartlet formed by the mirror image object in the mirror image camera through mirror image camera coordinates and a mirror image camera world rotation matrix, and dynamically calculating the mirror image reflection chartlet of the original object;
an attenuation processing module: and (5) performing attenuation treatment on the transparency of the mirror reflection map.
7. A mirror image processing apparatus for a dynamic model, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein: the steps of the mirror image processing method of the dynamic model according to claims 1 to 5 are implemented when the processor executes the program.
8. A readable storage medium for mirror image processing of a dynamic model, having a computer program stored thereon, characterized by: the computer program implementing the steps of the mirror image processing method of a dynamic model as claimed in claims 1 to 5 when executed by a processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111111755.5A CN113570696B (en) | 2021-09-23 | 2021-09-23 | Mirror image processing method and device of dynamic model and readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111111755.5A CN113570696B (en) | 2021-09-23 | 2021-09-23 | Mirror image processing method and device of dynamic model and readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113570696A CN113570696A (en) | 2021-10-29 |
CN113570696B true CN113570696B (en) | 2022-01-11 |
Family
ID=78174140
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111111755.5A Active CN113570696B (en) | 2021-09-23 | 2021-09-23 | Mirror image processing method and device of dynamic model and readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113570696B (en) |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101149841A (en) * | 2007-07-06 | 2008-03-26 | 浙江大学 | Simulation Method of Convex Mirror Effect in 3D Application Program |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103544731B (en) * | 2013-09-30 | 2016-08-17 | 北京航空航天大学 | A kind of quick reflex method for drafting based on polyphaser |
US10949956B2 (en) * | 2018-04-06 | 2021-03-16 | Google Llc | Enhanced specular reflections for inserted content |
CN111652963B (en) * | 2020-05-07 | 2023-05-02 | 浙江大学 | Augmented reality drawing method based on neural network |
CN112435304B (en) * | 2020-07-20 | 2023-03-14 | 上海哔哩哔哩科技有限公司 | Water body interactive mapping method and system |
CN112233216B (en) * | 2020-12-18 | 2021-03-02 | 成都完美时空网络技术有限公司 | Game image processing method and device and electronic equipment |
CN112819929B (en) * | 2021-03-05 | 2024-02-23 | 网易(杭州)网络有限公司 | Water surface rendering method and device, electronic equipment and storage medium |
-
2021
- 2021-09-23 CN CN202111111755.5A patent/CN113570696B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101149841A (en) * | 2007-07-06 | 2008-03-26 | 浙江大学 | Simulation Method of Convex Mirror Effect in 3D Application Program |
Non-Patent Citations (2)
Title |
---|
Mirror Surface Reconstruction under an Uncalibrated Camera;Kai Han等;《IEEE》;20161212;1772-1780 * |
镜像优化FDOT系统成像过程的计算机仿真;符吉祥等;《科技创新与应用》;20171208(第34期);27+29 * |
Also Published As
Publication number | Publication date |
---|---|
CN113570696A (en) | 2021-10-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR100369909B1 (en) | Apparatus and method for modifying original images | |
US6717586B2 (en) | Apparatus, method, program code, and storage medium for image processing | |
Gibson et al. | Rapid shadow generation in real-world lighting environments | |
CN113240783B (en) | Stylized rendering method and device, readable storage medium and electronic equipment | |
Sun | A new single-image fog removal algorithm based on physical model | |
US20170316597A1 (en) | Texturing a three-dimensional scanned model with localized patch colors | |
WO2022063260A1 (en) | Rendering method and apparatus, and device | |
US7508390B1 (en) | Method and system for implementing real time soft shadows using penumbra maps and occluder maps | |
CN114832375A (en) | Ambient light shielding processing method, device and equipment | |
CN118736092A (en) | A method and system for rendering virtual human at any viewing angle based on three-dimensional Gaussian splashing | |
CN106204418B (en) | Image warping method based on matrix inversion operation in a kind of virtual reality mobile terminal | |
Ma et al. | Neural compositing for real-time augmented reality rendering in low-frequency lighting environments | |
JP2973573B2 (en) | Image conversion device | |
CN113570696B (en) | Mirror image processing method and device of dynamic model and readable storage medium | |
Kosloff et al. | Depth of field postprocessing for layered scenes using constant-time rectangle spreading. | |
CN116664752B (en) | Method, system and storage medium for realizing panoramic display based on patterned illumination | |
CN117078849A (en) | Normal map generation method and device | |
US9514566B2 (en) | Image-generated system using beta distribution to provide accurate shadow mapping | |
CN114170071A (en) | An image processing method, device, equipment and medium | |
Rößing et al. | Real‐Time Disparity Map‐Based Pictorial Depth Cue Enhancement | |
CN111010559A (en) | Method and device for generating naked eye three-dimensional light field content | |
CN118674853B (en) | Three-dimensional model surface skin rendering method, system, storage medium and equipment | |
CN119540447A (en) | Method and device for generating virtual object | |
CN108876912A (en) | Three-dimensional scenic physics renders method and its system | |
CN111354064B (en) | Texture image generation method and device |
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 |