A graphics processing method and system based on Unity scene

By obtaining the sub-model spacing of the 3D model in the Unity scene, calculating the magnification ratio and adjusting the near spacing of the camera, the Z-Fighting problem in complex scenes is solved, and the graphics processing quality and visual effects are improved.

CN118552704BActive Publication Date: 2024-10-01江西格如灵科技有限公司
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202411018183.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-29
Publication Date
2024-10-01
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

In the Unity game development engine, the Z-Fighting phenomenon caused by depth buffer accuracy issues in complex scenes is unavoidable, and traditional solutions have limited effects or complicated operations.

Method used

By obtaining the sub-model distance of the 3D model, calculating the magnification ratio and adjusting the near distance of the camera, the depth interval between objects is increased and the occurrence of Z-Fighting is reduced.

Benefits of technology

Effectively reduce or eliminate the Z-Fighting phenomenon, improve graphics processing quality and visual effects, and avoid near-plane clipping problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118552704B_ABST
    Figure CN118552704B_ABST
Patent Text Reader

Abstract

The present invention provides a graphics processing method and system based on a Unity scene. The method obtains a 3D model, wherein the 3D model includes at least two independent sub-models, determines a flickering area under a near spacing of a current camera, and a corresponding sub-model spacing; obtains a preset size and a current size of each sub-model, and determines a magnification ratio according to the preset size and the current size of each sub-model; determines an adjustment range of the near spacing according to the magnification ratio and the near spacing of the current camera; controls the sub-model and the sub-model spacing to be magnified according to the magnification ratio, and controls the near spacing of the camera to be close to the magnified flickering area according to the adjustment range of the near spacing. Specifically, the depth interval between objects is increased by adjusting the physical size of the model and the observation position of the camera, thereby reducing the occurrence of Z-Fighting.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer graphics, and in particular relates to a graphics processing method and system based on a Unity scene. Background Art

[0002] Z-fighting is a common problem in computer graphics, especially when creating complex scenes using game development engines such as Unity. Z-fighting usually occurs when the depth values ​​of two or more objects are very close during processing, resulting in unstable processing results, flickering, interlaced display and other poor visual effects. This is mainly due to the precision limitations of computer graphics processors and the characteristics of the depth buffer mechanism.

[0003] In Unity, although a variety of tools and settings are provided to help developers reduce Z-Fighting, these problems are still difficult to avoid in complex scenes, especially when objects are closely arranged or require fine depth control.

[0004] Traditional solutions, such as adjusting the processing order of objects or modifying the depth buffer mechanism, often have limited effects or are complex to operate. Furthermore, since adjusting parameters affects other functional effects, they are not applicable to all situations. Summary of the invention

[0005] Based on this, an embodiment of the present invention provides a graphics processing method and system based on a Unity scene, aiming to reduce or eliminate the Z-Fighting phenomenon caused by depth buffer accuracy problems in complex Unity scenes, and improve the quality and visual effects of graphics processing.

[0006] A first aspect of an embodiment of the present invention provides a graphics processing method based on a Unity scene, which is applied to a Unity scene, and there is a gap between models. The method includes:

[0007] Acquire a 3D model, the 3D model including at least two independent sub-models, determine a flickering area at a near distance of a current camera, and a corresponding sub-model distance;

[0008] Obtaining a preset size and a current size of each sub-model, and determining an enlargement ratio according to the preset size and the current size of each sub-model;

[0009] Determining an adjustment range of the near spacing according to the magnification ratio and the near spacing of the current camera;

[0010] According to the magnification ratio, the sub-model and the sub-model spacing are controlled to be magnified, and according to the adjustment range of the near spacing, the near spacing of the camera is controlled to be close to the magnified flickering area.

[0011] Furthermore, the step of obtaining a 3D model, wherein the 3D model includes at least two independent sub-models, and determining a flickering area at a near distance of a current camera and a corresponding sub-model distance includes:

[0012] Acquire a 3D model, and assign a single color to each sub-model in the 3D model, wherein the assigned color includes one of red, green, and blue, and adjacent sub-models have different colors;

[0013] At the near distance of the current camera, the image of the 3D model is acquired in real time, and the pixel value of the image is obtained, and the flickering area is determined according to the change of the pixel value of the image;

[0014] According to the flickering area, the target parts of the corresponding sub-models are determined, and according to the target parts of the sub-models, the distances between the target parts of the sub-models are determined.

