CN113298918B - Different color display method and device for overlapped area - Google Patents
Different color display method and device for overlapped area Download PDFInfo
- Publication number
- CN113298918B CN113298918B CN202010114461.7A CN202010114461A CN113298918B CN 113298918 B CN113298918 B CN 113298918B CN 202010114461 A CN202010114461 A CN 202010114461A CN 113298918 B CN113298918 B CN 113298918B
- Authority
- CN
- China
- Prior art keywords
- code block
- rendering
- preset
- buffer value
- rendering code
- 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 OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/005—General purpose rendering architectures
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/50—Lighting effects
- G06T15/80—Shading
Landscapes
- Engineering & Computer Science (AREA)
- Computer Graphics (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Image Generation (AREA)
Abstract
The application provides a method and a device for displaying different colors in an overlapping area, and relates to the technical field of graphic processing. Wherein the method comprises the following steps: determining a preset material for rendering an object model generated by modeling, wherein a rendering code block sequence is configured in the preset material, each pixel point in a region where the object model is located is correspondingly provided with a buffer value, the buffer value is used for representing the rendering times of the pixel points, corresponding code block execution conditions and material parameters are preset in each rendering code block, and a preset operation strategy aiming at the buffer value is also arranged in the first rendering code block; in the process of rendering the object model according to the preset material, the rendering code block sequence is sequentially executed for each pixel point in the region where the object model is located. After the rendering code block sequence is executed, material coverage rendering can be realized for the overlapped area, and normal rendering can be realized for the non-overlapped area at one time, so that different color display of the overlapped area is finally realized.
Description
Technical Field
The application relates to the technical field of graphic processing, in particular to a method and a device for displaying different colors in an overlapping area.
Background
Currently, in industrial projects and partial three-dimensional modeling software, in order to realize different color display of overlapped parts, boolean operations or similar manners to boolean operations are generally used, and effects are realized through a series of complicated manners such as hole digging, face digging, modeling, material replacement and the like. However, in practical terms, the method of simulating boolean operations is inefficient and imposes certain memory and CPU operating pressures. Under normal conditions, 2-4 points are needed to perform traversal operation assuming that 2 simple patches are subjected to boolean operation, and the operation is undoubtedly huge when a large number of patches are subjected to overlapped color display.
Disclosure of Invention
The embodiment of the application aims to provide a method and a device for displaying different colors in an overlapping area, and the method and the device can be used for efficiently and quickly displaying different colors in the overlapping area by using a graphical algorithm mode.
In a first aspect, an embodiment of the present application provides a method for displaying different colors in an overlapping area, including: determining a preset material for rendering an object model generated by modeling, wherein a rendering code block sequence is configured in the preset material, each pixel point in a region where the object model is located is correspondingly provided with a buffer value, the buffer value is used for representing the rendering times of the pixel points, a corresponding code block execution condition and a material parameter for rendering the pixel points are preset in each rendering code block in the rendering code block sequence, and a preset operation strategy aiming at the buffer value is also set in a first rendering code block in the rendering code block sequence; and in the process of rendering the object model according to the preset material, sequentially executing the rendering code block sequence aiming at each pixel point in the region where the object model is located.
After the rendering of the code block sequence is completed, normal rendering can be realized for the non-overlapped area at one time, and material covering rendering can be realized for the overlapped area, so that different color display of the overlapped area is realized. In the whole rendering process, the whole color change in an overlapping mode can be achieved by only one material, a plurality of different materials are not needed to be used for rendering respectively, and the working efficiency is high.
In one possible implementation, the sequentially executing the sequence of rendered code blocks includes: judging whether the buffer value corresponding to the pixel point meets the code block execution condition set in the rendering code block currently waiting to be executed in the rendering code block sequence or not; when the code block execution condition is not met, jumping to the next rendering code block waiting for execution; when the code block execution condition is met, completing one-time rendering of the pixel points according to material parameters in the rendering code block which is currently waiting to be executed, operating a buffer value corresponding to the pixel point according to a preset operation strategy when the preset operation strategy is arranged in the rendering code block which is currently waiting to be executed, and then jumping to the next rendering code block which is waiting to be executed; when there is no next block of rendered code waiting to be executed, the above steps are ended.
When the preset material is used for rendering the object model, the buffer value corresponding to the object model is updated according to the execution condition of the rendering code block, the range of the overlapped area can be determined according to the updated value, and then the color of the overlapped area can be subjected to coverage rendering.
In one possible implementation, the code block execution condition of the first one of the sequence of rendered code blocks is configured to: enabling any buffer value to meet the code block execution condition; the preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer values of the pixel points are equal to the corresponding reference values.
In one possible implementation, the preset operation policy set in the first rendering code block in the sequence of rendering code blocks is: adding the buffer value corresponding to the pixel point to a preset value; and the reference values set from the second rendering code block to the last rendering code block are sequentially reduced according to the preset values, and the reference value set in the last rendering code block is the initial buffer value plus the preset values in the two first rendering code blocks.
In a possible implementation manner, the preset operation policy set in the first rendered code block in the sequence of rendered code blocks is: subtracting a preset value from a buffer value corresponding to the pixel point; and sequentially increasing the reference values set from the second rendering code block to the last rendering code block according to the preset values, wherein the reference value set in the last rendering code block is the initial buffer value minus the preset values in the two first rendering code blocks.
In a possible implementation manner, a preset operation policy for a buffer value is also set in a third rendering code block to a last rendering code block in the sequence of rendering code blocks, where the preset operation policy is: adding the corresponding buffer value of the pixel point to a preset value.
In a possible implementation manner, a preset operation policy for a buffer value is also set in a third rendering code block to a last rendering code block in the sequence of rendering code blocks, where the preset operation policy is: and subtracting a preset value from the buffer value corresponding to the pixel point.
In a possible embodiment, the operating on the buffer value corresponding to the pixel point includes: and operating the buffer value corresponding to the pixel point maintained in the buffer area.
In one possible embodiment, the method further comprises: and respectively rendering a plurality of object models generated by modeling according to preset materials, and then displaying rendered pictures in a window.
In a second aspect, an embodiment of the present application provides a different color display device in an overlapping area, including: the system comprises a material determination module and a rendering module, wherein the material determination module is used for determining a preset material for rendering an object model generated by modeling, a rendering code block sequence is configured in the preset material, each pixel point in a region where the object model is located is correspondingly provided with a buffer value, the buffer value is used for representing the rendering times of the pixel points, a corresponding code block execution condition and a material parameter used for rendering the pixel points are preset in each rendering code block in the rendering code block sequence, and a preset operation strategy aiming at the buffer value is also arranged in a first rendering code block in the rendering code block sequence; and the material rendering module is used for sequentially executing the rendering code block sequence aiming at each pixel point in the region of the object model in the process of rendering the object model according to the preset material.
In a third aspect, embodiments of the present application provide a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method according to the first aspect is performed.
In a fourth aspect, an embodiment of the present application provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the method of the first aspect.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a flowchart of rendering an object model according to an embodiment of the present disclosure;
fig. 2 is a specific flowchart for executing a sequence of rendering code blocks according to an embodiment of the present application;
fig. 3 is a diagram illustrating an embodiment of a different color material according to the present application;
FIG. 4 is a diagram illustrating another example of a different color material according to an embodiment of the present disclosure;
FIG. 5 is a diagram illustrating another example of a different color material according to an embodiment of the present disclosure;
FIG. 6 is a diagram illustrating another example of a different color material according to an embodiment of the present disclosure;
FIG. 7 is a diagram illustrating buffer values of pixels in a window frame after an object A is normally rendered;
FIG. 8 is a diagram illustrating buffer values of pixels in a window frame after an object B is rendered;
fig. 9 is a schematic view of a heterochromatic display device in an overlapping area according to an embodiment of the present disclosure;
fig. 10 is a schematic view of an electronic device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
The embodiment of the application is based on a graphical algorithm, and the function of displaying different colors in the overlapped area can be efficiently and quickly realized. Fig. 1 is a flow chart simply illustrating the rendering of an object model, and as shown in fig. 1, the method includes the following steps:
step 110: the modeling generates a plurality of object models.
In one embodiment, the plurality of object models may be a plurality of working surface models of the indoor painting robot obtained through a simulation manner, each working surface model may represent a painting area of the indoor painting robot in a corresponding process, after the plurality of working surfaces are generated through modeling, the plurality of working surfaces may be rendered through a rendering step, and overlapping areas in the screen are displayed in different colors, for example, an area overlapping once is displayed in a color X, an area overlapping twice is displayed in a color Y, and an area overlapping three times is displayed in a color Z, so that the number of times of overlapping of each area is visually seen.
Step 120: and determining a preset material for rendering the object model generated by modeling, and rendering the object model according to the determined preset material.
The multiple object models can be rendered by using the same material, and can also be rendered by using different materials.
Step 130: and after finishing rendering the plurality of object models, displaying the rendered pictures in the window.
For the step 120, the embodiment of the present application provides a specific implementation manner of rendering, and based on this implementation manner, a different color display effect can be quickly achieved for a large number of overlapping areas without performing complicated processing.
In a specific implementation manner, each pixel point in an area where an object model obtained through modeling is located is provided with a corresponding buffer value, each pixel point corresponds to one buffer value, and the buffer values can be used for representing the rendering times of the pixel point. When the three-dimensional engine does not render any model by default, the buffer value is set to an initial buffer value, for example, the initial buffer value may be set to 0; when an object model is rendered once, the buffer value of each pixel point in the area where the object model is located is updated, for example, the buffer value is changed from 0 to 1; if another object model is rendered again at the same position (the same pixel point), the position is the position of the overlapping region between the two object models, and the buffer value is updated again after rendering, for example, the buffer value is changed from 1 to 2. The present embodiment marks the number of times the corresponding position is currently overlapped by setting a buffer value.
Optionally, a certain amount of storage space is allocated in the memory as a buffer, and the buffer value may be stored, updated, and maintained in the buffer.
In a more specific embodiment, a sequence of rendering code blocks is configured in the preset material, wherein the sequence of rendering code blocks includes a plurality of segments of sequentially executed rendering code blocks. When an object model is rendered, aiming at each pixel point in the area where the object model is located, a rendering code block sequence in a preset material is sequentially executed. And presetting corresponding code block execution conditions and material parameters for rendering the pixel points to be rendered in each segment of rendering code block, wherein a preset operation strategy set for a buffer value corresponding to the pixel points to be rendered is also arranged in a first rendering code block in the rendering code block sequence. And for each parameter set in the rendering code block, the code block execution condition is used for judging whether the current rendering code block needs to be executed or not, if the buffer value corresponding to the pixel point to be rendered meets the code block execution condition, the current rendering code block is executed, if the buffer value does not meet the code block execution condition, the next rendering code block in the rendering code block sequence is skipped to, and the code block execution condition in the next rendering code block is judged again. The preset operation strategy is used for operating the buffer value of the pixel point according to a set operation strategy after the pixel point is rendered, and for example, the preset operation strategy may include: add one to the buffer value, or subtract one from the buffer value, and so on. The material parameters may include, but are not limited to, color parameters, texture parameters, gloss parameters, and the like, and in practical applications, the material parameters in each rendering code block may be customized according to a desired rendering effect, so as to implement flexible configuration.
Taking a process of rendering an object model as an example, a specific rendering step will be described. Specifically, during rendering, a rendering code block sequence is sequentially executed for any pixel point in the region where the object model is located, where a process of executing the rendering code block sequence is shown in fig. 2, and includes the following steps:
step 210: judging whether a buffer value corresponding to a pixel point to be rendered meets a code block execution condition set in a rendering code block currently waiting to be executed in a rendering code block sequence; when the code block execution condition is not met, jumping to the next rendering code block waiting for execution, and executing the step 210 again; when the code block execution condition is satisfied, a jump is performed to step 220.
Step 220: finishing one-time rendering of the pixel point according to material parameters in the rendering code block which is currently waiting to be executed, and operating the buffer value corresponding to the pixel point according to a preset operation strategy when the preset operation strategy is arranged in the rendering code block which is currently waiting to be executed; after the above operation is completed, the process jumps to the next rendering code block waiting to be executed, and step 210 is executed again.
And repeating the steps 210-220 until all the rendering code blocks in the rendering code block sequence are executed, and stopping the steps when the next rendering code block waiting for execution does not exist in the rendering code block sequence, thereby finishing the rendering of the pixel point. And after all the pixel points in the object model execute the rendering code block sequence according to the steps, rendering the object model.
In a specific implementation manner, each rendering code block in the sequence of rendering code blocks may include, but is not limited to, the following four possible configurations, but it should be understood that specific parameters of each rendering code block may be flexibly configured according to actual requirements, and embodiments of the present application are not listed one by one, and as long as a technical solution for achieving the same technical effect as that herein is achieved by arranging a plurality of sequentially executed rendering code blocks in a material is included in the scope of the present application.
It is noted that the code block execution condition for rendering the first of the sequence of code blocks is configured to: so that any one of the buffer values can satisfy the code block execution condition. For example, the code block execution condition in the first rendered code block may be set to: the buffer value is TRUE; this means that, at the time of rendering, the code block execution condition of the first rendering code block is always satisfied, that is, the first rendering code block is executed by default. And jumping to a second rendering code block after the first rendering code block is executed.
Several alternative configurations are provided herein as follows:
(1) For a plurality of rendering code blocks in the rendering code block sequence except for a second rendering code block, presetting a preset operation strategy aiming at a buffer value in each rendering code block, wherein the preset operation strategy is as follows: adding the buffer value corresponding to the pixel point to a preset value. The preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer value of the pixel point is equal to the corresponding reference value; and the reference values set from the second rendering code block to the last rendering code block are sequentially reduced according to preset values, and the reference value set in the last rendering code block is the initial buffer value plus the preset values in the two first rendering code blocks.
In the four configurations provided by the present application, the preset value can be set to 1, and then, when the buffer value is operated, the buffer value is correspondingly increased or decreased by one on the basis of the current buffer value; the initial buffer value may be set to 0. In some embodiments, in the operation strategy of each rendering code block, the preset value added to the buffer value may be the same or different, in the same case, the reference values set in the second rendering code block to the last rendering code block in the configuration (1) are sequentially decreased according to two preset values, and in the different case, the reference value in each rendering code block is determined according to the preset value in the first rendering code block and the preset value in each rendering code block after the preset value.
Fig. 3 shows a specific example of a heterochromatic material, and in fig. 3, each rendering code block in the material is set in the above configuration (1).
(2) For a plurality of rendering code blocks in the rendering code block sequence except for a second rendering code block, presetting a preset operation strategy aiming at a buffer value in each rendering code block, wherein the preset operation strategy is as follows: and subtracting a preset value from the buffer value corresponding to the pixel point. The preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer value of the pixel point is equal to the corresponding reference value; and sequentially increasing the reference values set from the second rendering code block to the last rendering code block according to preset values, wherein the reference value set in the last rendering code block is the initial buffer value minus the preset values in the two first rendering code blocks.
Fig. 4 shows a specific example of another heterochromatic material, and in fig. 4, the initial buffer value is set to 9, and each rendering code block in the material is set according to the configuration (2) described above.
(3) The preset operation strategy set in the first rendering code block in the rendering code block sequence is as follows: adding the buffer value corresponding to the pixel point with a preset value; the preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer value of the pixel point is equal to the corresponding reference value; and the reference values set from the second rendering code block to the last rendering code block are sequentially reduced according to preset values, and the reference value set in the last rendering code block is the initial buffer value plus the preset values in the two first rendering code blocks.
Fig. 5 shows a specific example of another heterochromatic material, and in fig. 5, each rendering code block in the material is set according to the configuration (3) described above.
(4) The preset operation strategy set in the first rendering code block in the rendering code block sequence is as follows: subtracting a preset value from a buffer value corresponding to the pixel point; the preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer value of the pixel point is equal to the corresponding reference value; and sequentially increasing the reference values set from the second rendering code block to the last rendering code block according to preset values, wherein the reference value set in the last rendering code block is the initial buffer value minus the preset values in the two first rendering code blocks.
Fig. 6 shows a specific example of another heterochromatic material, and in fig. 6, each rendering code block in the material is set in the above configuration (4).
In the above configurations (3) and (4), compared to the configurations (1) and (2), since the operation policy set in the rendering code block is different therein, accordingly, the reference value in the execution condition is also changed.
The method of displaying a different color in the present application will be described in detail below with reference to a specific example. Taking the allochroic material 1 shown in fig. 3 as an example, the allochroic material 1 includes 4 segments of rendering code blocks which are sequentially executed, namely a code block 1, a code block 2, a code block 3 and a code block 4, and each rendering code block is configured with a code block execution condition and color parameters used in rendering, and the code block 1, the code block 3 and the code block 4 are further provided with an operation strategy for buffer values. Then, the object is rendered according to the different color material shown in fig. 3.
In the present embodiment, the initial buffer value when no object is rendered is set to 0. Then, normally rendering an object a which is not overlapped with other objects, and executing the following operations for each pixel point in the object a in parallel:
A. and judging whether the buffer value of the corresponding pixel point meets the code block execution condition set in the code block 1. Since the execution condition of the code block 1 is always satisfied, then, the code block 1 is executed. In the process of executing the code block 1, the method comprises the following steps: rendering the pixel point according to the color parameter (such as being configured as a default color in advance) in the code block 1, and adding one to the buffer value corresponding to the pixel point. After the code block 1 is executed, the buffer value of the area where the object a is located in the buffer area is updated to 1 from the initial buffer value 0, and meanwhile, the object a is rendered into the default color. Then, a jump is made to code block 2.
B. And judging whether the buffer value of the corresponding pixel point meets the code block execution condition set in the code block 2. Since the execution condition of the code block 2 is: the buffer value is equal to the given reference value 6, and obviously, the buffer values of all the pixel points in the region do not satisfy the condition, so the code block 2 is not executed. Then, a jump is made to code block 3.
C. And judging whether the buffer value of the corresponding pixel point meets the code block execution condition set in the code block 3. Since the execution condition of the code block 3 is: the buffer value is equal to the given reference value 4, and obviously, the buffer values of the pixels in the region do not satisfy the condition, so the code block 3 is not executed. Then, a jump is made to code block 4.
D. And judging whether the buffer value of the corresponding pixel point meets the code block execution condition set in the code block 4. Since the execution condition of the code block 4 is: the buffer value is equal to the given reference value 2, obviously, the buffer value of each pixel point in the region also does not meet the condition, and the rendering process of the object a is finished because the next rendering code block waiting to be executed does not exist in the rendering code block sequence at this time.
Through the operations A-D, the normal rendering process of the object A which is not overlapped with other objects is completed.
If another object B is rendered by using the same heterochromatic material and a part of the area of the object B overlaps with the object a, then the corresponding buffer value is updated to 1 for the pixel point in the overlapping area between the two objects during rendering. Rendering according to the above operation:
the description is mainly given to the pixel points in the overlapping area. Firstly, executing a code block 1 for a pixel point in an overlapping area, and after the execution is finished, adding one to the original buffer value by the corresponding buffer value, so that the buffer value corresponding to the pixel point in the overlapping area in the buffer area is changed from 1 to 2, and the buffer values corresponding to the pixel points in other non-overlapping areas are changed from initial 0 to 1. And then, sequentially skipping to the code block 2 and the code block 3, and continuing skipping to the code block 4 because the buffer values of all the pixel points in the region of the object B do not meet the execution conditions set in the code block 2 and the code block 3. It should be noted that, since the buffer value of the pixel in the overlap region satisfies the execution condition of the code block 4 (i.e. the buffer value is equal to the reference value 2 given in the code block 4), the pixel in the overlap region is rendered according to the color parameter in the code block 4 (for example, configured as a red color), and meanwhile, the buffer value of the corresponding pixel is added by one, and the buffer value in the overlap region is updated to 3. After the rendering of the round is completed, the non-overlapped area is rendered as the default color set in the code block 1, and the area overlapped with the object a is rendered as the red color set in the code block 4. This completes the effect of heterochromatic rendering, and the red area in the picture represents the area that is overlapped once. In the whole process, the color can be changed in an overlapping mode by only using one material, and a plurality of different materials are not needed to be used for rendering respectively. After the plurality of objects are rendered, if areas which are overlapped twice and overlapped three times exist among the plurality of objects, the areas which are overlapped twice are rendered to be green, the areas which are overlapped three times are rendered to be blue, and after the rendering is finished, the overlapping degree of each area is clear at a glance.
Fig. 7 is a schematic diagram of buffer values of pixel points in a window screen (in a three-dimensional engine, objects in a scene are observed from a positive direction of a camera) after an object a is normally rendered, where the buffer value in a rectangle in the diagram is a buffer value corresponding to the object a, and it can be seen that, after normal rendering, the buffer value of an area where the object a is located is updated to 1, and the buffer values of other unrendered areas are initial buffer values 0. When rendering is performed on a plurality of objects, if the object B overlaps the object a, after the rendering of the object B is completed, the buffer value corresponding to the non-overlapping area in the object B is updated to 1, the buffer value of the area overlapping the object a is updated to 2, and the overlapping area is rendered to another different color, as shown in fig. 8.
It should be understood that, in the embodiment of the present application, in order to implement a function that the same material can perform color replacement in different areas, a certain rule is set in the material, so that one normal rendering operation or multiple overlay rendering operations can be completed based on the buffer value. When a plurality of object models are rendered by using the same material, the buffer values corresponding to the object models are updated according to the execution condition of the rendering code block, the range of the overlapping area can be determined according to the updated values, and the covering rendering of the colors of the overlapping area is realized. In the process of executing the rendering code block sequence, whether the buffer value of the buffer is equal to the reference value set in the code block is judged in the rendering pipeline, if so, the code block is rendered by using one color specified by the code block, otherwise, the default color is kept. The color parameter configuration in the sequence of rendering code blocks can be assigned in a "thermodynamic diagram" manner according to the buffer value gradient, and the overlapping effect is presented by using a manner with a significant color difference, for example, a region with a large number of overlapping times can be represented by a darker color, and a region with a small number of overlapping times can be represented by a lighter color, in such a manner that the colors configured in the second rendering code block to the last rendering code block are changed from dark to light. Therefore, the overlapping degree of the plurality of object models can be reflected more intuitively.
To sum up, in the embodiment of the present application, based on a graphics algorithm, a marked buffer value is quickly compared with a reference value in a rendering code block, after a rendering code block sequence is executed, normal rendering can be implemented for an area that is not overlapped, and material coverage rendering can be implemented for an overlapped area, so that different color display for the overlapped area is finally implemented. Meanwhile, for a large number of overlapped areas, complex processing is not needed, only uniform materials are used and rendering is carried out according to normal rendering steps, and moreover, if the areas with different overlapped degrees are displayed in other expected colors, only color parameters in each rendering code block in the materials need to be simply modified, so that the operation is very simple, the development difficulty is low, and the implementation is easy.
Based on the same inventive concept, an embodiment of the present application further provides a device for displaying different colors in an overlapping area, referring to fig. 9, where the device includes: the material determination module 310 is configured to determine a preset material for rendering an object model generated by modeling, where the preset material is configured with a rendering code block sequence, each pixel point in a region where the object model is located is correspondingly provided with a buffer value, the buffer value is used for representing the number of times of rendering the pixel point, a corresponding code block execution condition and a material parameter for rendering the pixel point are preset in each rendering code block in the rendering code block sequence, and a preset operation policy for the buffer value is also set in a first rendering code block in the rendering code block sequence; and a material rendering module 320, configured to sequentially execute the rendering code block sequence for each pixel point in the region where the object model is located in the process of rendering the object model according to the preset material.
Optionally, the material rendering module 320 is specifically configured to: judging whether the buffer value corresponding to the pixel point meets the code block execution condition set in the rendering code block currently waiting to be executed in the rendering code block sequence; when the code block execution condition is not met, jumping to the next rendering code block waiting to be executed; when the code block execution condition is met, completing one-time rendering of the pixel points according to material parameters in the rendering code block which is currently waiting to be executed, operating a buffer value corresponding to the pixel point according to a preset operation strategy when the preset operation strategy is arranged in the rendering code block which is currently waiting to be executed, and then jumping to the next rendering code block which is waiting to be executed; when there is no next rendering code block waiting for execution, the above steps are ended.
Optionally, the code block execution condition of the first one of the sequence of rendered code blocks is configured to: so that any buffer value can satisfy the code block execution condition.
Optionally, the apparatus further includes a display module, configured to display a rendered image in the window after rendering the plurality of object models generated by modeling according to the preset material.
Optionally, the material rendering module 320 includes an update submodule, and the update submodule is configured to operate on the buffer value corresponding to the pixel point maintained in the buffer area.
The basic principle and the resulting technical effect of the above-mentioned different color display device with overlapping areas are the same as those of the previous method embodiment, and for the sake of brief description, no part of this embodiment is mentioned, and reference may be made to the corresponding contents in the above-mentioned method embodiment, and no further description is given here.
Fig. 10 shows a possible structure of an electronic device 400 provided in an embodiment of the present application. Referring to fig. 10, the electronic device 400 includes: a processor 410, a memory 420, and a communication interface 430, which are interconnected and in communication with each other via a communication bus 440 and/or other form of connection mechanism (not shown).
The Memory 420 includes one or more (Only one is shown in the figure), which may be, but not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. Processor 410, and possibly other components, may access, read from, and/or write to memory 420.
The processor 410 includes one or more (only one shown) which may be an integrated circuit chip having signal processing capabilities. The Processor 410 may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Micro Control Unit (MCU), a Network Processor (NP), or other conventional processors; or a special-purpose Processor, including a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, a discrete Gate or transistor logic device, and a discrete hardware component.
One or more computer program instructions may be stored in the memory 420, and may be read and executed by the processor 410 to implement the steps of the method for displaying different colors in the overlapping area provided by the embodiment of the present application, and other desired functions.
It will be appreciated that the configuration shown in fig. 10 is merely illustrative and that electronic device 400 may include more or fewer components than shown in fig. 10 or have a different configuration than shown in fig. 10. The components shown in fig. 10 may be implemented in hardware, software, or a combination thereof.
The embodiment of the present application further provides a computer-readable storage medium, where computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are read and executed by a processor of a computer, the steps of the method for displaying different colors in an overlapping area provided in the embodiment of the present application are executed. The computer readable storage medium may be implemented as the memory 420 in the electronic device 400 in fig. 10, for example.
The embodiment of the present application further provides a computer program product, which when running on a computer, causes the computer to execute the method for displaying different colors in the overlapping area provided in the present embodiment.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
Furthermore, the functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
It should be noted that, if the functions are implemented in the form of software functional modules and sold or used as independent products, the functions may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made to the present application by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims (9)
1. A method for displaying different colors in an overlapping area, comprising:
determining a preset material for rendering an object model generated by modeling, wherein a rendering code block sequence is configured in the preset material, each pixel point in a region where the object model is located is correspondingly provided with a buffer value, the buffer value is used for representing the rendering times of the pixel points, a corresponding code block execution condition and a material parameter for rendering the pixel points are preset in each rendering code block in the rendering code block sequence, and a preset operation strategy aiming at the buffer value is also set in a first rendering code block in the rendering code block sequence;
in the process of rendering the object model according to the preset material, sequentially executing the rendering code block sequence for each pixel point in the region where the object model is located;
the sequentially executing the sequence of rendered code blocks includes:
judging whether the buffer value corresponding to the pixel point meets the code block execution condition set in the rendering code block currently waiting to be executed in the rendering code block sequence;
when the code block execution condition is not met, jumping to the next rendering code block waiting to be executed;
when the code block execution condition is met, completing one-time rendering of the pixel points according to material parameters in the rendering code block which is currently waiting to be executed, operating a buffer value corresponding to the pixel point according to a preset operation strategy when the preset operation strategy is arranged in the rendering code block which is currently waiting to be executed, and then jumping to the next rendering code block which is waiting to be executed;
when the next rendering code block waiting for execution does not exist, finishing the steps;
a code block execution condition of a first one of the sequence of rendered code blocks is configured to: enabling any buffer value to meet the code block execution condition; the preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer value of the pixel point is equal to the corresponding reference value;
the preset operation strategy set in the first rendering code block in the rendering code block sequence is as follows: adding the buffer value corresponding to the pixel point to a preset value; and the reference values set from the second rendering code block to the last rendering code block are sequentially reduced according to the preset values, and the reference value set in the last rendering code block is the initial buffer value plus the preset values in the two first rendering code blocks.
2. The method of claim 1, wherein the preset operation policy set in the first rendering code block in the sequence of rendering code blocks is: subtracting a preset value from a buffer value corresponding to the pixel point; and sequentially increasing the reference value from the second rendering code block to the last rendering code block according to the preset value, wherein the reference value set in the last rendering code block is the initial buffer value minus the preset values in the two first rendering code blocks.
3. The method of claim 1, wherein a preset operation policy for a buffer value is also set in a third rendering code block to a last rendering code block in the sequence of rendering code blocks, and the preset operation policy is: adding the corresponding buffer value of the pixel point to a preset value.
4. The method of claim 2, wherein a preset operation policy for a buffer value is also set in a third to a last rendering code block in the sequence of rendering code blocks, and the preset operation policy is: and subtracting a preset value from the buffer value corresponding to the pixel point.
5. The method according to claim 1, wherein said operating on the buffer value corresponding to the pixel point comprises: and operating the buffer value corresponding to the pixel point maintained in the buffer area.
6. The method of claim 1, further comprising:
and respectively rendering a plurality of object models generated by modeling according to preset materials, and then displaying rendered pictures in the window.
7. A heterochromatic display device having an overlap region, comprising:
the system comprises a material determination module and a rendering module, wherein the material determination module is used for determining a preset material for rendering an object model generated by modeling, a rendering code block sequence is configured in the preset material, each pixel point in a region where the object model is located is correspondingly provided with a buffer value, the buffer value is used for representing the rendering times of the pixel points, a corresponding code block execution condition and a material parameter used for rendering the pixel points are preset in each rendering code block in the rendering code block sequence, and a preset operation strategy aiming at the buffer value is also arranged in a first rendering code block in the rendering code block sequence;
the material rendering module is used for sequentially executing the rendering code block sequence aiming at each pixel point in the region of the object model in the process of rendering the object model according to the preset material;
the material rendering module is specifically configured to: judging whether the buffer value corresponding to the pixel point meets the code block execution condition set in the rendering code block currently waiting to be executed in the rendering code block sequence; when the code block execution condition is not met, jumping to the next rendering code block waiting to be executed; when the code block execution condition is met, completing one-time rendering of the pixel points according to material parameters in the rendering code block which is currently waiting to be executed, operating a buffer value corresponding to the pixel point according to a preset operation strategy when the preset operation strategy is arranged in the rendering code block which is currently waiting to be executed, and then jumping to the next rendering code block which is waiting to be executed; when the next rendering code block waiting for execution does not exist, finishing the steps;
a code block execution condition of a first one of the sequence of rendered code blocks is configured to: enabling any buffer value to meet the code block execution condition; the preset code block execution conditions from the second rendering code block to the last rendering code block in the rendering code block sequence are as follows: the corresponding buffer value of the pixel point is equal to the corresponding reference value;
the preset operation strategy set in the first rendering code block in the rendering code block sequence is as follows: adding the buffer value corresponding to the pixel point to a preset value; and the reference values set from the second rendering code block to the last rendering code block are sequentially reduced according to the preset values, and the reference value set in the last rendering code block is the initial buffer value plus the preset values in the two first rendering code blocks.
8. A storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, performs the method according to any one of claims 1-6.
9. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the method of any of claims 1-6.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010114461.7A CN113298918B (en) | 2020-02-24 | 2020-02-24 | Different color display method and device for overlapped area |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010114461.7A CN113298918B (en) | 2020-02-24 | 2020-02-24 | Different color display method and device for overlapped area |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113298918A CN113298918A (en) | 2021-08-24 |
| CN113298918B true CN113298918B (en) | 2022-12-27 |
Family
ID=77317940
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010114461.7A Active CN113298918B (en) | 2020-02-24 | 2020-02-24 | Different color display method and device for overlapped area |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113298918B (en) |
Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6084596A (en) * | 1994-09-12 | 2000-07-04 | Canon Information Systems Research Australia Pty Ltd. | Rendering self-overlapping objects using a scanline process |
| KR20010047622A (en) * | 1999-11-22 | 2001-06-15 | 신병석 | A real-time rendering method and device using temporal coherency |
| CN101937574A (en) * | 2009-06-26 | 2011-01-05 | 英特尔公司 | Graphics analysis techniques |
| CN102708585A (en) * | 2012-05-09 | 2012-10-03 | 北京像素软件科技股份有限公司 | Method for rendering contour edges of models |
| CN104167014A (en) * | 2013-05-16 | 2014-11-26 | 赫克斯冈技术中心 | Method for rendering data of a three-dimensional surface |
| CN106204703A (en) * | 2016-06-29 | 2016-12-07 | 乐视控股(北京)有限公司 | Three-dimensional scene models rendering intent and device |
| CN107292945A (en) * | 2016-03-31 | 2017-10-24 | 阿里巴巴集团控股有限公司 | The figure layer of video image renders processing method and its system |
| CN109615686A (en) * | 2018-12-07 | 2019-04-12 | 腾讯科技(深圳)有限公司 | Potential determination method, apparatus, equipment and the storage medium visually gathered |
| CN110706325A (en) * | 2019-09-29 | 2020-01-17 | 江苏科技大学 | A real-time dynamic rendering method and rendering system for a three-dimensional seabed environment |
| CN110728333A (en) * | 2019-12-19 | 2020-01-24 | 广东博智林机器人有限公司 | Sunshine duration analysis method and device, electronic equipment and storage medium |
Family Cites Families (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP3696584B2 (en) * | 2001-09-26 | 2005-09-21 | 株式会社ソニー・コンピュータエンタテインメント | Drawing processing method and apparatus, semiconductor device, drawing processing program, and recording medium |
| US9336561B2 (en) * | 2012-12-19 | 2016-05-10 | Intel Corporation | Color buffer caching |
| US9710957B2 (en) * | 2014-04-05 | 2017-07-18 | Sony Interactive Entertainment America Llc | Graphics processing enhancement by tracking object and/or primitive identifiers |
| WO2015154004A1 (en) * | 2014-04-05 | 2015-10-08 | Sony Computer Entertainment America Llc | Method for efficient re-rendering objects to vary viewports and under varying rendering and rasterization parameters |
| AU2014280960A1 (en) * | 2014-12-24 | 2016-07-14 | Canon Kabushiki Kaisha | Method, apparatus and system for rendering an image |
| US10074152B2 (en) * | 2016-10-27 | 2018-09-11 | Adobe Systems Incorporated | GPU rendering of knockout groups |
-
2020
- 2020-02-24 CN CN202010114461.7A patent/CN113298918B/en active Active
Patent Citations (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6084596A (en) * | 1994-09-12 | 2000-07-04 | Canon Information Systems Research Australia Pty Ltd. | Rendering self-overlapping objects using a scanline process |
| KR20010047622A (en) * | 1999-11-22 | 2001-06-15 | 신병석 | A real-time rendering method and device using temporal coherency |
| CN101937574A (en) * | 2009-06-26 | 2011-01-05 | 英特尔公司 | Graphics analysis techniques |
| CN102708585A (en) * | 2012-05-09 | 2012-10-03 | 北京像素软件科技股份有限公司 | Method for rendering contour edges of models |
| CN104167014A (en) * | 2013-05-16 | 2014-11-26 | 赫克斯冈技术中心 | Method for rendering data of a three-dimensional surface |
| CN107292945A (en) * | 2016-03-31 | 2017-10-24 | 阿里巴巴集团控股有限公司 | The figure layer of video image renders processing method and its system |
| CN106204703A (en) * | 2016-06-29 | 2016-12-07 | 乐视控股(北京)有限公司 | Three-dimensional scene models rendering intent and device |
| CN109615686A (en) * | 2018-12-07 | 2019-04-12 | 腾讯科技(深圳)有限公司 | Potential determination method, apparatus, equipment and the storage medium visually gathered |
| CN110706325A (en) * | 2019-09-29 | 2020-01-17 | 江苏科技大学 | A real-time dynamic rendering method and rendering system for a three-dimensional seabed environment |
| CN110728333A (en) * | 2019-12-19 | 2020-01-24 | 广东博智林机器人有限公司 | Sunshine duration analysis method and device, electronic equipment and storage medium |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113298918A (en) | 2021-08-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP4677323B2 (en) | Image processing apparatus and image processing method | |
| US20070253640A1 (en) | Image manipulation method and apparatus | |
| CN112686939B (en) | Depth image rendering method, device, equipment and computer readable storage medium | |
| CN113313802B (en) | Image rendering method, device and equipment and storage medium | |
| JPH09319891A (en) | Image processing apparatus and processing method thereof | |
| CN114429513B (en) | Visible element determination method and device, storage medium and electronic device | |
| CN113935891B (en) | Pixel-style scene rendering method, device and storage medium | |
| CN113192173B (en) | Image processing method and device of three-dimensional scene and electronic equipment | |
| EP4231243A1 (en) | Data storage management method, object rendering method, and device | |
| KR20240009512A (en) | Point-of-view (POV) image warp systems and methods | |
| CN113298918B (en) | Different color display method and device for overlapped area | |
| CN113470153B (en) | Virtual scene rendering method and device and electronic equipment | |
| CN115359168A (en) | Model rendering method and device and electronic equipment | |
| CN117173313B (en) | Method and device for generating dynamic colors of model based on Unreal engine | |
| US20240037701A1 (en) | Image processing and rendering | |
| CN109816761B (en) | Graph conversion method, graph conversion device, storage medium and electronic equipment | |
| US12131418B2 (en) | Graphics processing unit instancing control | |
| CN113724364B (en) | Setting method and device for realizing shielding and rendering-free body by utilizing polygons | |
| CN117234391A (en) | Image generation method and device and electronic equipment | |
| JPH11331700A (en) | Image processing unit and image processing method | |
| CN112257134B (en) | Model management method and device and electronic equipment | |
| CN115845363A (en) | Rendering method and device and electronic equipment | |
| CN115761198A (en) | A data model lightweight method, device, equipment and storage medium | |
| KR102005526B1 (en) | Method and apparatus for displaying augmented reality | |
| HK40072024A (en) | Method and apparatus for determining visible element, storage medium, and electronic 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 |