CN113298918A - Different color display method and device for overlapped area - Google Patents

Different color display method and device for overlapped area Download PDF

Info

Publication number
CN113298918A
CN113298918A CN202010114461.7A CN202010114461A CN113298918A CN 113298918 A CN113298918 A CN 113298918A CN 202010114461 A CN202010114461 A CN 202010114461A CN 113298918 A CN113298918 A CN 113298918A
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.)
Granted
Application number
CN202010114461.7A
Other languages
Chinese (zh)
Other versions
CN113298918B (en
Inventor
夏环俊
舒远
曹国
皮凯
陈钊
陈键钊
王斌
郭联波
林浩佳
邱红波
王宇飞
魏琦童
黄远锋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Bozhilin Robot Co Ltd
Original Assignee
Guangdong Bozhilin Robot Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Guangdong Bozhilin Robot Co Ltd filed Critical Guangdong Bozhilin Robot Co Ltd
Priority to CN202010114461.7A priority Critical patent/CN113298918B/en
Publication of CN113298918A publication Critical patent/CN113298918A/en
Application granted granted Critical
Publication of CN113298918B publication Critical patent/CN113298918B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/005General purpose rendering architectures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/80Shading

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

Different color display method and device for overlapped area
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, it is assumed that 2 simple patches are subjected to boolean operation, 2-4 points are required for traversal operation, and when a large number of patches are subjected to overlapped color display, the operation is undoubtedly huge.
Disclosure of Invention
The embodiment of the application aims to provide a method and a device for displaying different colors in an overlapped area, which can efficiently and quickly realize different color display of the overlapped 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 arranged 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 code block sequence is executed, normal rendering can be realized for the non-overlapped area once, and material coverage 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; 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 rendering code block waiting for execution, 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 with 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 one possible implementation, 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.
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 the 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 determining module, a rendering module and a rendering module, wherein the material determining 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 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, an embodiment of the present application provides 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 rendering 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, a rendering code block sequence in a preset material is sequentially executed for each pixel point in an area where the object model is located. 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 to execute the current rendering code block, 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 jumped to, and the code block execution condition in the next rendering code block is judged again. The preset operation policy is used for operating the buffer value of the pixel point according to a set operation policy after the pixel point is rendered, for example, the preset operation policy 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 waiting to be executed currently, 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 waiting to be executed currently; 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 step 210 and the step 220 until all the rendering code blocks in the rendering code block sequence are executed, and then stopping the steps when the next rendering code block waiting to be executed does not exist in the rendering code block sequence, and 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 corresponding buffer value of 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 according to the configuration (1) described above.
(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 according to the configuration (4) described above.
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 to 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 jumping to the code block 2 and the code block 3, and continuing jumping to the code block 4 because the buffer values of all the pixel points in the object B region 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 (e.g. configured as a red color) in the code block 4, and at the same time, the buffer value of the corresponding pixel is increased 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 way by only using one material, and a plurality of different materials are not needed to be respectively rendered. After rendering the objects, if the objects have areas which are overlapped twice and overlapped three times, 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 values in a rectangle in the diagram are buffer values corresponding to the object a, and it can be seen that, after the object a is normally rendered, 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, the embodiment of the present application is based on a graphics algorithm, and the marked buffer value is quickly compared with the reference value in the rendering code block, after the rendering code block sequence is executed, normal rendering can be implemented for a non-overlapped region, and material coverage rendering can be implemented for an overlapped region, so that different color display for the overlapped region 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 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 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 screen 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. The processor 410, as well as possibly other components, may access, read, and/or write data to the 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.
Communication interface 430 includes one or more (only one shown) devices that can be used to communicate directly or indirectly with other devices for data interaction. The communication interface 430 may be an ethernet interface; may be a mobile communications network interface, such as an interface for a 3G, 4G, 5G network; or may be other types of interfaces having data transceiving functions.
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 embodiments 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, for example, memory 420 in electronic device 400 in FIG. 10.
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 the functions, if implemented in the form of software functional modules and sold or used as independent products, 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: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
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 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 (12)

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 arranged 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.
2. The method of claim 1, wherein said executing the sequence of rendered code blocks in sequence comprises:
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 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 rendering code block waiting for execution, the above steps are ended.
3. The method of claim 2, wherein the code block execution condition for 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.
4. The method of claim 3, wherein 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 with 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.
5. The method of claim 3, 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.
6. The method of claim 4, 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.
7. The method of claim 5, 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: and subtracting a preset value from the buffer value corresponding to the pixel point.
8. The method according to claim 2, 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.
9. 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.
10. A heterochromatic display device having an overlap region, comprising:
the system comprises a material determining module, a rendering module and a rendering module, wherein the material determining 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 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.
11. 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-9.
12. 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-9.
CN202010114461.7A 2020-02-24 2020-02-24 Different color display method and device for overlapped area Active CN113298918B (en)

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 true CN113298918A (en) 2021-08-24
CN113298918B 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 (16)

* Cited by examiner, † Cited by third party
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
US20030059114A1 (en) * 2001-09-26 2003-03-27 Sony Computer Entertainment Inc. Rendering processing method and device, semiconductor device, rendering process program and recording medium
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
US20140168244A1 (en) * 2012-12-19 2014-06-19 Tomas G. Akenine-Moller Color Buffer Caching
CN104167014A (en) * 2013-05-16 2014-11-26 赫克斯冈技术中心 Method for rendering data of a three-dimensional surface
US20150287158A1 (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
US20150287239A1 (en) * 2014-04-05 2015-10-08 Sony Computer Entertainment Europe Limited Graphics processing enhancement by tracking object and/or primitive identifiers
US20160189417A1 (en) * 2014-12-24 2016-06-30 Canon Kabushiki Kaisha Method, apparatus and system for rendering an image
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
US20180122036A1 (en) * 2016-10-27 2018-05-03 Adobe Systems Incorporated Gpu rendering of knockout groups
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 江苏科技大学 Real-time dynamic rendering method and system for three-dimensional submarine environment
CN110728333A (en) * 2019-12-19 2020-01-24 广东博智林机器人有限公司 Sunshine duration analysis method and device, electronic equipment and storage medium

Patent Citations (16)

* Cited by examiner, † Cited by third party
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
US20030059114A1 (en) * 2001-09-26 2003-03-27 Sony Computer Entertainment Inc. Rendering processing method and device, semiconductor device, rendering process program and recording medium
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
US20140168244A1 (en) * 2012-12-19 2014-06-19 Tomas G. Akenine-Moller Color Buffer Caching
CN104167014A (en) * 2013-05-16 2014-11-26 赫克斯冈技术中心 Method for rendering data of a three-dimensional surface
US20150287239A1 (en) * 2014-04-05 2015-10-08 Sony Computer Entertainment Europe Limited Graphics processing enhancement by tracking object and/or primitive identifiers
US20150287158A1 (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
US20160189417A1 (en) * 2014-12-24 2016-06-30 Canon Kabushiki Kaisha Method, apparatus and system for rendering an image
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
US20180122036A1 (en) * 2016-10-27 2018-05-03 Adobe Systems Incorporated Gpu rendering of knockout groups
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 江苏科技大学 Real-time dynamic rendering method and system for three-dimensional submarine 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
CN113298918B (en) 2022-12-27

Similar Documents

Publication Publication Date Title
US20070253640A1 (en) Image manipulation method and apparatus
JP2006157892A (en) Image processing apparatus and image processing method
CN108769361B (en) Control method of terminal wallpaper, terminal and computer-readable storage medium
CN106033334B (en) Method and device for drawing interface element
US10733782B2 (en) Graphics processing systems
CN107038729B (en) Digital instrument panel drawing method based on OpenGL-ES
CN105488840A (en) Information processing method and electronic equipment
CN112686939B (en) Depth image rendering method, device, equipment and computer readable storage medium
US20140325404A1 (en) Generating Screen Data
CN113298918B (en) Different color display method and device for overlapped area
CN109598672B (en) Map road rendering method and device
CN112907451A (en) Image processing method, image processing device, computer equipment and storage medium
CN109816761B (en) Graph conversion method, graph conversion device, storage medium and electronic equipment
WO2023134277A1 (en) Visible element determination method and apparatus, and storage medium and electronic device
CN113192173B (en) Image processing method and device of three-dimensional scene and electronic equipment
CN115908685A (en) Scene rendering method, device, equipment and storage medium
CN112257134B (en) Model management method and device and electronic equipment
EP4231243A1 (en) Data storage management method, object rendering method, and device
CN114627225A (en) Method and device for rendering graphics and storage medium
JPH11331700A (en) Image processing unit and image processing method
CN109767379A (en) Processing method, device, storage medium and the electronic equipment of data normalization
CN115022602B (en) Display control method and recording medium
CN115167949B (en) Method, device and medium for adapting high-version OpenGL function to low-version application program
CN113821345B (en) Method and device for rendering moving track in game and electronic equipment
KR102422202B1 (en) Electronic device for applying distortion effect to image and operating method thereof

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