[0015] Furthermore, the step of acquiring an image of the 3D model in real time at the near distance of the current camera, acquiring pixel values ​​of the image, and determining the flickering area according to changes in the pixel values ​​of the image includes:

[0016] Determine a sub-model as a first model, and a sub-model adjacent to the first model as a second model;

[0017] Obtaining a first pixel value of the first model and a second pixel value of the second model, determining in real time a coordinate point where the first pixel value changes to the second pixel value according to the first pixel value and the second pixel value, and combining adjacent coordinate points to form an image with a change area in real time;

[0018] Overlapping a plurality of images having a change region, obtaining overlapping parts and non-overlapping parts of the change region, and combining the overlapping parts and non-overlapping parts of the change region to obtain a known change region;

[0019] The estimated change region is inferred based on the known change region, and the known change region and the estimated change region are combined to obtain the flickering region.

[0020] Furthermore, the step of inferring an estimated change region based on a known change region, and combining the known change region and the estimated change region to obtain the flicker region comprises:

[0021] According to the known change area, determining whether a closed area is formed in the known change area;

[0022] If it is determined that a closed area is formed in the known change area, the pixel values ​​of the pixels in the closed area are replaced with the pixel values ​​of the known change area to obtain a first estimated change area;

[0023] combining the first estimated change region and the known change region to obtain a first target region, and determining a contour of the first target region;

[0024] The contour is matched with the first model in similarity, a second target area on the first model is determined, and the second target area is determined as the scintillation area.

[0025] Furthermore, the step of performing similarity matching between the contour and the first model, determining a second target area on the first model, and determining the second target area as the scintillation area includes:

[0026] Determine whether there is a vertex in the contour;

[0027] If it is determined that there is a vertex in the contour, the coordinates of the vertex are determined, and according to the coordinates of the vertex, associated coordinates within a preset range are determined to form a coordinate grid;

[0028] According to the coordinate grid, matching is performed on the first model to determine a second target area on the first model, and the second target area is determined as the scintillation area;

[0029] If it is determined that there is no vertex in the contour, first determine the coordinate point on the first model that is closest to the second model, take the coordinate point on the first model that is closest to the second model as the reference point, match on the first model with a preset step, determine the second target area on the first model, and determine the second target area as the flashing area.

[0030] Furthermore, in the step of determining the target parts of each sub-model corresponding to the flashing area, and determining the spacing between the target parts of each sub-model based on the target parts of each sub-model, all coordinate positions in the spacing between the target parts of each sub-model that satisfy a preset spacing range are determined, and all coordinate positions are clustered to obtain the target coordinate position, which is used to determine the near spacing of the camera.

[0031] Furthermore, in the step of controlling the sub-model and the sub-model spacing to be enlarged according to the magnification ratio, and controlling the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing, the near spacing of the camera is set according to the target coordinate position, wherein after the near spacing of the camera is set, it does not interfere with the 3D model to avoid near plane clipping.

[0032] A second aspect of an embodiment of the present invention provides a graphics processing system based on a Unity scene, which is applied to a Unity scene, and there is a gap between models. The system includes:

[0033] A first acquisition module is used to acquire a 3D model, wherein the 3D model includes at least two independent sub-models, and determine a flickering area at a near distance of a current camera and a corresponding sub-model distance;

[0034] A second acquisition module, used to acquire a preset size and a current size of each sub-model, and determine an enlargement ratio according to the preset size and the current size of each sub-model;

[0035] A determination module, used to determine an adjustment range of the near distance according to the magnification ratio and the near distance of the current camera;

[0036] The control module is used to control the sub-model and the sub-model spacing to be enlarged according to the enlargement ratio, and control the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing.

[0037] A third aspect of an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the graphics processing method based on a Unity scene provided in the first aspect.

[0038] A fourth aspect of an embodiment of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the graphics processing method based on the Unity scene provided in the first aspect is implemented.

[0039] The implementation of a graphics processing method, system, storage medium and device based on a Unity scene provided in the embodiments of the present invention has the following beneficial effects:

