WO2023193613A1 - 高光渲染方法、装置、介质及电子设备 - Google Patents

高光渲染方法、装置、介质及电子设备 Download PDF

Info

Publication number
WO2023193613A1
WO2023193613A1 PCT/CN2023/083473 CN2023083473W WO2023193613A1 WO 2023193613 A1 WO2023193613 A1 WO 2023193613A1 CN 2023083473 W CN2023083473 W CN 2023083473W WO 2023193613 A1 WO2023193613 A1 WO 2023193613A1
Authority
WO
WIPO (PCT)
Prior art keywords
highlight
image
offset
parameter
intensity
Prior art date
Application number
PCT/CN2023/083473
Other languages
English (en)
French (fr)
Inventor
罗汉铭
Original Assignee
北京字跳网络技术有限公司
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 北京字跳网络技术有限公司 filed Critical 北京字跳网络技术有限公司
Publication of WO2023193613A1 publication Critical patent/WO2023193613A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/50Lighting effects
    • G06T15/506Illumination models
    • 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/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering

Definitions

  • the present disclosure relates to the field of image processing, and specifically, to a highlight rendering method, device, medium, electronic equipment, computer program product, and program.
  • the present disclosure provides a highlight rendering method, which method includes:
  • Intensity superposition is performed on the anisotropic offset image based on the highlight intensity parameter to obtain a highlight rendering image corresponding to the highlight image.
  • a highlight rendering device which includes:
  • the acquisition module is used to obtain the highlight image and hair model of the highlight shape to be rendered
  • a determination module configured to determine the highlight intensity parameter corresponding to the highlight shape according to the highlight image, and determine the highlight offset parameter corresponding to the highlight shape according to the highlight image;
  • a first processing module configured to perform anisotropic highlight calculation according to the highlight offset parameter and the hair model to obtain an anisotropic offset image
  • the second processing module is configured to perform intensity superposition on the anisotropic offset image based on the highlight intensity parameter to obtain a highlight rendering image corresponding to the highlight image.
  • the present disclosure provides a computer-readable medium having a computer program stored thereon, which implements the steps of the method described in the first aspect when executed by a processing device.
  • an electronic device including:
  • a processing device configured to execute the computer program in the storage device to implement the steps of the method described in the first aspect.
  • the present disclosure provides a computer program product, including a computer program that implements the steps of the method described in the first aspect when executed by a processing device.
  • the present disclosure provides a computer program that, when executed by a processing device, implements the steps of the method described in the first aspect.
  • the highlight image is first converted into a highlight offset parameter and a highlight intensity parameter for representation, so that in the calculation process of anisotropic highlights, based on the highlight offset parameter and the hair model Perform position offset and perform intensity stacking based on highlight intensity parameters.
  • Figure 1 is a comparison diagram of highlight images of realistic hair and cartoon hair
  • Figure 2 is a flow chart of a highlight rendering method based on an embodiment of the present disclosure
  • Figure 3 is a schematic diagram of a highlight image provided based on an embodiment of the present disclosure
  • Figure 4 is a schematic diagram of directions under anisotropy in the prior art
  • Figure 5 is a schematic diagram of a fixed-range anisotropic rendering image in the prior art
  • Figure 6 is a schematic diagram of an anisotropic migration image provided based on an embodiment of the present disclosure
  • Figure 7 is an image representation of a matrix of highlight intensity parameters provided based on embodiments of the present disclosure.
  • Figure 8 is a schematic diagram of a highlight rendering image provided based on an embodiment of the present disclosure.
  • Figure 9 is a block diagram of a highlight rendering device provided based on an embodiment of the present disclosure.
  • FIG. 10 shows a schematic structural diagram of an electronic device suitable for implementing embodiments of the present disclosure.
  • the term “include” and its variations are open-ended, ie, “including but not limited to.”
  • the term “based on” means “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; and the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms will be given in the description below.
  • Figure 2 shows a flow chart of a highlight rendering method based on an embodiment of the present disclosure. As shown in Figure 2, the method may include:
  • step 11 obtain the highlight image and hair model of the highlight shape to be rendered.
  • the highlight image may be an image with a highlight shape drawn by an artist.
  • the hair model can be a sphere model, and the surface image of the sphere model can be expanded into a UV image.
  • the highlight image can be a UV image so that it can be mapped to the hair model.
  • the white area is the highlight shape to be rendered.
  • step 12 the highlight intensity parameter corresponding to the highlight shape is determined based on the highlight image, and the highlight offset parameter corresponding to the highlight shape is determined based on the highlight image.
  • the highlight intensity parameter can be used to represent the width information of the highlight shape
  • the highlight offset parameter is used to represent the position information of the highlight shape, so that the highlight shape can be adjusted through the highlight intensity parameter and the highlight offset parameter. Represent uniquely and accurately.
  • anisotropic highlights are calculated according to the highlight offset parameters and the hair model to obtain an anisotropic offset image.
  • the light reflection model for hair uses anisotropic lighting to show highlights on the hair strands that vary with the direction of the light source and the direction of the view.
  • the default range and position of highlights in the hair model can be preset.
  • a fixed range of highlights can be generated based on an anisotropic algorithm within the default range.
  • the highlight shape in the anisotropic image It is circular, as shown in the white area in Figure 5.
  • the highlight intensity at each position is the same, which is the default range.
  • the anisotropic highlight algorithm may be an algorithm in this field that is not based on physics, such as the Kajiya-Kay algorithm or the physically based GGX algorithm, which is not limited by this disclosure.
  • the highlight shape can be position-shifted based on the highlight shift parameter corresponding to the highlight image, and then the position shift can be performed. After the shift, the anisotropic highlight calculation is performed to obtain an anisotropic offset image, as shown in Figure 6.
  • step 14 intensity superposition is performed on the anisotropic offset image based on the highlight intensity parameter to obtain a highlight rendering image corresponding to the highlight image.
  • the anisotropic highlight calculation in step 13 is obtained after the highlight position is offset.
  • the corresponding intensity in the highlight image is further superimposed, so that in the rendered highlight rendering image, the corresponding intensity based on the highlight image is The offset and intensity control the highlight shape.
  • the highlight image when performing highlight rendering, the highlight image is first converted into a highlight offset parameter and a highlight intensity parameter for representation, so that the anisotropic highlight can be calculated based on the highlight offset parameter
  • the position is offset with the hair model, and the intensity is superimposed based on the highlight intensity parameters to ensure the consistency of the highlight shape after highlight rendering and the highlight shape in the highlight image, ensuring the consistency of cartoon highlight rendering and user drawing, and improving the quality of animation imaging. accuracy.
  • it can not only ensure the shape stability during the highlight rendering process, but also achieve the anisotropy of highlight rendering, ensure the accuracy of the lighting effect in the interaction between light and line of sight, and improve the similarity between the rendered highlight and the actual highlight observation. , and improve user experience.
  • an exemplary implementation of determining the highlight intensity parameter corresponding to the highlight shape according to the highlight image in step 12 is as follows. This step may include:
  • the feature values of each pixel point in the column are accumulated, and the highlight intensity parameter of the column is determined based on the accumulation result corresponding to the column. For example, the ratio of the accumulated result to the height of the column of the highlight image may be determined as the highlight intensity parameter of the column.
  • the highlight intensity parameter of the column can be calculated by the following formula:
  • lightValue is used to represent the highlight intensity parameter of the column
  • Colori is used to represent the characteristic value of the pixel in the i-th row in the column, that is, the value of the position of the pixel in the image matrix of the highlight image;
  • tex.height is used to represent the total number of pixels in each column in the highlight image, that is, the height of the column.
  • the highlight intensity parameters corresponding to the highlight shape are determined.
  • the highlight intensity parameter of the column can be determined as the highlight intensity parameter corresponding to each pixel in the column, so that the highlight intensity parameter corresponding to each pixel in the image matrix of the highlight image can be obtained.
  • the highlight intensity parameter is the highlight intensity parameter corresponding to the highlight shape.
  • the highlight intensity parameter can be represented by a parameter matrix.
  • the parameter matrix is the same size as the image matrix corresponding to the highlight image. Then the determined highlight intensity parameter of each pixel can be drawn to the same pixel corresponding to the parameter matrix. position, thereby storing the highlight intensity parameters corresponding to the highlight shape through the parameter matrix.
  • the image representation of the obtained parameter matrix is shown in Figure 7.
  • the intensity features in the highlight image can be extracted, so that each column in the highlight shape can be processed separately, and the intensity relationship between each column can be obtained to characterize the highlight shape for subsequent processing.
  • Specular rendering provides accurate data support.
  • an exemplary implementation of determining the highlight offset parameter corresponding to the highlight shape according to the highlight image in step 12 is as follows. This step may include:
  • the center row number of the highlight shape corresponding to the column is determined.
  • each pixel in the column can be traversed row by row, and the lowest row number and the highest row number corresponding to the highlight shape in the column can be determined based on the characteristic value of each pixel.
  • the determined lowest row number corresponding to the highlight shape in this column is p2, and the highest row number is p1.
  • the center row number of the highlight shape corresponding to the column can be determined based on the lowest row number and the highest row number, that is, the center row number can be expressed as: 0.5*(bottomIndex+topIndex)
  • bottomIndex is used to represent the lowest line number
  • topIndex is used to represent the highest line number
  • the highlight offset parameter of the column is determined according to the center row number of the highlight shape corresponding to the column and the center row number of the highlight image.
  • the center row number corresponding to the highlight image can be expressed as 0.5*tex.height, then the center row number corresponding to the highlight shape of the column can be subtracted from the center row number corresponding to the highlight image as the offset row number of the column, That is, the offset of the center of the highlight of the column relative to the center of the image. If the highlight center corresponding to the column is exactly at the center of the highlight image, the offset is 0. If the highlight center corresponding to the column is lower than the center of the highlight image, the offset is a negative value. If the highlight center corresponding to the column is higher than the highlight The center of the image is offset by a positive value.
  • the number of offset rows corresponding to the column can be used as the highlight offset parameter corresponding to the column.
  • the value range of the offset row number is (-0.5*tex.height,0.5*tex.height), that is, the extreme value of the offset row number is 0.5*tex.height.
  • the normalization process can be to divide the offset row number by the extreme value, so that the offset parameter can be mapped to -1 ⁇ between 1.
  • shiftValue is used to represent the highlight shift parameter.
  • a highlight offset parameter corresponding to the highlight shape is determined.
  • the highlight offset parameter of the column can be determined as the highlight offset parameter corresponding to each pixel in the column, so that each pixel in the image matrix of the highlight image can be obtained
  • the highlight offset parameter corresponding to the point is the highlight offset parameter corresponding to the highlight shape.
  • the offset features in the highlight image can be extracted, so that each column in the highlight shape can be processed separately, and the upper and lower offset between the highlight corresponding to each column and the center of the highlight image can be determined. relationship to characterize the highlight shape and provide accurate data support for subsequent highlight rendering.
  • the highlight offset parameter can also be stored through the image corresponding to the parameter matrix, and the value of the highlight offset parameter determined as described above is -1 to 1, and based on the image pair
  • the present disclosure also provides the following embodiments to further process the highlight offset parameters.
  • This step may include:
  • the highlight offset parameters of each column are mapped into the target range to obtain offset mapping values corresponding to each column, where the value of the target range is a positive value.
  • the determined value range of the highlight offset parameter is (-1,1)
  • the highlight offset parameter can be further mapped to a target range, the lower limit of the target range Greater than 0, that is, the offset mapping value obtained by mapping is a positive value, allowing it to be stored as an image.
  • the shiftValue’ is the offset mapping value obtained after mapping the highlight offset parameter shiftValue.
  • the parameter image matrix formed by the offset mapping values corresponding to each column is determined as the highlight offset parameter corresponding to the highlight shape.
  • the offset mapping value corresponding to each column can be determined as the value of each pixel point in the column, thereby forming the parameter image matrix, and the highlight offset parameters corresponding to the highlight shape are stored through the parameter image matrix.
  • the image representation corresponding to the obtained parameter image matrix is that in each column of the image, the elements contained in the column have the same values, and its representation is also a strip image similar to that shown in Figure 7.
  • the determined highlight offset parameters can be mapped, the highlight offset parameters can be stored in the form of images, and the conversion of the highlight image to the highlight offset parameters can be realized, ensuring that the highlight offset parameters are matched with the highlight image. Consistency, and the acquisition and application of highlight offset parameters in subsequent rendering processes improve highlight rendering efficiency.
  • the determined highlight offset parameter and highlight intensity parameter can be stored in the same image.
  • the highlight intensity parameter can be used as the r channel data of the image
  • the highlight offset parameter can be used as the g channel data of the image.
  • float2 col is used to represent the data extracted from the image i.uv
  • tex2D is used to represent the sampling syntax, which can obtain the pixel color value of the corresponding position according to uv, and use the obtained r channel data as the highlight intensity parameter.
  • the obtained g channel data is used as the highlight offset parameter.
  • the anisotropic highlight calculation is performed according to the highlight shift parameter and the hair model, and an exemplary implementation manner of obtaining the anisotropic shift image is as follows.
  • This step may include:
  • the rendering parameters include world space normals, world space tangents, world space subnormals, world space line of sight directions, and world space light source directions.
  • the hair model can be a hair model in the art, which is not limited in this disclosure.
  • the rendering parameters corresponding to the hair model can be obtained, which are expressed as follows:
  • worldNormal world space normal
  • worldTangent world space tangent
  • worldBinormal world space binormal
  • worldViewDir world space line of sight direction
  • worldLightDir world space light source direction.
  • the world space subnormal is offset to obtain an updated world space subnormal.
  • the highlight offset parameter can represent the offset of the center position of the highlight column relative to the center position of the image, so that the corresponding offset amount can be determined based on the highlight offset parameter. If the highlight offset parameter is the value after the standard processing described above, the corresponding offset can be determined directly. If the highlight offset parameter is the data stored through the parameter image matrix, the data in the matrix needs to be Map to the initial range. For example, it can be mapped in the following way: (2*col.g-1), that is, the offset mapping value in the target range is mapped back to the initial range. col.g means the image where the parameters are stored. g channel data.
  • worldBinormal normalize(worldBinormal+_ShiftScale*(2*col.g-1)*worldNormal +_SpecularOffset)
  • _ShiftScale represents the first preset parameter of the model, which can be used to adjust the intensity of the offset. It can be set according to the user's experience value, for example, it can be set to 1.74.
  • _SpecularOffset represents the second preset parameter of the model, which can be used to control the offset of the highlight position. It can be set according to the user's experience value, for example, it can be set to 0.37.
  • Anisotropic highlight calculations are performed based on rendering parameters containing updated world space binormals to obtain an anisotropic offset image.
  • the dot product information is calculated for the subnormal.
  • the dot product information can include the dot product of the world space tangent and the half-angle vector, the dot product of the world space subnormal and the half-angle vector, and the dot product of the world space normal and the half-angle vector.
  • halfDir is used to represent the half-angle vector, that is, the intermediate angle vector between the world space line of sight direction and the world space light source direction;
  • dot() is used to express the dot product of two vectors, that is, the cosine value of the angle between the vectors. It can also express the projected area of one vector on the plane where the other vector is the normal;
  • TdotH is used to represent the dot product of the world space tangent and the half-angle vector
  • BdotH is used to represent the dot product of the world space subnormal and the half-angle vector
  • NdotH is used to represent the dot product of the world space normal and the half-angle vector, and also represents the diffuse illumination intensity.
  • specularLight is used to represent the highlight value in the anisotropic offset image
  • _Roughness is used to represent the roughness parameter.
  • the input can be preset according to the rendering material. For example, it can be set to 0.35 based on the empirical value;
  • Trowbridge_ReitzAnisotropic (NdotH,TdotH,BdotH,_Roughness) is used to represent the normal distribution calculation formula, as the basic lighting model for calculating anisotropic lighting in this disclosure.
  • the general function of this formula in the shader can be used to achieve anisotropy. The calculation will not be repeated here.
  • the world space subnormal in the hair model can be offset based on the highlight offset parameters corresponding to the highlight shape to be rendered before generating anisotropic highlights, so that the offset parameters can be used Computes anisotropic highlights with offset characteristics, ensuring consistency between the rendered image and the drawn highlight shape.
  • step 14 the anisotropic offset image is intensity superimposed based on the highlight intensity parameter, and an exemplary implementation of obtaining a highlight rendering image corresponding to the highlight image is as follows.
  • This step may include:
  • Exponential calculation is performed based on the highlight intensity parameter and the preset index to obtain the intensity contrast parameter.
  • exponential operations can be performed based on the following formula: pow(col.r,_Eigcnvaluc);
  • col.r is used to represent the r channel data in the image where the parameters are stored, that is, the highlight intensity parameter described in this disclosure, and _Eigcnvaluc is used to represent the input parameters of the material to be rendered, which can be set to 2.2 based on the empirical value; pow (col.r,_Eigcnvaluc) means that the highlight intensity parameter col.r is used as the base, and _Eigcnvaluc is used as the index to perform exponential operations to adjust the intensity contrast to obtain a more ideal intensity contrast.
  • intensity superposition is performed based on the intensity contrast parameter and the highlight value in the anisotropic offset image to obtain the highlight rendering image.
  • the highlight value in the anisotropic offset image may be the value of each pixel in the anisotropic offset image, that is, the specularLight mentioned above.
  • intensity superposition can be performed based on the intensity contrast parameter in each pixel of the anisotropic offset image.
  • the intensity value after superimposed intensity can be determined based on the intensity input parameter in the material to be rendered: M*_SpecularScale*pow(col.r,_Eigcnvaluc)*specularLight
  • _SpecularScale represents the intensity input parameter, which can be set to 1.15 based on the empirical value.
  • M is the preset value, which can be set to 10 as an example.
  • Figure 6 shows an anisotropic offset image after superimposing offsets.
  • the highlight intensity of each column in this image is the same (that is, the width is equal.
  • Figure 6 shows that different widths are caused by UV image stretching. (consistent), based on the image, further perform intensity superposition, then the center point corresponding to each column can be enlarged or reduced based on the highlight intensity parameter corresponding to the highlight shape in the column, so that the highlight intensity of the column is consistent with the highlight The shape remains consistent and the resulting image is shown in Figure 8.
  • the intensity in the anisotropic offset image can be adjusted based on the highlight intensity parameter corresponding to the highlight shape, so that the rendered highlight can be consistent with the drawn highlight shape, which can achieve the rendering
  • the highlight changes with changes in the light source and line of sight direction, and can maintain the drawn highlight shape during the change process, improving the accuracy and diversity of highlight rendering, providing support for animation rendering, and further improving the user's viewing experience.
  • An exemplary implementation of performing intensity superposition based on the intensity contrast parameter and the highlight value in the anisotropic offset image to obtain the highlight rendering image may include:
  • the highlight rendering image is generated according to the highlight value obtained after smoothing.
  • specularLight' is used to represent the smoothed highlight value, so that corresponding rendering can be performed based on the highlight value to obtain a highlight rendering image.
  • the specific rendering method can be selected based on the rendering model of the hair model, which is not carried out in this disclosure. limited.
  • smoothstep is used to represent a smooth step function, which represents a smooth mapping transition of the last parameter from 0 to 1 based on the values of the first two parameters.
  • W can be set to 0.04 based on empirical values
  • E can be set to 0.06 based on empirical values.
  • the exemplary implementation code of the smooth step function smoothstep is as follows:
  • the highlights can be further smoothed to fit the blocky features in the cartoon rendering process, further improving the rendering of the image and the cartoon scene of fit.
  • the present disclosure also provides a highlight rendering device.
  • the device 10 includes:
  • the acquisition module 100 is used to acquire the highlight image and hair model of the highlight shape to be rendered
  • the determination module 200 is configured to determine the highlight intensity parameter corresponding to the highlight shape according to the highlight image, and determine the highlight offset parameter corresponding to the highlight shape according to the highlight image;
  • the first processing module 300 is configured to perform anisotropic highlight calculation according to the highlight offset parameter and the hair model to obtain an anisotropic offset image
  • the second processing module 400 is configured to perform intensity superposition on the anisotropic offset image based on the highlight intensity parameter to obtain a highlight rendering image corresponding to the highlight image.
  • the determining module includes:
  • the first determination sub-module is used to accumulate, for each column in the image matrix of the highlight image, the feature values of each pixel in the column, and determine the highlight of the column based on the accumulation result corresponding to the column.
  • intensity parameters
  • the second determination sub-module is used to determine the highlight intensity parameter corresponding to the highlight shape based on the highlight intensity parameter of each column in the image matrix.
  • the determining module includes:
  • the third determination sub-module is used to determine, for each column in the image matrix of the highlight image, the center row number of the highlight shape corresponding to the column;
  • the fourth determination sub-module is used to determine the highlight offset parameter of the column according to the center row number of the highlight shape corresponding to the column and the center row number corresponding to the highlight image;
  • the fifth determination sub-module is used to determine the highlight offset parameter corresponding to the highlight shape based on the highlight offset parameter of each column in the highlight image.
  • the fifth determination sub-module includes:
  • the mapping submodule is used to map the highlight offset parameters of each column into the target range to obtain the offset mapping value corresponding to each column, wherein the value of the target range is a positive value;
  • the sixth determination sub-module is used to determine the parameter image matrix formed by the offset mapping values corresponding to each column as the highlight offset parameter corresponding to the highlight shape.
  • the first processing module includes:
  • the acquisition sub-module is used to obtain the rendering parameters corresponding to the hair model.
  • the rendering parameters include world space normals, world space tangents, world space subnormals, world space line of sight directions, and world space light source directions;
  • An offset submodule used to offset the world space subnormal based on the highlight offset parameter and the world space normal, and obtain an updated world space subnormal
  • the first processing submodule is used to perform anisotropic highlight calculation based on rendering parameters containing updated world space subnormals to obtain anisotropic offset images.
  • the second processing module includes:
  • the second processing submodule is used to perform exponential operation based on the highlight intensity parameter and the preset index to obtain the intensity contrast parameter;
  • An overlay submodule configured to perform intensity overlay based on the intensity contrast parameter and the highlight value in the anisotropic offset image to obtain the highlight rendering image.
  • the overlay sub-module includes:
  • the third processing sub-module is used to smooth the highlight values obtained by intensity superposition of the highlight values in the anisotropic offset image
  • the fourth processing sub-module is used to generate the highlight rendering image according to the highlight value obtained after smoothing processing.
  • Terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, PDA (Personal Digital Assistant, personal digital assistant), PAD (tablet computer), PMP (Portable Multimedia Player, portable multimedia player), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TV (Television, television), desktop computers, etc.
  • PDA Personal Digital Assistant
  • PAD tablet computer
  • PMP Portable Multimedia Player, portable multimedia player
  • vehicle-mounted terminals such as vehicle-mounted navigation terminals
  • fixed terminals such as digital TV (Television, television), desktop computers, etc.
  • the electronic device shown in FIG. 10 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
  • the electronic device 600 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which may process data according to a program stored in a read-only memory (Read Only Memory, ROM) 602 or from a storage device 608
  • a processing device such as a central processing unit, a graphics processor, etc.
  • the program loaded into the random access memory (Random Access Memory, RAM) 603 performs various appropriate actions and processes.
  • RAM 603 Random Access Memory
  • various programs and data required for the operation of the electronic device 600 are also stored.
  • the processing device 601, ROM 602 and RAM 603 are connected to each other via a bus 604.
  • An input/output (I/O) interface 605 is also connected to bus 604.
  • input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD) , an output device 607 such as a speaker, a vibrator, etc.; a storage device 608 including a magnetic tape, a hard disk, etc.; and a communication device 609.
  • Communication device 609 may allow electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data.
  • FIG. 10 illustrates electronic device 600 with various means, it should be understood that implementation or availability of all illustrated means is not required. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product including a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via communication device 609, or from storage device 608, or from ROM 602.
  • the processing device 601 When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are performed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof. More specific examples of computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer Computer disk, hard disk, random access memory (RAM), read only memory (ROM), electrical programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read only memory (Compact Disc Read Only Memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory electrical programmable read only memory
  • CD-ROM Compact Disc Read Only Memory
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • Program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency, Radio Frequency), etc., or any suitable combination of the above.
  • the client and server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium.
  • Communications e.g., communications network
  • Examples of communication networks include Local Area Networks (LANs), Wide Area Networks (WANs), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any current network for knowledge or future research and development.
  • LANs Local Area Networks
  • WANs Wide Area Networks
  • the Internet e.g., the Internet
  • end-to-end networks e.g., ad hoc end-to-end networks
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
  • the computer-readable medium carries one or more programs.
  • the electronic device obtains a highlight image and a hair model of the highlight shape to be rendered; according to the highlight image Determine the highlight intensity parameter corresponding to the highlight shape, and determine the highlight offset parameter corresponding to the highlight shape according to the highlight image; perform anisotropic highlight calculation according to the highlight offset parameter to obtain an anisotropic offset image;
  • the anisotropic offset image is intensity superimposed based on the highlight intensity parameter and the hair model to obtain a highlight rendering image corresponding to the highlight image.
  • Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as "C" or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider). connected via the Internet).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as an Internet service provider
  • each block in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more logic functions that implement the specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • the modules involved in the embodiments of the present disclosure can be implemented in software or hardware.
  • the name of the module does not constitute a limitation on the module itself under certain circumstances.
  • the acquisition module can also be described as "a module that acquires the highlight image and hair model of the highlight shape to be rendered.”
  • exemplary types of hardware logic components include: field programmable gate array (Field Programmable Gate Array, FPGA), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standard Product, ASSP), System On Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • Example 1 provides a highlight rendering method, wherein the method includes:
  • Intensity superposition is performed on the anisotropic offset image based on the highlight intensity parameter to obtain a highlight rendering image corresponding to the highlight image.
  • Example 2 provides the method of Example 1, wherein the determining the highlight intensity parameter corresponding to the highlight shape according to the highlight image includes:
  • a highlight intensity parameter corresponding to the highlight shape is determined.
  • Example 3 provides the method of Example 1, wherein the determining the highlight offset parameter corresponding to the highlight shape according to the highlight image includes:
  • a highlight offset parameter corresponding to the highlight shape is determined.
  • Example 4 provides the method of Example 3, wherein the highlight offset parameters corresponding to the highlight shape are determined based on the highlight offset parameters of each column in the highlight image. ,include:
  • the parameter image matrix formed by the offset mapping values corresponding to each column is determined as the highlight offset parameter corresponding to the highlight shape.
  • Example 5 provides the method of Example 1, wherein the anisotropic highlight calculation is performed according to the highlight shift parameter and the hair model to obtain an anisotropic shift image, including :
  • the rendering parameters include world space normals, world space tangents, world space subnormals, world space line of sight directions, and world space light source directions;
  • Anisotropic highlight calculations are performed based on rendering parameters containing updated world space binormals to obtain an anisotropic offset image.
  • Example 6 provides the method of Example 1, wherein the anisotropic offset image is intensity superimposed based on the highlight intensity parameter to obtain a value corresponding to the highlight image.
  • Specular rendering images including:
  • Intensity superposition is performed based on the intensity contrast parameter and the highlight value in the anisotropic offset image to obtain the highlight rendering image.
  • Example 7 provides the method of Example 6, wherein the intensity superposition is performed based on the intensity contrast parameter and the highlight value in the anisotropic offset image to obtain the Specular rendered images, including:
  • the highlight rendering image is generated according to the highlight value obtained after smoothing.
  • Example 8 provides a highlight rendering device, wherein the device includes:
  • the acquisition module is used to obtain the highlight image and hair model of the highlight shape to be rendered
  • a determination module configured to determine the highlight intensity parameter corresponding to the highlight shape according to the highlight image, and determine the highlight offset parameter corresponding to the highlight shape according to the highlight image;
  • a first processing module configured to perform anisotropic highlight calculation according to the highlight offset parameter and the hair model to obtain an anisotropic offset image
  • the second processing module is configured to perform intensity superposition on the anisotropic offset image based on the highlight intensity parameter to obtain a highlight rendering image corresponding to the highlight image.
  • Example 9 provides a computer-readable medium with a computer program stored thereon, wherein the computer program implements any one of Examples 1-7 when executed by a processing device Method steps.
  • Example 10 provides an electronic device, including:
  • a processing device configured to execute the computer program in the storage device to implement the steps of the method in any one of Examples 1-7.
  • Example 11 provides a computer program product, including a computer program that, when executed by a processing device, implements the steps of the method in any one of Examples 1-7.
  • Example 12 provides a computer program that, when executed by a processing device, implements the steps of the method in any one of Examples 1-7.

