CN114998501A - Color gradation rendering method and device for model - Google Patents

Color gradation rendering method and device for model Download PDF

Info

Publication number
CN114998501A
CN114998501A CN202210428341.3A CN202210428341A CN114998501A CN 114998501 A CN114998501 A CN 114998501A CN 202210428341 A CN202210428341 A CN 202210428341A CN 114998501 A CN114998501 A CN 114998501A
Authority
CN
China
Prior art keywords
color
target
model
parameter
coloring
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.)
Pending
Application number
CN202210428341.3A
Other languages
Chinese (zh)
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.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210428341.3A priority Critical patent/CN114998501A/en
Publication of CN114998501A publication Critical patent/CN114998501A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/02Non-photorealistic rendering
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/55Radiosity

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Graphics (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The disclosure discloses a color gradation rendering method and a device of a model, wherein the method comprises the following steps: the method comprises the steps of obtaining a coloring effect parameter aiming at a target model to be colored, wherein the coloring effect parameter comprises a color level parameter and a position parameter, obtaining model information of the target model, then carrying out color level calculation based on the coloring effect parameter and the model information, obtaining a color level value corresponding to a coloring part of the target model, and finally rendering the target model based on the color level value. By using the method, the color grading process of the game model can be simpler and more efficient.

Description

Color gradation rendering method and device for model
Technical Field
The disclosure relates to the technical field of computer networks, in particular to a color gradation rendering method of a model. The disclosure also relates to a color gradation rendering device, an electronic device and a computer readable storage medium of the model.
Background
Non-realistic style rendering has become an important part of the game development link, and the core part of non-realistic rendering is the model rendering part, i.e. the color of the model to be rendered is subjected to the color grading process, e.g. complex multi-type colors are classified into a series of few-type color categories, and the purpose is to reduce the color types and improve the unreal feeling of the game model, i.e. the model is more biased to cartoon characters after the color reduction.
The existing color gradation processing process aiming at the game model is complex and has high resource consumption.
Disclosure of Invention
The embodiment of the disclosure provides a color-gradation rendering method and device of a model, electronic equipment and a computer-readable storage medium, so as to solve the problems of complex processing process and high resource consumption in a color-gradation rendering scene of a game model in the prior art.
The embodiment of the disclosure provides a color gradation rendering method for a model, which includes:
obtaining a coloring effect parameter aiming at a target model to be colored, wherein the coloring effect parameter comprises a color level parameter and a position parameter;
obtaining model information of the target model;
performing color gradation calculation based on the coloring effect parameters and the model information to obtain a color gradation value corresponding to a coloring part of the target model;
rendering the target model based on the color level values.
Optionally, the obtaining a coloring effect parameter for the target model to be colored includes:
and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is used for coloring the target model.
Optionally, the obtaining model information of the target model includes: obtaining color attribute information of a target coloring point of the target model, wherein the color attribute information of the target coloring point corresponds to the same data format as the position parameter;
the performing a color gradation calculation based on the color effect parameter and the model information includes: performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter.
Optionally, the color attribute information of the target colored point includes one of the following information:
a point product of a normal unit vector N and a light unit vector L on the target coloring point;
the tone corresponding to the target coloring point;
saturation corresponding to the target coloring point;
contrast of the target colored point.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing of the color gradation calculation based on the color attribute information of the target colored point and the coloring effect parameter includes:
comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and the value of the color gradation mixing mode.
Optionally, the determining, based on the comparison result and the value of the color gradation mixed mode, a color gradation value corresponding to the target coloring point includes:
in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fiexd, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter;
or, in response to that the color attribute information of the target colored point is greater than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point;
wherein the first location parameter and the second location parameter are adjacent location parameters.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix.
The embodiment of the present disclosure further provides a device for rendering a model in a color gradation manner, which is disposed on a game platform, the device including:
a rendering effect parameter obtaining unit, configured to obtain a rendering effect parameter for a target model to be rendered, where the rendering effect parameter includes a color rank parameter and a position parameter;
a model information obtaining unit configured to obtain model information of the target model;
a color level value obtaining unit, configured to perform color level calculation based on the coloring effect parameter and the model information to obtain a color level value corresponding to a coloring part of the target model;
and the model rendering unit is used for rendering the target model based on the color gradation value.
Optionally, the obtaining a coloring effect parameter for the target model to be colored includes:
and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is used for coloring the target model.
Optionally, the obtaining model information of the target model includes: obtaining color attribute information of a target coloring point of the target model, wherein the color attribute information of the target coloring point corresponds to the same data format as the position parameter;
the performing a color gradation calculation based on the color effect parameter and the model information includes: performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter.
Optionally, the color attribute information of the target colored point includes one of the following information:
a point product of a normal unit vector N and a light unit vector L on the target shading point;
the tone corresponding to the target coloring point;
saturation corresponding to the target coloring point;
contrast of the target colored point.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing of the color gradation calculation based on the color attribute information of the target colored point and the coloring effect parameter includes:
comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and the value of the color gradation mixing mode.
Optionally, the determining, based on the comparison result and the value of the color gradation mixed mode, a color gradation value corresponding to the target coloring point includes:
in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fiexd, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter;
or, in response to that the color attribute information of the target colored point is greater than a first position parameter and less than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point;
wherein the first location parameter and the second location parameter are adjacent location parameters.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix.
The embodiment of the present disclosure also provides an electronic device, which includes a processor and a memory; wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the above-described method.
Embodiments of the present disclosure also provide a computer-readable storage medium having one or more computer instructions stored thereon, which are executed by a processor to implement the above-described method.
Compared with the prior art, the embodiment of the disclosure has the following advantages:
the method for rendering a model in a color gradation manner, provided by the embodiment of the present disclosure, includes obtaining a coloring effect parameter for a target model to be colored, where the coloring effect parameter includes a color gradation parameter and a position parameter, and obtaining model information of the target model, then performing color gradation calculation based on the coloring effect parameter and the model information, obtaining a color gradation value corresponding to a coloring part of the target model, and finally rendering the target model based on the color gradation value. By using the method, the color gradation process of the game model is simpler and more efficient, and the resource loss is smaller.
Drawings
Fig. 1 is a flowchart of a method for color-level rendering of a model according to a first embodiment of the present disclosure;
FIG. 1-A is a component interaction diagram provided by embodiments of the present disclosure;
1-B are component interaction diagrams provided by embodiments of the present disclosure;
FIG. 1-C is a schematic illustration of the calculation of color levels provided by embodiments of the present disclosure;
FIG. 1-D is a schematic illustration of the calculation of color levels provided by embodiments of the present disclosure;
fig. 2 is a block diagram of a unit of a color-gradation rendering apparatus of a model according to a second embodiment of the present disclosure;
fig. 3 is a schematic diagram of a logical structure of an electronic device according to a third embodiment of the present disclosure.
Detailed Description
In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present disclosure. This disclosure may be embodied in many different forms without departing from the spirit or essential characteristics thereof, and it should be understood that this disclosure is not limited to the specific embodiments disclosed below.
It should be noted that the terms "first", "second", third "and the like in the various parts of the embodiments of the disclosure and in the drawings are used for distinguishing similar objects and not necessarily for describing a particular order or sequence. Such data may be interchanged under appropriate circumstances such that embodiments of the disclosure described herein may be practiced other than as illustrated or described herein. The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Non-realistic style rendering has become an important content in the game development link, and the most core part of non-realistic rendering is the model rendering part, i.e. the colors of the model to be rendered are subjected to the color grading treatment, for example, the complicated multi-type colors are classified into a series of few-type color categories, and the purpose is to reduce the color types and improve the unreal feeling of the game model, i.e. the model is more biased to cartoon characters after the colors are reduced.
The existing color gradation processing process aiming at the game model is complex and has high resource consumption. For example, a game model is subjected to color gradation processing by adopting a map sampling mode, and in the map sampling process, one color gradation corresponds to one map, so that the problems of high management difficulty and high storage capacity exist. For example, the form of Ramp maps can express more color details, but suffer from the following disadvantages: a large amount of Ramp map resources are not easy to manage (maps exist in a resource form in engineering, map data need to be stored separately and cannot be stored in materials, so that manpower management is needed, various limitations such as compression loading exist), colors are limited to 0-1, a sampling instruction needs to be performed once in coloring, performance is poor (maps need to obtain the colors inside in a GPU and also need to use the sampling instruction, the performance of the instruction is poor), user interaction experience is poor, switching adjustment needs to be performed between an engine and a third-party tool, and what-you-see-is-what-you-get interaction effect cannot be achieved.
In the process of coloring a game model, in order to simplify the existing color gradation processing flow and reduce resource consumption, the disclosure provides a color gradation rendering method of the model, a color gradation rendering device of the model corresponding to the method, electronic equipment capable of implementing the color gradation rendering method of the model, and a computer-readable storage medium. The following provides embodiments for detailed description of the above method, apparatus, electronic device, and computer-readable storage medium.
A first embodiment of the present disclosure provides a color-gradation rendering method for a model, where an application subject of the method may be a rendering Shader, and the rendering Shader may be run on a game platform. Fig. 1 is a flowchart of a method for rendering a model in a color gradation manner according to a first embodiment of the disclosure, and the method for rendering a model in a color gradation manner according to this embodiment is described in detail below with reference to fig. 1. The following description refers to embodiments for the purpose of illustrating the principles of the methods, and is not intended to be limiting in actual use.
S101, obtaining a coloring effect parameter aiming at the target model to be colored.
This step is used to obtain the rendering effect parameters for the target model to be rendered, which include a color rank parameter and a position parameter. The color level, i.e. the color index, represents the bright relationship of a picture, for example, an RGB space digital image of 8-bit colors, red, green and blue are represented by 2^8 (i.e. 256) levels, the value range of each color is [0, 255], i.e. the color level describes that the range of the tone in the image is 0-255, the color level can determine the color fullness and fineness of the image, and in the image processing, the adjustment of the color level is substantially to adjust the size of different pixel values by adjusting the histogram, so as to improve the visual effect of the image.
The rendering effect parameter refers to rendering data set before the target model is rendered, and specifically includes a color scale parameter, a position parameter, a color blending mode, a color category, and the like, where the color scale parameter is a color value of a selected color scale, for example, a color expressed in a computer is generally expressed by RGBA, where R represents a red component, G represents a green component, B represents a blue component, and a represents transparency, and these components are generally expressed by integers from 0 to 255. These combinations may describe most of the resulting colors. For example, (255,0, 255) indicates red, and (0, 255,128) indicates blue with half the transparency. The position parameter is a decimal fraction of 0 to 1, and the position percentage corresponds to the color level parameter in the target model. The color Blend mode includes both a Fixed mode and a Blend mode, and the color class is the number of color levels in the target model.
The color effect parameter includes a plurality of gamut parameters and a plurality of position parameters corresponding to the plurality of gamut parameters. In this embodiment, the obtaining of the coloring effect parameter for the target model to be colored may specifically refer to: and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is a color level for coloring the target model. The visualized color level setting component can enable a user to select color levels in a see-through-get manner, for example, a UI component of Gradient, the category component can freely select a color mixing mode as a Blend mode or a Fixed mode, and when the component is used, the position of a color can be freely dragged, so that different effects are displayed, and the data structure of the component is simple, as shown in fig. 1-a and 1-B, assuming that there are four subscripts in fig. 1-a or 1-B, each subscript only needs to store 4 floating point numbers, where the first three floating point numbers represent rgb three channels of the selected color, a stores a position parameter from 0 to 1, and 4 subscripts only need to store 16 floating point numbers. If the floating-point number is used for storage, the color value can exceed 1, and the HDR setting is met. After the user operates based on the component (for example, adding or deleting the subscript point, changing the color and position of the subscript point, and setting the color blending mode to be a Fixed mode or a Blend mode), the script transmits the coloring effect parameters corresponding to the operation into the material, and when the user operates in real time, the material transmits the coloring effect parameters into the Shader, so that the Shader code performs corresponding color rank calculation.
And S102, obtaining model information of the target model.
The method is used for obtaining the model information of the input target model by the Shader during real-time operation, and specifically comprises the following steps: and obtaining the color attribute information of the target coloring point of the target model, wherein the target coloring point is any coloring point on the target model, the color attribute information of the target coloring point corresponds to the same data format as the position parameter, namely, the position parameter is a decimal number from 0 to 1, and the color attribute information of the target coloring point is also a decimal number from 0 to 1. The color attribute information of the target coloring point may be one of a point product value NdotL (abbreviated as NL) of a normal unit vector N and a light unit vector L on the target coloring point, a hue value corresponding to the target coloring point, a saturation value corresponding to the target coloring point, a contrast of the target coloring point, and the like, and in the embodiment, NL is taken as an example for description.
And S103, carrying out color gradation calculation based on the coloring effect parameters and the model information to obtain color gradation values corresponding to all coloring parts of the target model.
After obtaining the coloring effect parameter for the target model to be colored and the model information of the target model in the above steps, the step is configured to perform a color gradation calculation based on the coloring effect parameter and the model information to obtain a color gradation value corresponding to each colored portion of the target model, and specifically, the step may perform the color gradation calculation based on the color attribute information of the target colored point and the coloring effect parameter, for example, assuming that there are a plurality of colored points on the target model, and a point product NL between a normal unit vector N of the target colored point and a light unit vector L is an input value, that is, the color attribute information of the target colored point is NL, and the step determines how much the color gradation value corresponding to the target colored point should be output based on the coloring effect parameter.
In this embodiment, the above-mentioned performing the color level calculation based on the color attribute information of the target colored point and the coloring effect parameter can be implemented by the following two ways:
the first method is as follows: comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and a value of the color gradation mixing mode. The process may specifically be: in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fixed, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter; or, in response to that the color attribute information of the target colored point is greater than a first position parameter and less than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point; wherein the first location parameter and the second location parameter are adjacent location parameters.
As shown in fig. 1-C, the above process can be specifically described as follows: since NL is the dot product of two unit vectors of the target coloring point, the interval value of NL is [0,1], the interval value is compared with the color scale subscripts one by one, i is cyclically taken from 1 to count, count is the number of the color scale subscripts (color scale type), and CK [ i ] represents the color scale parameter and the position parameter in the ith color scale subscript. t1 represents the previous tonescale index and t2 represents the current tonescale index. If the value of NL is between the position parameters of t1 and t2, i.e. NL is equal to or greater than t1.a (position parameter of t 1) and NL is equal to or less than t2.a (position parameter of t 2), the color (gradation value) output by the target color point should be composed between the colors of i and i-1. And if the value of the color gradation mixed mode BM is Fixed, directly returning a color gradation value (t2.rgb) corresponding to the ith color gradation subscript as the color gradation value of the target colored point. If the BM value is Blend, interpolating the color gradation value corresponding to the ith color gradation subscript and the color gradation value corresponding to the (i-1) th color gradation subscript, wherein the interpolation formula is as follows: p ═ (NL-t1.a)/(t2.a-t1.a), the final target coloration point has a value of the color gradation: t1.rgb + (t2.rgb-t1. rgb). P. The shader lerp instruction of the GPU can describe the interpolation formula, so the interpolation calculation process can be directly replaced with the lerp instruction.
The second method comprises the following steps: and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix. Due to the particularity of the GPU architecture, in the bottom layer operation process, the operation efficiency is greatly influenced by the circulation and judgment statements, in order to optimize the first mode, the two-pair Shader is used for optimizing the instruction set, the main idea is that in the whole Shader implementation process, the judgment statements and the circulation statements are not used, the calculation instructions provided by GPU hardware are utilized, the matrix idea is used, the circulation and judgment instructions of the GPU are avoided, only simple addition, subtraction, multiplication and division instructions are used, the parallel calculation of the GPU is achieved, and therefore the effect of accelerating the calculation is achieved. As shown in fig. 1-D, the process is optimized primarily by the instructions of the 2x4 matrix multiplication, because, in the GPU, parallel computation is performed, and matrix multiplication can greatly speed up the whole computation process, at the beginning of the program, defining T2 x4 matrixes, each of which means the color level parameter and position parameter of the first color level subscript and the color level parameter and position parameter of the second color level subscript, defining the series of matrixes as M [ i ] matrixes, defining T matrixes in total, M [0] representing the color position of the 0 th subscript, M [ T-1] representing the color position of the last subscript, and then using step command to replace if condition judgment command, since the step command has the characteristic that a < ═ b returns 1, and otherwise returns 0, the step command can be used to determine whether NL of the target colored point is less than the position parameter of the next subscript. Then, the combined calculation is carried out by the step instruction and the lerp instruction, if the step returns 0, the calculation means that the former value of the lerp is taken, and if the step returns 1, the calculation means that the latter value of the lerp is taken. And finally, taking the value of which the last step is 1 as a result and storing the result in the FC through continuous lep and step calculation, and finally obtaining a corresponding M matrix by the FC, and then carrying out interpolation calculation on the color gradation values of the first row and the second row of the M matrix again to obtain the color gradation values correspondingly output by the NL.
And S104, rendering the target model based on the color level value.
After obtaining the color gradation values corresponding to the respective colored portions of the target model through calculation in the above step, in this step, the shader may render the target model based on the color gradation values, for example, after obtaining the color gradation values of the target colored points of the target model, render the target colored points based on the color gradation values.
According to the color gradation rendering method of the model, only a few color gradation subscripts need to be stored when color gradation processing is carried out, and storage is simple. The method comprises the steps that a coloring effect parameter to be output is set through a visual color level setting component, the visual color level setting component can enable a user to set a color level effect through a what you see is what you get mode, for example, the UI component of Gradient can randomly select a color mixing mode to be a Blend mode or a Fixed mode, when the component is used, the position of a color can be dragged randomly, different color level effects are displayed, the data structure of the coloring effect parameter obtained through the component is simple, the coloring effect parameter can be input into a shader together with model information (color attribute information of a target coloring point) of a target model, a color level value is calculated through a calculation mode of the first mode or the second mode, and model rendering is carried out based on the color level value to obtain a colored target model.
It should be noted that although the color-scaling process is widely used in the non-real rendering, the non-real rendering is only used as an example to explain the method, that is, the method is not limited to the non-real rendering scene, and in practice, the method is applicable to only the color-scaled scene, such as skin sub-surface scattering in the real rendering.
The method is simple in implementation process, not limited to an engine, not limited to forward rendering or delayed rendering, and capable of exerting the efficiency of the picture to the maximum extent, so that the color grading process of the game model is simpler and more efficient.
And after the instruction set optimization of the second mode, a calculation result with better performance can be obtained, and because the calculation process is simpler, and the acquisition mode and the path of the data (the coloring effect parameters and the color attribute data of the target coloring point) are simpler and more efficient, the method has higher expandability (the method can be transplanted to other platforms for use), and can be realized in any game engine.
Correspondingly, a second embodiment of the present disclosure further provides a color-level rendering apparatus for a model, where the color-level rendering apparatus for a model can be applied to a server of a game platform in a software or hardware manner to perform color-level processing. Since the apparatus embodiments are substantially similar to the method embodiments and therefore are described in a relatively simple manner, reference may be made to the corresponding description of the method embodiments provided above for details of relevant technical features, and the following description of the apparatus embodiments is merely illustrative.
Referring to fig. 2, the embodiment is understood, and a block diagram of a color-level rendering apparatus of a model provided in the embodiment is shown, as shown in fig. 2, the color-level rendering apparatus of a model provided in the embodiment includes:
a coloring effect parameter obtaining unit 201, configured to obtain a coloring effect parameter for a target model to be colored, where the coloring effect parameter includes a color level parameter and a position parameter;
a model information obtaining unit 202, configured to obtain model information of the target model;
a color gradation value obtaining unit 203, configured to perform color gradation calculation based on the coloring effect parameter and the model information, and obtain a color gradation value corresponding to a coloring part of the target model;
a model rendering unit 204, configured to render the target model based on the color level value.
Optionally, the obtaining a coloring effect parameter for the target model to be colored includes:
and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is used for coloring the target model.
Optionally, the obtaining model information of the target model includes: obtaining color attribute information of a target coloring point of the target model, wherein the color attribute information of the target coloring point corresponds to the same data format as the position parameter;
the performing a color gradation calculation based on the color effect parameter and the model information includes: and performing color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter.
Optionally, the color attribute information of the target colored point includes one of the following information:
a point product of a normal unit vector N and a light unit vector L on the target shading point;
the tone corresponding to the target coloring point;
saturation corresponding to the target coloring point;
contrast of the target colored point.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and the value of the color gradation mixing mode.
Optionally, the determining, based on the comparison result and the value of the color gradation mixed mode, a color gradation value corresponding to the target coloring point includes:
in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fixed, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter;
or, in response to that the color attribute information of the target colored point is greater than a first position parameter and less than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point;
wherein the first location parameter and the second location parameter are adjacent location parameters.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix.
By using the color gradation rendering device of the model provided by the embodiment of the disclosure, the color gradation process of the game model is simpler and more efficient, and the resource loss is smaller.
In the above embodiments, a method and an apparatus for rendering a model in a color gradation manner are provided, and in addition, a third embodiment of the present disclosure also provides an electronic device, which is basically similar to the method embodiment and therefore is relatively simple to describe, and reference may be made to the corresponding description of the method embodiment for details of related technical features, and the following description of the embodiment of the electronic device is only illustrative. The embodiment of the electronic equipment is as follows:
please refer to fig. 3 for understanding the present embodiment, fig. 3 is a schematic diagram of a logic structure of the electronic device according to the present embodiment. As shown in fig. 3, the electronic device provided in this embodiment includes: a processor 301 and a memory 302;
the memory 302 is used for storing computer instructions for executing the game scene display method, and when the computer instructions are read and executed by the processor 301, the following operations are executed:
obtaining a coloring effect parameter aiming at a target model to be colored, wherein the coloring effect parameter comprises a color level parameter and a position parameter;
obtaining model information of the target model;
performing color gradation calculation based on the coloring effect parameters and the model information to obtain a color gradation value corresponding to a coloring part of the target model;
rendering the target model based on the color level value.
Optionally, the obtaining a coloring effect parameter for the target model to be colored includes:
and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is used for coloring the target model.
Optionally, the obtaining model information of the target model includes: obtaining color attribute information of a target coloring point of the target model, wherein the color attribute information of the target coloring point corresponds to the same data format as the position parameter;
the performing a color gradation calculation based on the color effect parameter and the model information includes: performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter.
Optionally, the color attribute information of the target colored point includes one of the following information:
a point product of a normal unit vector N and a light unit vector L on the target shading point;
the tone corresponding to the target coloring point;
the saturation corresponding to the target coloring point;
contrast of the target colored point.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and the value of the color gradation mixing mode.
Optionally, the determining, based on the comparison result and the value of the color-rank mixed mode, a color-rank value corresponding to the target coloring point includes:
in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fixed, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter;
or, in response to that the color attribute information of the target colored point is greater than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point;
wherein the first location parameter and the second location parameter are adjacent location parameters.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix.
Compared with the existing color gradation processing mode, the electronic equipment provided by the embodiment can enable the color gradation process of the game model to be simpler and more efficient, and the resource loss is smaller.
In the foregoing embodiments, a method and an apparatus for rendering a model in a color-gradation manner, and an electronic device are provided. Embodiments of the computer-readable storage medium provided in the present disclosure are described relatively simply, and for relevant portions, reference may be made to corresponding descriptions of the above method embodiments, and the following described embodiments are merely illustrative.
The present embodiments provide a computer readable storage medium having stored thereon computer instructions that, when executed by a processor, perform the steps of: obtaining a coloring effect parameter aiming at a target model to be colored, wherein the coloring effect parameter comprises a color level parameter and a position parameter;
obtaining model information of the target model;
performing color gradation calculation based on the coloring effect parameters and the model information to obtain a color gradation value corresponding to a coloring part of the target model;
rendering the target model based on the color level value.
Optionally, the obtaining a coloring effect parameter for the target model to be colored includes:
and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is used for coloring the target model.
Optionally, the obtaining model information of the target model includes: obtaining color attribute information of a target coloring point of the target model, wherein the color attribute information of the target coloring point corresponds to the same data format as the position parameter;
the performing a color gradation calculation based on the color effect parameter and the model information includes: performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter.
Optionally, the color attribute information of the target colored point includes one of the following information:
a point product of a normal unit vector N and a light unit vector L on the target shading point;
the tone corresponding to the target coloring point;
saturation corresponding to the target coloring point;
contrast of the target colored point.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and the value of the color gradation mixing mode.
Optionally, the determining, based on the comparison result and the value of the color gradation mixed mode, a color gradation value corresponding to the target coloring point includes:
in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fixed, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter;
or, in response to that the color attribute information of the target colored point is greater than a first position parameter and less than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point;
wherein the first location parameter and the second location parameter are adjacent location parameters.
Optionally, the color effect parameter includes a plurality of color level parameters and a plurality of position parameters corresponding to the plurality of color level parameters;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix.
By executing the computer instructions stored on the computer-readable storage medium provided by the embodiment, the color gradation process of the game model can be simpler and more efficient, and the resource consumption is smaller.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
1. Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include non-transitory computer readable media (transient media), such as modulated data signals and carrier waves.
2. As will be appreciated by one skilled in the art, embodiments of the present disclosure may be provided as a method, system, or computer program product. Accordingly, the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present disclosure may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
Although the present disclosure has been described with reference to the preferred embodiments, it is not intended to limit the present disclosure, and possible variations and modifications may be made by one skilled in the art without departing from the spirit and scope of the present disclosure, and therefore the scope of the present disclosure should be determined by that defined in the appended claims.

Claims (10)

1.A method for color-gradation rendering of a model, comprising:
obtaining a coloring effect parameter aiming at a target model to be colored, wherein the coloring effect parameter comprises a color level parameter and a position parameter;
obtaining model information of the target model;
performing color gradation calculation based on the coloring effect parameters and the model information to obtain a color gradation value corresponding to a coloring part of the target model;
rendering the target model based on the color level value.
2. The method for color-graded rendering of a model according to claim 1, wherein the obtaining of the rendering effect parameters for the target model to be rendered comprises:
and responding to a color selection operation based on the visual color level setting component, and obtaining a color level parameter and a position parameter corresponding to the selected color, wherein the selected color is used for coloring the target model.
3. The method for tone-scaling rendering of a model according to claim 1, wherein the obtaining model information of the target model comprises: obtaining color attribute information of a target coloring point of the target model, wherein the color attribute information of the target coloring point corresponds to the same data format as the position parameter;
the performing the color gradation calculation based on the color rendering effect parameter and the model information includes: performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter.
4. The method of color-graded rendering of a model according to claim 3, wherein the color attribute information of the target colored point includes one of:
a point product of a normal unit vector N and a light unit vector L on the target shading point;
the tone corresponding to the target coloring point;
saturation corresponding to the target coloring point;
contrast of the target colored point.
5. The method of tone-scale rendering of a model according to claim 3, wherein the rendering effect parameters include a plurality of tone scale parameters and a plurality of position parameters corresponding to the plurality of tone scale parameters, and the rendering effect parameters include a tone scale blending mode corresponding to the target model;
the performing a color gradation calculation based on the color attribute information of the target coloring point and the coloring effect parameter includes:
comparing the color attribute information of the target coloring point with the plurality of position parameters one by one, and determining a color gradation value corresponding to the target coloring point based on a comparison result and a value of the color gradation mixing mode.
6. The method of rendering a model in color gradation according to claim 5, wherein determining the color gradation value corresponding to the target coloring point based on the comparison result and the value of the color gradation mixture mode includes:
in response to that the color attribute information of the target coloring point is larger than a first position parameter and smaller than a second position parameter and the value of the color gradation mixing mode is Fiexd, determining that the color gradation value corresponding to the target coloring point is the color gradation parameter corresponding to the second position parameter;
or, in response to that the color attribute information of the target colored point is greater than a first position parameter and less than a second position parameter and the value of the color gradation mixing mode is Blend, performing interpolation operation based on the first position parameter, the second position parameter and the color attribute information of the target colored point, and determining an obtained interpolation result as a color gradation value corresponding to the target colored point;
wherein the first location parameter and the second location parameter are adjacent location parameters.
7. The method of tone-scale rendering of a model according to claim 3, wherein the color effect parameter includes a plurality of tone scale parameters and a plurality of position parameters corresponding to the plurality of tone scale parameters;
the performing of the color gradation calculation based on the color attribute information of the target colored point and the coloring effect parameter includes:
and representing the position parameters by adopting a plurality of matrixes, performing parallel calculation on the matrixes by adopting a step instruction and a lerp instruction to obtain a target matrix corresponding to the target coloring point, and calculating a color gradation value corresponding to the target matrix.
8. A device for rendering a model in a color-level manner, the device being disposed on a game platform, the device comprising:
a rendering effect parameter obtaining unit, configured to obtain a rendering effect parameter for a target model to be rendered, where the rendering effect parameter includes a color rank parameter and a position parameter;
a model information obtaining unit configured to obtain model information of the target model;
a color level value obtaining unit, configured to perform color level calculation based on the coloring effect parameter and the model information to obtain a color level value corresponding to a coloring part of the target model;
a model rendering unit to render the target model based on the color level value.
9. An electronic device comprising a processor and a memory; wherein,
the memory is to store one or more computer instructions, wherein the one or more computer instructions are to be executed by the processor to implement the method of claims 1-7.
10. A computer-readable storage medium having stored thereon one or more computer instructions, the instructions being executable by a processor to implement the method of claims 1-7.
CN202210428341.3A 2022-04-22 2022-04-22 Color gradation rendering method and device for model Pending CN114998501A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210428341.3A CN114998501A (en) 2022-04-22 2022-04-22 Color gradation rendering method and device for model

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210428341.3A CN114998501A (en) 2022-04-22 2022-04-22 Color gradation rendering method and device for model

Publications (1)

Publication Number Publication Date
CN114998501A true CN114998501A (en) 2022-09-02

Family

ID=83025470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210428341.3A Pending CN114998501A (en) 2022-04-22 2022-04-22 Color gradation rendering method and device for model

Country Status (1)

Country Link
CN (1) CN114998501A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117058292A (en) * 2023-07-28 2023-11-14 北京透彻未来科技有限公司 Tone scale map rendering system based on digital pathological image
CN117078838A (en) * 2023-07-07 2023-11-17 上海散爆信息技术有限公司 Object rendering method and device, storage medium and electronic equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117078838A (en) * 2023-07-07 2023-11-17 上海散爆信息技术有限公司 Object rendering method and device, storage medium and electronic equipment
CN117078838B (en) * 2023-07-07 2024-04-19 上海散爆信息技术有限公司 Object rendering method and device, storage medium and electronic equipment
CN117058292A (en) * 2023-07-28 2023-11-14 北京透彻未来科技有限公司 Tone scale map rendering system based on digital pathological image
CN117058292B (en) * 2023-07-28 2024-04-26 北京透彻未来科技有限公司 Tone scale map rendering system based on digital pathological image

Similar Documents

Publication Publication Date Title
CN114998501A (en) Color gradation rendering method and device for model
US5319742A (en) Image enhancement with mask having fuzzy edges
CN105574918B (en) A kind of material adding method, device and the terminal of 3D models
US6856705B2 (en) Image blending by guided interpolation
US8611655B2 (en) Hue-based color matching
US8290252B2 (en) Image-based backgrounds for images
CN102163337B (en) For using the system and method for at least one translucent surface rendered pixel
US20060250415A1 (en) Anti-aliasing content using opacity blending
US10489946B1 (en) Generalized primitives for smooth coloring of vector graphics artwork in constant time
CN108024104B (en) Method for processing input high dynamic range image and display equipment
KR100887462B1 (en) Alpha correction to compensate for lack of gamma correction
JP2023545660A (en) Landscape virtual screen display method and device, electronic device and computer program
US20150242099A1 (en) Automatically generating a multi-color palette and picker
US9064336B2 (en) Multiple texture compositing
CN112231020B (en) Model switching method and device, electronic equipment and storage medium
CN111784814A (en) Virtual character skin adjusting method and device
US20120070080A1 (en) Color correction for digital images
CN113470156B (en) Texture map mixing processing method and device, electronic equipment and storage medium
CN111127618A (en) Texture toning method and device during real-time rendering
CN114307143A (en) Image processing method and device, storage medium and computer equipment
US7106345B2 (en) Mechanism for color-space neutral (video) effects scripting engine
US20240013469A1 (en) Programmable pixel blending pipeline, programmable pixel blending method and apparatus, and storage medium
CN111724449B (en) Image processing method, device and equipment
AU2015271935A1 (en) Measure of image region visual information
Zhao TONE MAPPING OPTIMIZATION FOR REAL TIME APPLICATION

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