[0040] By acquiring a 3D model, the 3D model includes at least two independent sub-models, determining a flickering area under a near spacing of a current camera and a corresponding sub-model spacing; acquiring a preset size and a current size of each sub-model, and determining a magnification ratio according to the preset size and the current size of each sub-model; determining an adjustment range of the near spacing according to the magnification ratio and the near spacing of the current camera; controlling the sub-models and the sub-model spacing to be magnified according to the magnification ratio, and controlling the near spacing of the camera to be close to the magnified flickering area according to the adjustment range of the near spacing. Specifically, by adjusting the physical size of the model and the observation position of the camera, the depth interval between objects is increased, thereby reducing the occurrence of Z-Fighting. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a flowchart of an implementation of a graphics processing method based on a Unity scene provided by the first embodiment of the present invention;

[0042] Figure 2 is a structural block diagram of a graphics processing system based on a Unity scene provided by a third embodiment of the present invention;

[0043] Figure 3 It is a structural block diagram of an electronic device provided by the fourth embodiment of the present invention. DETAILED DESCRIPTION

[0044] In order to facilitate the understanding of the present invention, the present invention will be described more fully below with reference to the relevant drawings. Several embodiments of the present invention are given in the drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, the purpose of providing these embodiments is to make the disclosure of the present invention more thorough and comprehensive.

[0045] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be a central element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be a central element at the same time. The terms "vertical", "horizontal", "left", "right" and similar expressions used herein are for illustrative purposes only.

[0046] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which the present invention belongs. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more of the related listed items.

[0047] Embodiment 1

[0048] See also Figure 1 , Figure 1 A graphics processing method based on a Unity scene provided by Embodiment 1 of the present invention is shown, which is applied to a Unity scene, and there is a spacing between models. The Z-Fighting problem arises because the spacing between models is too small, resulting in a small accuracy difference in the depth buffer, sometimes model A passes, sometimes model B passes, which is actually manifested as a color flickering switch on the surface of the model. The method specifically includes steps S01 to S04.

[0049] Step S01, obtaining a 3D model, wherein the 3D model includes at least two independent sub-models, and determining a flickering area at a near distance of a current camera and a corresponding sub-model distance.

[0050] Among them, a complete 3D model may be composed of multiple independent sub-models. When some parts of adjacent sub-models are closely spaced, flickering is likely to occur.

[0051] It should be noted that in the 3D camera settings, the near clipping plane is a virtual plane that sets the closest distance that the camera can render. Any object or scene part in front of this plane will not be rendered by the camera or displayed in the final image. In other words, the near distance of the camera determines the rendering range.

[0052] In this embodiment, the corresponding sub-model distance is the shortest physical distance between two sub-models.

[0053] Step S02, obtaining a preset size and a current size of each sub-model, and determining an enlargement ratio according to the preset size and the current size of each sub-model.

[0054] It can be understood that the magnification ratio is obtained by dividing the preset size by the current size.

[0055] Step S03, determining an adjustment range of the near distance according to the magnification ratio and the near distance of the current camera.

[0056] Multiply the current camera's near spacing by the magnification ratio to get the magnification value of the near spacing. That is, when the model size is enlarged, the near spacing is also enlarged. However, at this time, the enlarged near spacing is not set as the final near spacing, but is selected and adjusted within the range between the initial near spacing and the enlarged near spacing.

[0057] Step S04, according to the magnification ratio, controlling the sub-model and the sub-model spacing to be magnified, and according to the adjustment range of the near spacing, controlling the near spacing of the camera to be close to the magnified flickering area.

[0058] Specifically, according to the magnification ratio, the sub-model and the sub-model spacing are controlled to be magnified, that is, the geometric size is magnified, and at the same time, the scale of the model's texture and associated materials is adjusted to ensure the consistency of the visual effect. Finally, within the adjustment range of the near spacing, the camera's near spacing is controlled to be close to the magnified flickering area.

[0059] For example, the 3D spatial positions of two sub-models are 1.10 and 1.14 respectively by default. The spacing between the models is 1.14-1.10=0.04, and the depth value accuracy of the corresponding position is 0.05. Then, if 1.10 is used as the benchmark, 1.05~1.15 will be directly judged to be at the same depth value as 1.10, resulting in a Z-Fighting problem.

[0060] If we enlarge the sub-model and move it farther away, and if we choose to enlarge the sub-model 100 times, the distance between the two sub-models will become 0.04×100 = 4. At this time, since the distance between the sub-model and the camera has also increased by 100 times, the depth value accuracy at the corresponding position of the two sub-models is 0.05×100 = 5. Then, based on 1.10×100 = 110, 105~115 will be directly judged to be at the same depth value as 110, and the Z-Fighting problem will still occur.