Abstract

本公开涉及一种高光渲染方法、装置、介质及电子设备,所述方法包括:获取待渲染的高光形状的高光图像和头发模型;根据高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定高光形状对应高光偏移参数;根据高光偏移参数和头发模型进行各向异性高光计算,获得各向异性偏移图像;基于高光强度参数对各向异性偏移图像进行强度叠加,获得与高光图像对应的高光渲染图像。由此在进行高光渲染时,可以在各向异性高光的计算过程中,基于该高光偏移参数和头发模型进行位置偏移,并基于高光强度参数进行强度叠加,以保证高光渲染后的形状与高光图像中的高光形状的一致性,保证卡通高光渲染和用户绘制的一致性,提升动画成像的准确性。

Description

高光渲染方法、装置、介质及电子设备
相关申请交叉引用
本公开要求于2022年4月8日提交的、申请号为202210369427.3、名称为“高光渲染方法、装置、介质及电子设备”的中国专利申请的优先权,其全部内容通过引用并入本文。
技术领域
本公开涉及图像处理领域,具体地,涉及一种高光渲染方法、装置、介质、电子设备、计算机程序产品及程序。
背景技术
现实生活中不同角度的光照射在头发上会在我们的视线中展示出不同的头发高光。在卡通人物的头发渲染中,不同于写实头发的高光渲染,其通常是具有块状的高光形状,如图1中的A处所示为写实头发的高光图像,图1中的B处所示为卡通渲染下的头发高光图像。
相关技术中,在对头发高光渲染的过程中,通常是由美术人员进行高光形状绘制,在基于其绘制的高光形状的纹理样式对头发进行高光渲染后,获得的高光图像是难以基于环境的改变而发生变化,难以达到动画的运动效果。
发明内容
提供该发明内容部分以便以简要的形式介绍构思,这些构思将在后面的具体实施方式部分被详细描述。该发明内容部分并不旨在标识要求保护的技术方案的关键特征或必要特征,也不旨在用于限制所要求的保护的技术方案的范围。
第一方面,本公开提供一种高光渲染方法,所述方法包括:
获取待渲染的高光形状的高光图像和头发模型;
根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
第二方面,本公开提供一种高光渲染装置,所述装置包括:
获取模块,用于获取待渲染的高光形状的高光图像和头发模型;
确定模块,用于根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
第一处理模块,用于根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
第二处理模块,用于基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
第三方面,本公开提供一种计算机可读介质,其上存储有计算机程序,该计算机程序被处理装置执行时实现第一方面所述方法的步骤。
第四方面,本公开提供一种电子设备,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现第一方面所述方法的步骤。
第五方面,本公开提供一种计算机程序产品,包括计算机程序,该计算机程序被处理装置执行时实现第一方面所述方法的步骤。
第六方面,本公开提供一种计算机程序,该计算机程序被处理装置执行时实现第一方面所述方法的步骤。
在上述技术方案中,在进行高光渲染时,首先将高光图像转换为高光偏移参数和高光强度参数进行表示,从而可以在各向异性高光的计算过程中,基于该高光偏移参数和头发模型进行位置偏移,并基于高光强度参数进行强度叠加。
本公开的其他特征和优点将在随后的具体实施方式部分予以详细说明。
附图说明
结合附图并参考以下具体实施方式,本公开各实施例的上述和其他特征、优点及方面将变得更加明显。贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。在附图中:
图1是写实头发和卡通头发的高光图像的对比示意图;
图2是基于本公开的实施方案提供的一种高光渲染方法的流程图;
图3是基于本公开的实施方案提供的高光图像的示意图;
图4是现有技术中各向异性下的方向示意图;
图5是现有技术中固定范围的各向异性渲染图像的示意图;
图6是基于本公开的实施方案提供的各向异性偏移图像的示意图;
图7是基于本公开的实施方案提供的高光强度参数的矩阵的图像表示;
图8是基于本公开的实施方案提供的高光渲染图像的示意图;
图9是基于本公开的实施方案提供的高光渲染装置的框图;
图10示出了适于用来实现本公开实施例的电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
图2所示,为基于本公开的实施方案提供的一种高光渲染方法的流程图,如图2所示,所述方法可以包括:
在步骤11中,获取待渲染的高光形状的高光图像和头发模型。其中,该高光图像可以是由美工人员绘制的具有高光形状的图像。头发模型可以是一个球体模型,该球体模型的表面图像可以展开为UV图像,相应地,该高光图像可以为UV图像,以便于可以贴图至该头发模型上。如图3所示的高光图像,其中的白色区域即为待渲染的高光形状。
在步骤12中,根据高光图像确定高光形状对应的高光强度参数,并根据高光图像确定高光形状对应高光偏移参数。
其中,所述高光强度参数可以用于表示所述高光形状的宽度信息,所述高光偏移参数用于表示所高光形状的位置信息,从而可以通过高光强度参数和高光偏移参数对该高光形状唯一且准确地表示。
在步骤13中,根据高光偏移参数和头发模型进行各向异性高光计算,获得各向异性偏移图像。
其中,由于头发的微观结构会导致头发在进行光照反射时,光线会沿发丝的切平面方向而不是通常的法线方向进行反射,如图4所示,该圆柱体表示一根头发,T表示切线方向,V表示视线方向,L表示光源方向,H表示L和V之间夹角的一半。头发的光线反射模型会使用各向异性光照,以在发丝上展示随光源方向和视线方向变化的高光。
作为示例,可以预先设置头发模型中高光的默认范围和位置,现有技术中,通过该方式可以在该默认范围内基于各向异性算法生成固定范围的高光,该各向异性图像中的高光形状呈环形,如图5中白色区域所示,在各个位置的高光强度是相同的,均为该默认范围。其中,各向异性高光算法可以是本领域中不基于物理的如Kajiya-Kay的算法或者是基于物理的GGX的算法,本公开对此不进行限定。
而如背景技术中所示,在本公开技术方案中需要保证绘制高光的形状,因此在该实施例中可以基于高光图像对应的高光偏移参数对高光形状进行位置偏移,进而可以在位置偏移后进行各向异性高光计算,获得各向异性偏移图像,如图6所示。
在步骤14中,基于高光强度参数对各向异性偏移图像进行强度叠加,获得与高光图像对应的高光渲染图像。
其中,在步骤13中进行各向异性高光计算时是对高光位置进行偏移之后所得的,在该基础上进一步叠加高光图像中对应的强度,从而在渲染所得的高光渲染图像中基于高光图像对应的偏移和强度控制高光形状。
由此,在上述技术方案中,在进行高光渲染时,首先将高光图像转换为高光偏移参数和高光强度参数进行表示,从而可以在各向异性高光的计算过程中,基于该高光偏移参数和头发模型进行位置偏移,并基于高光强度参数进行强度叠加,以保证高光渲染后的形状与高光图像中的高光形状的一致性,保证卡通高光渲染和用户绘制的一致性,提升动画成像的准确性。并且通过上述方案,既能够保证高光渲染过程中的形状稳定性,又能够实现高光渲染的各向异性,保证光照效果在灯光和视线交互上的准确性,提高渲染的高光与现实高光观测的相似性,提升用户使用体验。
在一种可能的实施例中,在步骤12中根据高光图像确定高光形状对应的高光强度参数的示例性实现方式如下,该步骤可以包括:
针对所述高光图像的图像矩阵中的每一列,将所述列中各个像素点的特征值进行累加,并根据所述列对应的累加结果确定所述列的高光强度参数。示例地,可以将累加的结果与所述高光图像的列的高度的比值确定为所述列的高光强度参数。
示例地,针对所述高光图像的图像矩阵中的每一列,该列的高光强度参数可以通过以下公式进行计算:
其中,lightValue用于表示该列的高光强度参数;
Colori用于表示该列中第i行的像素点的特征值,即该高光图像的图像矩阵中该像素点所处位置的取值;
tex.height用于表示高光图像中每列的像素点的总个数,即列的高度。
之后,基于所述图像矩阵中的每一列的高光强度参数,确定所述高光形状对应的高光强度参数。
其中,针对图像矩阵中的每一列,可以将该列的高光强度参数确定为该列中的每一像素点对应的高光强度参数,从而可以获得高光图像的图像矩阵中的每一像素点对应的高光强度参数,即所述高光形状对应的高光强度参数。
作为示例,该高光强度参数可以通过参数矩阵进行表示,该参数矩阵与高光图像对应的图像矩阵的大小相同,则可以将确定出每一像素点的高光强度参数绘制到参数矩阵的相同像素点对应的位置,从而通过参数矩阵对高光形状对应的高光强度参数进行存储,获得的参数矩阵的图像表示如图7所示。
由此,通过上述技术方案,可以对高光图像中的强度特征进行提取,从而对高光形状中每列进行单独处理,获得各列之间的强度大小关系,以对高光形状进行表征,为后续进行高光渲染提供准确的数据支持。
在一种可能的实施例中,在步骤12中根据高光图像确定高光形状对应高光偏移参数的示例性实现方式如下,该步骤可以包括:
针对所述高光图像的图像矩阵中的每一列,确定所述列对应的高光形状的中心行号。
其中,如图3所示的列为例,可以通过逐行遍历该列中的每一像素点,基于各个像素点的特征值确定出该列中对应高光形状的最低行号和最高行号,如图3所示,确定出的该列中的对应高光形状的最低行号为p2,最高行号为p1。
之后,则可以基于所述最低行号和所述最高行号,确定所述列对应的高光形状的中心行号,即中心行号可以表示为:
0.5*(bottomIndex+topIndex)
其中,bottomIndex用于表示最低行号,topIndex用于表示最高行号。
根据所述列对应的高光形状的中心行号和所述高光图像对应的中心行号,确定所述列的高光偏移参数。其中,该高光图像对应的中心行号可以表示为0.5*tex.height,则可以将列对应的高光形状的中心行号减去所述高光图像对应的中心行号作为该列偏移行数,即该列的高光的中心相对于图像的中心的偏移。如果该列对应的高光中心正好处在高光图像的中心则偏移为0,若该列对应的高光中心低于高光图像的中心则偏移为负值,若该列对应的高光中心高于高光图像的中心则偏移为正值。
作为示例,可以将该列对应的偏移行数作为该列对应的高光偏移参数。作为另一示例,该偏移行数的取值范围为(-0.5*tex.height,0.5*tex.height),即该偏移行数的极值为0.5*tex.height,相应地,可以将该列的偏移行数进行标准化处理,获得该列对应的高光偏移参数,该标准化处理可以是将该偏移行数除以该极值,从而可以将偏移参数映射至-1~1之间。示例地,可以通过如下方式计算每列对应的高光偏移参数:
shiftValue=(bottomIndex+topIndex-tex.height)/tex.height
其中,shiftValue用于表示高光偏移参数。
之后,基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数。
同样地,针对图像矩阵中的每一列,可以将该列的高光偏移参数确定为该列中的每一像素点对应的高光偏移参数,从而可以获得高光图像的图像矩阵中的每一像素点对应的高光偏移参数,即所述高光形状对应的高光偏移参数。
由此,通过上述技术方案,可以对高光图像中的偏移特征进行提取,从而对高光形状中每列进行单独处理,并确定该每列对应的高光与高光图像的中心之间的上下偏移关系,以对高光形状进行表征,为后续进行高光渲染提供准确的数据支持。
在一种可能的实施例中,该高光偏移参数也可以通过参数矩阵对应的图像进行存储,而如上文所述确定出的高光偏移参数的取值为-1至1,而基于图像对数据进行存储时其取值通常不为负值,则上述高光偏移参数难以通过图像进行存储。基于此,本公开还提供以下实施例,以对高光偏移参数进行进一步处理。
可选地,所述基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数的另一示例性实现方式如下,该步骤可以包括:
将每一列的高光偏移参数映射目标范围内,获得每一列分别对应的偏移映射值,其中,所述目标范围的取值为正值。
其中,如上文所述示例,确定出的高光偏移参数的取值范围为(-1,1),则可以进一步将该高光偏移参数映射至目标范围内,所述目标范围的下限值大于0,即映射所得的偏移映射值 为正值,从而可以通过图像进行存储。高光偏移参数的取值范围为(-1,1),则示例地,该目标范围可以是(0,1),可以通过如下公式进行映射:
shiftValue’=0.5+0.5*shiftValue
其中,该shiftValue’即为对高光偏移参数shiftValue映射之后所得的偏移映射值。
将每一列分别对应的偏移映射值形成的参数图像矩阵,确定为所述高光形状对应的高光偏移参数。
相应地,可以将每一列分别对应的偏移映射值确定为该列中的各个像素点的取值,从而形成该参数图像矩阵,通过参数图像矩阵对高光形状对应的高光偏移参数进行存储,获得的参数图像矩阵对应的图像表示,在该图像的每一列中,该列包含的元素取值均相同,其表示也是与图7所示类似的条状图像。
由此,通过上述技术方案,可以对确定出的高光偏移参数进行映射,以通过图像的方式对高光偏移参数进行存储,实现高光图像至高光偏移参数的转换,保证与高光图像之间的一致性,同时后续渲染过程中的高光偏移参数的获取和应用,提升高光渲染效率。
作为示例,可以将确定出的高光偏移参数和高光强度参数通过同一图像进行存储,例如,可以将高光强度参数作为图像的r通道数据,将高光偏移参数作为图像的g通道数据。相应地,在后续对高光图像对应的高光偏移参数和高光强度参数进行使用时,则可以通过如下方式进一步在图像中提取对应的参数:
float2 col=tex2D(_MainTex,i.uv).rg
其中,float2 col用于表示从图像i.uv中提取出的数据,tex2D用于表示采样语法,其可以根据uv获取相应位置的像素颜色值,将获取到的r通道的数据作为高光强度参数,获取到的g通道的数据作为高光偏移参数。
在一种可能的实施例中,所述根据所述高光偏移参数和头发模型进行各向异性高光计算,获得各向异性偏移图像的示例性实现方式如下,该步骤可以包括:
获取头发模型对应的渲染参数,所述渲染参数包括世界空间法线、世界空间切线、世界空间副法线、世界空间视线方向和世界空间光源方向。
其中,该头发模型可以采用本领域中头发模型,本公开对此不进行限定。在确定出头发模型后,则可以获得头发模型对应的渲染参数,表示如下:
worldNormal:世界空间法线;
worldTangent:世界空间切线;
worldBinormal:世界空间副法线;
worldViewDir:世界空间视线方向;
worldLightDir:世界空间光源方向。
之后,基于所述高光偏移参数和所述世界空间法线,对所述世界空间副法线进行偏移,获得更新后的世界空间副法线。
其中,如上文所述,高光偏移参数可以表示该列高光的中心位置相对于图像的中心位置的偏移,从而可以基于高光偏移参数确定出其对应的偏移量。若高光偏移参数为上文所述的标准处处理之后的数值,则可以直接确定对应的偏移量,若高光偏移参数为通过参数图像矩阵存储的数据,则需要将该矩阵中的数据映射至初始的范围,示例地,可以通过如下方式进行映射:(2*col.g-1),即将目标范围内的偏移映射值映射回初始范围,col.g即表示存储参数的图像中的g通道的数据。
之后,可以通过如下方式对世界空间副法线进行偏移,获得更新后的世界空间副法线:
worldBinormal=
normalize(worldBinormal+_ShiftScale*(2*col.g-1)*worldNormal
+_SpecularOffset)
其中,_ShiftScale表示模型的第一预设参数,可以用于调节偏移的强度,可以根据用户的经验值进行设置,如可以设置为1.74。_SpecularOffset表示模型的第二预设参数,可以用于控制高光位置的偏移,可以根据用户的经验值进行设置,如可以设置为0.37。
基于包含更新后的世界空间副法线的渲染参数进行各向异性高光计算,获得各向异性偏移图像。
其中,在基于高光偏移参数对世界空间副法线进行偏移之后,则世界空间视线方向和世界空间光源方向对应的半角向量的方向也会发生变化,之后,可以基于偏移后的世界空间副法线进行点积信息计算,该点积信息可以包括世界空间切线与半角向量的点积、世界空间副法线与半角向量的点积、世界空间法线与半角向量的点积,公式如下:
halfDir=normalize(worldLightDir+worldViewDir)
TdotH=dot(worldTangent,halfDir)
BdotH=dot(worldBinormal,halfDir)
NdotH=saturate(dot(worldNormal,halfDir))
其中,halfDir用于表示半角向量,即世界空间视线方向和世界空间光源方向的中间角度向量;
dot()用于表示求两个向量的点积,即向量夹角的余弦值,同时也可以表示一个向量在另一个向量为法线的平面上的投影面积;
TdotH用于表示世界空间切线与半角向量的点积;
BdotH用于表示世界空间副法线与半角向量的点积;
NdotH用于表示世界空间法线与半角向量的点积,也表示漫反射光照强度。
之后,可以基于上述计算所得的点积信息进一步进行各向异性高光计算:
specularLight=max(0,NdotH*
Trowbridge_ReitzAnisotropic(NdotH,TdotH,BdotH,_Roughness))
其中,specularLight用于表示各向异性偏移图像中的高光值;
_Roughness用于表示粗糙度参数,可以根据渲染材质预先设置输入,如可以基于经验值设置为0.35;
Trowbridge_ReitzAnisotropic(NdotH,TdotH,BdotH,_Roughness)用于表示法线分布计算公式,作为本公开中计算各项异性光照的基础光照模型,示例地,可以采用着色器中该公式的通用函数实现各向异性计算,在此不再赘述。
其中,上述代码中的参数为基于经验值的示例说明,不对本公开进行限定。
由此,通过上述技术方案,可以在生成各向异性高光之前基于待渲染的高光形状对应的高光偏移参数对头发模型中的世界空间副法线进行偏移,从而可以基于偏移后的参数计算具有偏移特征的各向异性高光,从而保证渲染的图像与绘制的高光形状之间的一致性。
在一种可能的实施例中,在步骤14中基于高光强度参数对各向异性偏移图像进行强度叠加,获得与高光图像对应的高光渲染图像的示例性实现方式如下,该步骤可以包括:
基于所述高光强度参数和预设指数进行指数运算,获得强度对比参数。
示例地,可以基于以下公式进行指数运算:pow(col.r,_Eigcnvaluc);
其中,col.r用于表示存储参数的图像中的r通道数据,即本公开中所述的高光强度参数,_Eigcnvaluc用于表示待渲染的材质的输入参数,可以基于经验值设置为2.2;pow(col.r,_Eigcnvaluc)表示以表示高光强度参数col.r为底数,以_Eigcnvaluc为指数进行指数运算,用于调节强度对比度,以获取更理想化的强度对比。
之后,基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像。
其中,所述各向异性偏移图像中的高光值可以是各向异性偏移图像中的各个像素点的取值,即上文所述的specularLight。
作为示例,可以在所述各向异性偏移图像的每一像素点中基于该强度对比参数进行强度叠加,例如,可以基于中待渲染的材质中强度输入参数确定叠加强度后的强度值:
M*_SpecularScale*pow(col.r,_Eigcnvaluc)*specularLight
其中,_SpecularScale即表示该强度输入参数,可以基于经验值设置为1.15,M为预设数值,示例地可以设置为10。
因此,可以通过上述公式对各向异性偏移图像中的每一像素点的高光值进行叠加,从而获得对应的高光渲染图像。示例地,如图6所示为叠加偏移之后的各向异性偏移图像,在该图像中的每一列的高光强度相同(即宽度相等,在图6中显示不同宽度为UV图像拉伸所致),在该图像的基础上,进一步进行强度叠加,则可以每一列对应的中心点,基于该列中的高光形状对应的高光强度参数对进行放大或缩小,使得该列的高光强度与高光形状中保持一致,所得图像如图8所示。
由此,通过上述技术方案,可以在基于高光形状对应的高光强度参数对各向异性偏移图像中的强度进行调整,使得渲染所得的高光可以和绘制的高光形状保持一致,既能够实现渲染的高光随光源和视线方向的变化而变化,又可以在变化的过程中保持绘制的高光形状,提高高光渲染的准确性和多样性,为动画渲染提供支持,并且可以进一步提升用户的观看体验。
作为另一示例,为了保证卡通渲染的风格化,本公开还提供以下实施例。所述基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像的示例性实现方式可以包括:
对所述各向异性偏移图像中的高光值进行强度叠加所得的高光值进行平滑处理;
根据平滑处理后所得的高光值生成所述高光渲染图像。
示例地,可以基于如下公式进一步地对进行强度叠加后的高光值进行平滑处理,例如:
specularLight’=smoothstep(W,E,M*_SpecularScale*
pow(col.r,_Eigcnvaluc)*specularLight)
其中,specularLight’用于表示平滑处理后的高光值,从而可以基于该高光值进行相应的渲染,获得高光渲染图像,具体的渲染方式可以基于头发模型的渲染模型进行选择,本公开对此不进行限定。
smoothstep用于表示平滑阶梯函数,其表示将最后一个参数根据前两个参数的值进行0~1的平滑映射过渡。示例地,W可以基于经验值设置为0.04,E可以根据经验值设置为0.06。该平滑阶梯函数smoothstep的示例性实现代码如下:
其中,代码中的相应数值为示例性说明,可以根据实际应用渲染场景进行设置,不对本公开进行限定。
由此,通过上述技术方案,可以在高光渲染的过程中保证高光形状的同时,可以进一步对高光进行平滑处理,以贴合卡通渲染过程中的块状特征,进一步提高渲染所得的图像与卡通场景的贴合性。
本公开还提供一种高光渲染装置,如图9所示,所述装置10包括:
获取模块100,用于获取待渲染的高光形状的高光图像和头发模型;
确定模块200,用于根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
第一处理模块300,用于根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
第二处理模块400,用于基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
可选地,所述确定模块包括:
第一确定子模块,用于针对所述高光图像的图像矩阵中的每一列,将所述列中各个像素点的特征值进行累加,并根据所述列对应的累加结果确定所述列的高光强度参数;
第二确定子模块,用于基于所述图像矩阵中的每一列的高光强度参数,确定所述高光形状对应的高光强度参数。
可选地,所述确定模块包括:
第三确定子模块,用于针对所述高光图像的图像矩阵中的每一列,确定所述列对应的高光形状的中心行号;
第四确定子模块,用于根据所述列对应的高光形状的中心行号和所述高光图像对应的中心行号,确定所述列的高光偏移参数;
第五确定子模块,用于基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数。
可选地,所述第五确定子模块包括:
映射子模块,用于将每一列的高光偏移参数映射目标范围内,获得每一列分别对应的偏移映射值,其中,所述目标范围的取值为正值;
第六确定子模块,用于将每一列分别对应的偏移映射值形成的参数图像矩阵,确定为所述高光形状对应的高光偏移参数。
可选地,所述第一处理模块包括:
获取子模块,用于获取头发模型对应的渲染参数,所述渲染参数包括世界空间法线、世界空间切线、世界空间副法线、世界空间视线方向和世界空间光源方向;
偏移子模块,用于基于所述高光偏移参数和所述世界空间法线,对所述世界空间副法线进行偏移,获得更新后的世界空间副法线;
第一处理子模块,用于基于包含更新后的世界空间副法线的渲染参数进行各向异性高光计算,获得各向异性偏移图像。
可选地,所述第二处理模块包括:
第二处理子模块,用于基于所述高光强度参数和预设指数进行指数运算,获得强度对比参数;
叠加子模块,用于基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像。
可选地,所述叠加子模块包括:
第三处理子模块,用于对所述各向异性偏移图像中的高光值进行强度叠加所得的高光值进行平滑处理;
第四处理子模块,用于根据平滑处理后所得的高光值生成所述高光渲染图像。
下面参考图10,其示出了适于用来实现本公开实施例的电子设备600的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、PDA(Personal Digital Assistant,个人数字助理)、PAD(平板电脑)、PMP(Portable Multimedia Player,便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV(Television,电视)、台式计算机等等的固定终端。图10示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图10所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(Read Only Memory,ROM)602中的程序或者从存储装置608加载到随机访问存储器(Random Access Memory,RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(Input/Output,I/O)接口605也连接至总线604。
通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图10示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计 算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(Electrical Programmable Read Only Memory,EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(Radio Frequency,射频)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取待渲染的高光形状的高光图像和头发模型;根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;根据所述高光偏移参数进行各向异性高光计算,获得各向异性偏移图像;基于所述高光强度参数和所述头发模型对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言——诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)——连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是, 框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的模块可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,模块的名称在某种情况下并不构成对该模块本身的限定,例如,获取模块还可以被描述为“获取待渲染的高光形状的高光图像和头发模型的模块”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Product,ASSP)、片上系统(System On Chip,SOC)、复杂可编程逻辑设备(Complex Programmable Logic Device,CPLD)等等。
根据本公开的一个或多个实施例,示例1提供了一种高光渲染方法,其中,所述方法包括:
获取待渲染的高光形状的高光图像和头发模型;
根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
根据本公开的一个或多个实施例,示例2提供了示例1的方法,其中,所述根据所述高光图像确定所述高光形状对应的高光强度参数,包括:
针对所述高光图像的图像矩阵中的每一列,将所述列中各个像素点的特征值进行累加,并根据所述列对应的累加结果确定所述列的高光强度参数;
基于所述图像矩阵中的每一列的高光强度参数,确定所述高光形状对应的高光强度参数。
根据本公开的一个或多个实施例,示例3提供了示例1的方法,其中,所述根据所述高光图像确定所述高光形状对应高光偏移参数,包括:
针对所述高光图像的图像矩阵中的每一列,确定所述列对应的高光形状的中心行号;
根据所述列对应的高光形状的中心行号和所述高光图像对应的中心行号,确定所述列的高光偏移参数;
基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数。
根据本公开的一个或多个实施例,示例4提供了示例3的方法,其中,所述基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数,包括:
将每一列的高光偏移参数映射目标范围内,获得每一列分别对应的偏移映射值,其中,所述目标范围的取值为正值;
将每一列分别对应的偏移映射值形成的参数图像矩阵,确定为所述高光形状对应的高光偏移参数。
根据本公开的一个或多个实施例,示例5提供了示例1的方法,其中,所述根据所述高光偏移参数和头发模型进行各向异性高光计算,获得各向异性偏移图像,包括:
获取头发模型对应的渲染参数,所述渲染参数包括世界空间法线、世界空间切线、世界空间副法线、世界空间视线方向和世界空间光源方向;
基于所述高光偏移参数和所述世界空间法线,对所述世界空间副法线进行偏移,获得更新后的世界空间副法线;
基于包含更新后的世界空间副法线的渲染参数进行各向异性高光计算,获得各向异性偏移图像。
根据本公开的一个或多个实施例,示例6提供了示例1的方法,其中,所述基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像,包括:
基于所述高光强度参数和预设指数进行指数运算,获得强度对比参数;
基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像。
根据本公开的一个或多个实施例,示例7提供了示例6的方法,其中,所述基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像,包括:
对所述各向异性偏移图像中的高光值进行强度叠加所得的高光值进行平滑处理;
根据平滑处理后所得的高光值生成所述高光渲染图像。
根据本公开的一个或多个实施例,示例8提供了一种高光渲染装置,其中,所述装置包括:
获取模块,用于获取待渲染的高光形状的高光图像和头发模型;
确定模块,用于根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
第一处理模块,用于根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
第二处理模块,用于基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
根据本公开的一个或多个实施例,示例9提供了一种计算机可读介质,其上存储有计算机程序,其中,该计算机程序被处理装置执行时实现示例1-7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例10提供了一种电子设备,其中,包括:
存储装置,其上存储有计算机程序;
处理装置,用于执行所述存储装置中的所述计算机程序,以实现示例1-7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例11提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理装置执行时实现示例1-7中任一项所述方法的步骤。
根据本公开的一个或多个实施例,示例12提供了一种计算机程序,该计算机程序被处理装置执行时实现示例1-7中任一项所述方法的步骤。
以上描述仅为本公开的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本公开中所涉及的公开范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离上述公开构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本公开中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。
尽管已经采用特定于结构特征和/或方法逻辑动作的语言描述了本主题,但是应当理解所附权利要求书中所限定的主题未必局限于上面描述的特定特征或动作。相反,上面所描述的特定特征和动作仅仅是实现权利要求书的示例形式。关于上述实施例中的装置,其中各个模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。

Claims (12)

  1. 一种高光渲染方法,其中,所述方法包括:
    获取待渲染的高光形状的高光图像和头发模型;
    根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
    根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
    基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
  2. 根据权利要求1所述的方法,其中,所述根据所述高光图像确定所述高光形状对应的高光强度参数,包括:
    针对所述高光图像的图像矩阵中的每一列,将所述列中各个像素点的特征值进行累加,并根据所述列对应的累加结果确定所述列的高光强度参数;
    基于所述图像矩阵中的每一列的高光强度参数,确定所述高光形状对应的高光强度参数。
  3. 根据权利要求1或2所述的方法,其中,所述根据所述高光图像确定所述高光形状对应高光偏移参数,包括:
    针对所述高光图像的图像矩阵中的每一列,确定所述列对应的高光形状的中心行号;
    根据所述列对应的高光形状的中心行号和所述高光图像对应的中心行号,确定所述列的高光偏移参数;
    基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数。
  4. 根据权利要求3所述的方法,其中,所述基于所述高光图像中的每一列的高光偏移参数,确定所述高光形状对应的高光偏移参数,包括:
    将每一列的高光偏移参数映射目标范围内,获得每一列分别对应的偏移映射值,其中,所述目标范围的取值为正值;
    将每一列分别对应的偏移映射值形成的参数图像矩阵,确定为所述高光形状对应的高光偏移参数。
  5. 根据权利要求1-4中任一项所述的方法,其中,所述根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像,包括:
    获取所述头发模型对应的渲染参数,所述渲染参数包括世界空间法线、世界空间切线、世界空间副法线、世界空间视线方向和世界空间光源方向;
    基于所述高光偏移参数和所述世界空间法线,对所述世界空间副法线进行偏移,获得更新后的世界空间副法线;
    基于包含更新后的世界空间副法线的渲染参数进行各向异性高光计算,获得各向异 性偏移图像。
  6. 根据权利要求1-5中任一项所述的方法,其中,所述基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像,包括:
    基于所述高光强度参数和预设指数进行指数运算,获得强度对比参数;
    基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像。
  7. 根据权利要求6所述的方法,其中,所述基于所述强度对比参数和所述各向异性偏移图像中的高光值进行强度叠加,获得所述高光渲染图像,包括:
    对所述各向异性偏移图像中的高光值进行强度叠加所得的高光值进行平滑处理;
    根据平滑处理后所得的高光值生成所述高光渲染图像。
  8. 一种高光渲染装置,其中,所述装置包括:
    获取模块,用于获取待渲染的高光形状的高光图像和头发模型;
    确定模块,用于根据所述高光图像确定所述高光形状对应的高光强度参数,并根据所述高光图像确定所述高光形状对应高光偏移参数;
    第一处理模块,用于根据所述高光偏移参数和所述头发模型进行各向异性高光计算,获得各向异性偏移图像;
    第二处理模块,用于基于所述高光强度参数对所述各向异性偏移图像进行强度叠加,获得与所述高光图像对应的高光渲染图像。
  9. 一种计算机可读介质,其上存储有计算机程序,其中,该计算机程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
  10. 一种电子设备,包括:
    存储装置,其上存储有计算机程序;
    处理装置,用于执行所述存储装置中的所述计算机程序,以实现权利要求1-7中任一项所述方法的步骤。
  11. 一种计算机程序产品,包括计算机程序,所述计算机程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
  12. 一种计算机程序,其中,所述计算机程序被处理装置执行时实现权利要求1-7中任一项所述方法的步骤。
PCT/CN2023/083473 2022-04-08 2023-03-23 高光渲染方法、装置、介质及电子设备 WO2023193613A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210369427.3A CN114693859A (zh) 2022-04-08 2022-04-08 高光渲染方法、装置、介质及电子设备
CN202210369427.3 2022-04-08

Publications (1)

Publication Number Publication Date
WO2023193613A1 true WO2023193613A1 (zh) 2023-10-12

Family

ID=82142409

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/083473 WO2023193613A1 (zh) 2022-04-08 2023-03-23 高光渲染方法、装置、介质及电子设备

Country Status (2)

Country Link
CN (1) CN114693859A (zh)
WO (1) WO2023193613A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114693859A (zh) * 2022-04-08 2022-07-01 北京字跳网络技术有限公司 高光渲染方法、装置、介质及电子设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100283795A1 (en) * 2009-05-07 2010-11-11 International Business Machines Corporation Non-real-time enhanced image snapshot in a virtual world system
CN113763526A (zh) * 2020-06-01 2021-12-07 上海米哈游天命科技有限公司 一种头发高光渲染方法、装置、设备及存储介质
CN113763525A (zh) * 2020-06-01 2021-12-07 上海米哈游天命科技有限公司 一种头发高光渲染方法、装置、设备及存储介质
CN113888398A (zh) * 2021-10-21 2022-01-04 北京百度网讯科技有限公司 头发渲染方法、装置及电子设备
CN114693859A (zh) * 2022-04-08 2022-07-01 北京字跳网络技术有限公司 高光渲染方法、装置、介质及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100283795A1 (en) * 2009-05-07 2010-11-11 International Business Machines Corporation Non-real-time enhanced image snapshot in a virtual world system
CN113763526A (zh) * 2020-06-01 2021-12-07 上海米哈游天命科技有限公司 一种头发高光渲染方法、装置、设备及存储介质
CN113763525A (zh) * 2020-06-01 2021-12-07 上海米哈游天命科技有限公司 一种头发高光渲染方法、装置、设备及存储介质
CN113888398A (zh) * 2021-10-21 2022-01-04 北京百度网讯科技有限公司 头发渲染方法、装置及电子设备
CN114693859A (zh) * 2022-04-08 2022-07-01 北京字跳网络技术有限公司 高光渲染方法、装置、介质及电子设备

Also Published As

Publication number Publication date
CN114693859A (zh) 2022-07-01

Similar Documents

Publication Publication Date Title
CN111242881B (zh) 显示特效的方法、装置、存储介质及电子设备
WO2022068451A1 (zh) 风格图像生成方法、模型训练方法、装置、设备和介质
CN110728622B (zh) 鱼眼图像处理方法、装置、电子设备及计算机可读介质
CN111932664A (zh) 图像渲染方法、装置、电子设备及存储介质
WO2021249091A1 (zh) 图像处理方法、装置、计算机存储介质及电子设备
WO2022042290A1 (zh) 一种虚拟模型处理方法、装置、电子设备和存储介质
WO2023207379A1 (zh) 图像处理方法、装置、设备及存储介质
WO2023193613A1 (zh) 高光渲染方法、装置、介质及电子设备
WO2022247630A1 (zh) 图像处理方法、装置、电子设备及存储介质
CN112561840A (zh) 视频裁剪方法、装置、存储介质及电子设备
CN109801354B (zh) 全景处理方法和装置
US11494961B2 (en) Sticker generating method and apparatus, and medium and electronic device
CN115810101A (zh) 三维模型风格化方法、装置、电子设备及存储介质
CN116310036A (zh) 场景渲染方法、装置、设备、计算机可读存储介质及产品
WO2023197860A1 (zh) 高光渲染方法、装置、介质及电子设备
CN111818265A (zh) 基于增强现实模型的交互方法、装置、电子设备及介质
WO2023025085A1 (zh) 视频处理方法、装置、设备、介质及程序产品
CN114723600A (zh) 美妆特效的生成方法、装置、设备、存储介质和程序产品
CN116527993A (zh) 视频的处理方法、装置、电子设备、存储介质和程序产品
CN114049403A (zh) 一种多角度三维人脸重建方法、装置及存储介质
CN111862342A (zh) 增强现实的纹理处理方法、装置、电子设备及存储介质
WO2023020283A1 (zh) 图像处理方法、装置、设备、介质及程序产品
CN115937010B (zh) 一种图像处理方法、装置、设备及介质
WO2024055837A1 (zh) 一种图像处理方法、装置、设备及介质
CN111489428B (zh) 图像生成方法、装置、电子设备及计算机可读存储介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23784177

Country of ref document: EP

Kind code of ref document: A1