[0061] At this time, if the camera's near distance is also increased to 100 times and moved to a distance of 3 from the camera, the actual effect is the same as before zooming in, and the problem of camera near plane clipping also occurs; but in actual operation, only the model and model position are zoomed in, and the camera near is not modified. Through this feature of the 3D display camera, the zoom operation has solved the near plane clipping problem; but the Z-Fighting problem still exists. Clipping occurs when near is 0.03 in the default state. If near is reduced, the movable range is only between 0 and 0.03, which is difficult to control. Even if it can be adjusted to a reasonable value to ensure no clipping, the original model depth value at Z-Fighting becomes more accurate due to the reduction of near, which aggravates the flickering problem.

[0062] The embodiment of the present invention magnifies the model and combines the near characteristic of the 3D camera. If near changes between 0 and 3, near can be enlarged. At this time, the overall coordinate axis of the depth value accuracy change curve moves with near, so that the distance between the original flickering model and near becomes smaller, and the depth value accuracy becomes higher, so that it is easy to distinguish the depth sizes of the two sub-models, display the correct image on the screen, and solve the Z-Fighting problem.

[0063] In summary, the graphics processing method based on the Unity scene in the above-mentioned embodiment of the present invention obtains a 3D model, and the 3D model includes at least two independent sub-models, determines the flickering area under the near distance of the current camera, and the corresponding sub-model spacing; obtains a preset size and the current size of each sub-model, and determines the magnification ratio according to the preset size and the current size of each sub-model; determines the adjustment range of the near spacing according to the magnification ratio and the near spacing of the current camera; controls the sub-model and the sub-model spacing to be enlarged according to the magnification ratio, and controls the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing. Specifically, the depth interval between objects is increased by adjusting the physical size of the model and the observation position of the camera, thereby reducing the occurrence of Z-Fighting.

[0064] Embodiment 2

[0065] Embodiment 2 of the present invention also provides a graphics processing method based on a Unity scene, which is different from the graphics processing method based on a Unity scene provided in Embodiment 1 of the present invention in that the near spacing of the camera is further determined to optimize the rendering effect. Specifically, the step of obtaining a 3D model, the 3D model including at least two independent sub-models, and determining the flickering area at the near spacing of the current camera and the corresponding sub-model spacing includes:

[0066] Acquire a 3D model, and assign a single color to each sub-model in the 3D model, wherein the assigned color includes one of red, green, and blue, and adjacent sub-models have different colors;

[0067] At the near distance of the current camera, the image of the 3D model is acquired in real time, and the pixel value of the image is obtained. According to the change of the pixel value of the image, the flickering area is determined, which includes:

[0068] Determine a sub-model as a first model, and a sub-model adjacent to the first model as a second model;

[0069] Obtaining a first pixel value of the first model and a second pixel value of the second model, determining in real time a coordinate point where the first pixel value changes to the second pixel value according to the first pixel value and the second pixel value, and combining adjacent coordinate points to form an image with a change area in real time;

[0070] Overlapping a plurality of images having a change region, obtaining overlapping parts and non-overlapping parts of the change region, and combining the overlapping parts and non-overlapping parts of the change region to obtain a known change region;

[0071] The method further comprises: inferring an estimated change region according to a known change region, and combining the known change region and the estimated change region to obtain the flicker region.

[0072] According to the known change area, determining whether a closed area is formed in the known change area;

[0073] If it is determined that a closed area is formed in the known change area, the pixel values ​​of the pixels in the closed area are replaced with the pixel values ​​of the known change area to obtain a first estimated change area;

[0074] combining the first estimated change region and the known change region to obtain a first target region, and determining a contour of the first target region;

[0075] Performing similarity matching between the contour and the first model, determining a second target area on the first model, and determining the second target area as the scintillation area specifically includes:

[0076] Determine whether there is a vertex in the contour;

[0077] If it is determined that there is a vertex in the contour, the coordinates of the vertex are determined, and according to the coordinates of the vertex, associated coordinates within a preset range are determined to form a coordinate grid;

[0078] According to the coordinate grid, matching is performed on the first model to determine a second target area on the first model, and the second target area is determined as the scintillation area;

[0079] If it is determined that there is no vertex in the contour, first determine the coordinate point on the first model that is closest to the second model, use the coordinate point on the first model that is closest to the second model as a reference point, perform matching on the first model at a preset step, determine a second target area on the first model, and determine the second target area as the flashing area;

[0080] According to the flickering area, the target parts of the corresponding sub-models are determined, and according to the target parts of the sub-models, the distance between the target parts of the sub-models is determined, wherein all coordinate positions that meet the preset distance range in the distance between the target parts of the sub-models are determined, and all coordinate positions are clustered. The clustering can be performed using the K-Means method to obtain the target coordinate position, and the target coordinate position is used to determine the near distance of the camera.

[0081] In the step of controlling the sub-model and the sub-model spacing to be enlarged according to the enlargement ratio, and controlling the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing, the near spacing of the camera is set according to the target coordinate position. It can be understood that the near spacing of the camera is set at a preset position of the target coordinate position, wherein after the near spacing of the camera is set, it does not interfere with the 3D model to avoid near plane clipping. If there is interference, the near spacing of the camera is set to be away from the interfering part with a preset step.

[0082] Embodiment 3

[0083] See also Figure 2 , Figure 2 : is a structural block diagram of a graphics processing system 200 based on a Unity scene provided by a third embodiment of the present invention. The graphics processing system 200 based on a Unity scene is applied to a Unity scene, and there is a gap between models. Specifically, it includes: a first acquisition module 21, a second acquisition module 22, a determination module 23 and a control module 24, wherein:

[0084] A first acquisition module 21 is used to acquire a 3D model, wherein the 3D model includes at least two independent sub-models, and determine a flickering area at a near distance of a current camera and a corresponding sub-model distance;

[0085] A second acquisition module 22 is used to acquire a preset size and a current size of each sub-model, and determine an enlargement ratio according to the preset size and the current size of each sub-model;

[0086] A determination module 23, configured to determine an adjustment range of the near distance according to the magnification ratio and the near distance of the current camera;

[0087] The control module 24 is used to control the sub-model and the sub-model spacing to be enlarged according to the enlargement ratio, and control the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing, and set the near spacing of the camera according to the target coordinate position, wherein after the near spacing of the camera is set, it does not interfere with the 3D model to avoid near plane clipping.

[0088] Further, in some optional embodiments of the present invention, the first acquisition module 21 includes:

[0089] A first acquisition unit is used to acquire a 3D model, and assign a single color to each sub-model in the 3D model, wherein the assigned color includes one of red, green, and blue, and adjacent sub-models have different colors;

[0090] The second acquisition unit is used to acquire the image of the 3D model in real time at the near distance of the current camera, and acquire the pixel value of the image, and determine the flickering area according to the change of the pixel value of the image;

[0091] A first determination unit is used to determine the target parts of each sub-model corresponding to the flickering area, and determine the spacing between the target parts of each sub-model according to the target parts of each sub-model, wherein all coordinate positions that meet a preset spacing range in the spacing between the target parts of each sub-model are determined, and all coordinate positions are clustered to obtain a target coordinate position, and the target coordinate position is used to determine the near spacing of the camera.

[0092] Further, in some optional embodiments of the present invention, the second acquiring unit includes:

[0093] A first determining sub-unit, configured to determine a sub-model as a first model, and a sub-model adjacent to the first model as a second model;

[0094] A first combining subunit is used to obtain a first pixel value of the first model and a second pixel value of the second model, determine in real time a coordinate point where the first pixel value changes to the second pixel value according to the first pixel value and the second pixel value, and combine adjacent coordinate points to form an image with a changed area in real time;

[0095] A second combining subunit is used to overlap a plurality of images having a change region, obtain an overlapping portion and a non-overlapping portion of the change region, and combine the overlapping portion and the non-overlapping portion of the change region to obtain a known change region;

[0096] The third combining subunit is used to infer the estimated change area according to the known change area, and combine the known change area with the estimated change area to obtain the flickering area, specifically including:

[0097] According to the known change area, determining whether a closed area is formed in the known change area;

[0098] If it is determined that a closed area is formed in the known change area, the pixel values ​​of the pixels in the closed area are replaced with the pixel values ​​of the known change area to obtain a first estimated change area;

[0099] combining the first estimated change region and the known change region to obtain a first target region, and determining a contour of the first target region;

[0100] Performing similarity matching between the contour and the first model, determining a second target area on the first model, and determining the second target area as the scintillation area specifically includes:

[0101] Determine whether there is a vertex in the contour;

[0102] If it is determined that there is a vertex in the contour, the coordinates of the vertex are determined, and according to the coordinates of the vertex, associated coordinates within a preset range are determined to form a coordinate grid;

[0103] According to the coordinate grid, matching is performed on the first model to determine a second target area on the first model, and the second target area is determined as the scintillation area;

[0104] If it is determined that there is no vertex in the contour, first determine the coordinate point on the first model that is closest to the second model, take the coordinate point on the first model that is closest to the second model as the reference point, match on the first model with a preset step, determine the second target area on the first model, and determine the second target area as the flashing area.

[0105] Embodiment 4

[0106] Another aspect of the present invention provides an electronic device, see Figure 3 , shown is an electronic device in the fourth embodiment of the present invention, including a memory 20, a processor 10, and a computer program 30 stored in the memory and executable on the processor, wherein when the processor 10 executes the computer program 30, the graphics processing method based on the Unity scene as described above is implemented.

[0107] In some embodiments, the processor 10 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor or other data processing chip, used to run program codes or process data stored in the memory 20, such as executing access restriction programs.

[0108] Among them, the memory 20 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 20 can be an internal storage unit of an electronic device, such as a hard disk of the electronic device. In other embodiments, the memory 20 can also be an external storage device of an electronic device, such as a plug-in hard disk equipped on the electronic device, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (FlashCard), etc. Further, the memory 20 can also include both an internal storage unit of the electronic device and an external storage device. The memory 20 can not only be used to store application software and various types of data of the electronic device, but also can be used to temporarily store data that has been output or is to be output.

[0109] It should be pointed out that Figure 3 The structure shown does not constitute a limitation on the electronic device. In other embodiments, the electronic device may include fewer or more components than those shown in the figure, or combine certain components, or arrange the components differently.

[0110] The embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the graphics processing method based on the Unity scene as described above is implemented.

[0111] Those skilled in the art will appreciate that the logic and / or steps represented in the flowchart or otherwise described herein, for example, may be considered as an ordered list of executable instructions for implementing logical functions, and may be specifically implemented in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in conjunction with such instruction execution systems, devices or apparatuses. For purposes of this specification, "computer-readable medium" may be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in conjunction with such instruction execution systems, devices or apparatuses.

[0112] More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be a paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a computer memory.

[0113] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or a combination thereof: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0114] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0115] The above embodiments only express several implementation methods of the present invention, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present invention. It should be pointed out that, for a person of ordinary skill in the art, several modifications and improvements can be made without departing from the concept of the present invention, and these all belong to the protection scope of the present invention. Therefore, the protection scope of the present invention patent shall be subject to the attached claims.

Claims

1. A graphics processing method based on Unity scene, characterized in that: Applied in a Unity scene, where there is a gap between models, the method includes: Acquire a 3D model, the 3D model including at least two independent sub-models, determine a flickering area at a near distance of a current camera, and a corresponding sub-model distance; Obtaining a preset size and a current size of each sub-model, and determining an enlargement ratio according to the preset size and the current size of each sub-model; Determining an adjustment range of the near spacing according to the magnification ratio and the near spacing of the current camera; According to the magnification ratio, the sub-model and the sub-model spacing are controlled to be magnified, and according to the adjustment range of the near spacing, the near spacing of the camera is controlled to be close to the magnified flickering area; The step of obtaining a 3D model, wherein the 3D model includes at least two independent sub-models, and determining a flickering area at a near distance of a current camera and a corresponding sub-model distance includes: Acquire a 3D model, and assign a single color to each sub-model in the 3D model, wherein the assigned color includes one of red, green, and blue, and adjacent sub-models have different colors; At the near distance of the current camera, the image of the 3D model is acquired in real time, and the pixel value of the image is obtained, and the flickering area is determined according to the change of the pixel value of the image; According to the flickering area, the target parts of the corresponding sub-models are determined, and according to the target parts of the sub-models, the distances between the target parts of the sub-models are determined.

2. The graphics processing method based on the Unity scene according to claim 1, characterized in that: The step of acquiring an image of the 3D model in real time at the near distance of the current camera, acquiring pixel values ​​of the image, and determining the flickering area according to changes in the pixel values ​​of the image comprises: Determine a sub-model as a first model, and a sub-model adjacent to the first model as a second model; Obtaining a first pixel value of the first model and a second pixel value of the second model, determining in real time a coordinate point where the first pixel value changes to the second pixel value according to the first pixel value and the second pixel value, and combining adjacent coordinate points to form an image with a changed area in real time; Overlapping a plurality of images having a change region, obtaining overlapping parts and non-overlapping parts of the change region, and combining the overlapping parts and non-overlapping parts of the change region to obtain a known change region; The estimated change region is inferred based on the known change region, and the known change region and the estimated change region are combined to obtain the flickering region.

3. The graphics processing method based on the Unity scene according to claim 2, characterized in that: The step of inferring an estimated change region based on a known change region, and combining the known change region and the estimated change region to obtain the flicker region comprises: According to the known change area, determining whether a closed area is formed in the known change area; If it is determined that a closed area is formed in the known change area, the pixel values ​​of the pixels in the closed area are replaced with the pixel values ​​of the known change area to obtain a first estimated change area; combining the first estimated change region and the known change region to obtain a first target region, and determining a contour of the first target region; The contour is matched with the first model in similarity, a second target area on the first model is determined, and the second target area is determined as the scintillation area.

4. The graphics processing method based on the Unity scene according to claim 3, characterized in that: The step of performing similarity matching between the contour and the first model, determining a second target area on the first model, and determining the second target area as the scintillation area comprises: Determine whether there is a vertex in the contour; If it is determined that there is a vertex in the contour, the coordinates of the vertex are determined, and according to the coordinates of the vertex, associated coordinates within a preset range are determined to form a coordinate grid; According to the coordinate grid, matching is performed on the first model to determine a second target area on the first model, and the second target area is determined as the scintillation area; If it is determined that there is no vertex in the contour, first determine the coordinate point on the first model that is closest to the second model, take the coordinate point on the first model that is closest to the second model as the reference point, match on the first model with a preset step, determine the second target area on the first model, and determine the second target area as the flashing area.

5. The graphics processing method based on the Unity scene according to claim 4, characterized in that: In the step of determining the target parts of each sub-model corresponding to the flashing area, and determining the spacing between the target parts of each sub-model according to the target parts of each sub-model, all coordinate positions that meet the preset spacing range in the spacing between the target parts of each sub-model are determined, and all coordinate positions are clustered to obtain the target coordinate position, and the target coordinate position is used to determine the near spacing of the camera.

6. The graphics processing method based on the Unity scene according to claim 5, characterized in that: In the step of controlling the sub-model and the sub-model spacing to be enlarged according to the enlargement ratio, and controlling the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing, the near spacing of the camera is set according to the target coordinate position, wherein after the near spacing of the camera is set, it does not interfere with the 3D model to avoid near plane clipping.

7. A graphics processing system based on Unity scene, characterized in that: The system is used to implement the graphics processing method based on the Unity scene according to any one of claims 1 to 6, and is applied to the Unity scene, and there is a distance between the models, and the system includes: A first acquisition module is used to acquire a 3D model, wherein the 3D model includes at least two independent sub-models, and determine a flickering area at a near distance of a current camera and a corresponding sub-model distance; A second acquisition module is used to acquire a preset size and a current size of each sub-model, and determine an enlargement ratio according to the preset size and the current size of each sub-model; A determination module, used to determine an adjustment range of the near distance according to the magnification ratio and the near distance of the current camera; The control module is used to control the sub-model and the sub-model spacing to be enlarged according to the enlargement ratio, and control the near spacing of the camera to be close to the enlarged flickering area according to the adjustment range of the near spacing.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the graphics processing method based on the Unity scene as described in any one of claims 1 to 6 is implemented.

9. An electronic device, characterized in that: The invention comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the graphics processing method based on the Unity scene as claimed in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Naked-eye 3D content creation improving method based on Unity 3D

    CN104715468A

  • 3D model manufacturing method and model forming device

    CN108550183A

  • Underground engineering risk early warning and interactive analysis method based on mixed reality

    CN114971249A

  • Volume rendering method and device, computer equipment and computer readable storage medium

    CN116402931A

  • Reservoir unmanned inspection system based on image recognition

    CN116962630A