CN107730577A - A kind of hooking rendering intent, device, equipment and medium - Google Patents
A kind of hooking rendering intent, device, equipment and medium Download PDFInfo
- Publication number
- CN107730577A CN107730577A CN201711090178.XA CN201711090178A CN107730577A CN 107730577 A CN107730577 A CN 107730577A CN 201711090178 A CN201711090178 A CN 201711090178A CN 107730577 A CN107730577 A CN 107730577A
- Authority
- CN
- China
- Prior art keywords
- vertex
- camera
- unit vector
- projection
- offset value
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000009877 rendering Methods 0.000 title claims abstract description 50
- 238000000034 method Methods 0.000 claims abstract description 49
- 238000004364 calculation method Methods 0.000 claims description 20
- 230000009466 transformation Effects 0.000 claims description 5
- 239000011159 matrix material Substances 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 3
- 238000006073 displacement reaction Methods 0.000 abstract 1
- 238000010586 diagram Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 4
- 230000006870 function Effects 0.000 description 4
- 230000008859 change Effects 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 238000003708 edge detection Methods 0.000 description 2
- 238000005286 illumination Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 230000000007 visual effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000015572 biosynthetic process Effects 0.000 description 1
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004040 coloring Methods 0.000 description 1
- 239000000463 material Substances 0.000 description 1
- 230000005012 migration Effects 0.000 description 1
- 238000013508 migration Methods 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000012805 post-processing Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 238000003786 synthesis reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
- G06T15/10—Geometric effects
- G06T15/20—Perspective computation
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Geometry (AREA)
- Computer Graphics (AREA)
- General Physics & Mathematics (AREA)
- Image Generation (AREA)
Abstract
The embodiment of the invention discloses a kind of hooking rendering intent, device, equipment and medium.This method includes:According to the deviant in the unit vector direction of projection of the vertex normal on camera projection plane and/or summit towards the deviant in the direction away from camera, line displacement is entered on summit;Hooking is drawn according to the summit after skew.The embodiment of the present invention realizes the real-time adjustment to hooking so that the hooking rendered is more controllable, eloquent.
Description
Technical Field
The embodiment of the invention relates to a rendering technology, in particular to a method, a device, equipment and a medium for line-drawing rendering.
Background
The line drawing refers to the contour line in the cartoon picture, and the coloring is carried out after the line drawing, which is one of the important expression forms of the cartoon style. Cartoon styles have always taken an important position in multimedia works such as animations, games, etc. The conventional cartoon-style works are mostly made on the basis of hand-drawn images, and the method needs a large amount of manpower investment and has limited expressive force. Particularly, in games, limited by the resource size and hardware performance, hand-drawn works often have the disadvantages of single visual angle, stiff action, low animation frame number and the like.
The 3D technology is now widely used in multimedia works, and it can effectively solve these problems of the hand-drawing method. The 3D technique takes a 3D model as input, transforms 3D model data into a 2D image using projective transformation and rasterization, calculates light shadows according to information such as surface normal, illumination direction, material, and the like, and finally synthesizes the light shadows onto the image. The visible 3D technology is relatively direct in reflecting the real spatial relationship and illumination of objects, and if the technology is used for rendering in a cartoon style, stylization processing is required on the basis. The problems to be solved are mainly two, one is the stylization of light and shadow and the other is the drawing of a hook line. The greatest characteristic of the cartoon style shadow is that the contour is clear, and the light-dark transition is hard, and is usually realized by remapping the light-dark transition by using binarization or gradient texture.
For line-hooking, a general 3D rendering process does not include line-hooking, and line-hooking requires a special process for rendering. The commonly used method is edge detection and synthesis based on image post-processing, which is to render a normal or depth map from a 3D model, identify the contours of an object using an edge detection algorithm on the map, generate contour lines at the contours, and synthesize the contour lines on the image. The main problem of this method is that it is relatively low in efficiency and not suitable for real-time application scenarios with high performance requirements.
Disclosure of Invention
The embodiment of the invention provides a line-hooking rendering method, which solves the problems that the existing line-hooking rendering method is low in efficiency and cannot render in real time.
In a first aspect, an embodiment of the present invention provides a line tracing rendering method, where the method includes:
offsetting the vertex according to the offset value of the vertex in the unit vector direction of the projection on the projection plane of the camera in the normal direction and/or the offset value of the vertex in the direction far away from the camera;
and drawing a hook line according to the vertex after the shift.
Further, shifting the vertex according to a shift value of the vertex normal to a unit vector direction of projection on the camera projection plane includes:
calculating a unit vector of projection of the vertex normal on a camera projection plane;
calculating an offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera according to the distance between the vertex and the camera, the wide-angle of view of the camera and the vertex color channel;
and offsetting the vertex towards the unit vector according to the offset value of the vertex normal to the unit vector direction of the projection on the camera projection plane.
Further, the calculating an offset value of a unit vector direction of a projection of a vertex normal on a projection plane of the camera according to a distance of the vertex from the camera, a wide-angle of view of the camera, and a vertex color channel includes:
calculating the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane according to a calculation formula of the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane:wherein,offset value in unit vector direction of projection of vertex normal onto camera projection plane, where NpIs the unit vector of the projection of the vertex normal onto the camera projection plane, d is the distance of the vertex from the camera, Fov is the view angle of the camera, B is the vertex color B channel, W is the global thickness parameter, R is the vertex color R channel.
Further, shifting the vertex according to the shift value of the vertex in the direction away from the camera includes:
calculating a unit vector of a vertex in a direction away from the camera;
calculating an offset value of the vertex towards a unit vector direction away from the camera according to the global offset parameter and the vertex color channel;
and shifting the vertex in the direction away from the camera according to the offset value of the vertex in the unit vector direction in the direction away from the camera.
Further, the calculating an offset value of the vertex in a unit vector direction away from the camera according to the global offset parameter and the vertex color channel includes:
calculating an offset value of the vertex in the unit vector direction in the direction away from the camera according to a calculation formula of the offset value of the vertex in the unit vector direction in the direction away from the camera: offsetZmaxZOffset x (G-0.5), wherein, OffsetZIs an offset value of the vertex towards the direction of the unit vector away from the camera, Z is the unit vector of the vertex towards the direction away from the camera, MaxZOffset is a global offset parameter, and G is a vertex color G channel.
Further, the calculating a unit vector of a projection of the vertex normal onto the camera projection plane includes:
calculating the projected unit vector of the vertex normal direction on the camera projection plane according to a calculation formula of the projected unit vector of the vertex normal direction on the camera projection plane:wherein N ispIs the unit vector of the projection of the vertex normal onto the camera projection plane, ObjectToCamera is the transformation matrix of the model space to the camera space, and N is the vertex normal of the model space.
In a second aspect, an embodiment of the present invention further provides a line drawing rendering apparatus, where the apparatus includes:
the offset module is used for offsetting the vertex according to the offset value of the vertex in the unit vector direction of the projection normal to the projection plane of the camera and/or the offset value of the vertex in the direction far away from the camera;
and the hook line drawing module is used for drawing a hook line according to the vertex after the deviation.
Further, the offset module includes:
a projection plane unit vector calculation unit for calculating a unit vector of a projection of the vertex normal to the projection plane of the camera;
the projection direction offset value calculating unit is used for calculating an offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera according to the distance between the vertex and the camera, the wide viewing angle of the camera and the vertex color channel; and the projection direction offset unit is used for offsetting the vertex towards the unit vector according to the offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera.
In a third aspect, an embodiment of the present invention further provides an apparatus, where the apparatus includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the delineation rendering method provided by any embodiment of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the delineation rendering method provided in any embodiment of the present invention.
According to the embodiment of the invention, the vertex is shifted according to the offset value of the vertex normal to the projection unit vector direction of the projection on the projection plane of the camera and/or the offset value of the vertex towards the direction far away from the camera, and the hook line is drawn according to the vertex after the shift.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a method for rendering a contour according to an embodiment of the present invention;
fig. 2 is a flowchart of a line drawing rendering method according to a second embodiment of the present invention;
fig. 3 is a flowchart of a line drawing rendering method according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a line drawing rendering device according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an apparatus according to a fifth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a flowchart of a method for rendering a contour according to an embodiment of the present invention. The technical scheme of the embodiment can be suitable for the condition of line drawing in the rendering cartoon style. The method can be executed by the line-drawing rendering device provided by the embodiment of the invention, the device can be realized in a software and/or hardware mode and is configured to be applied in a rendering engine, and the rendering engine can be any intelligent device with a video card function, such as a computer, a tablet computer, a mobile phone, an intelligent camera and the like. The method specifically comprises the following operations:
s110, the vertex is shifted according to the offset value of the vertex in the unit vector direction of the projection on the projection plane of the camera in the normal direction and/or the offset value of the vertex in the direction away from the camera.
The rendering is divided into front rendering, i.e., rendering of object contents, and back rendering, i.e., rendering of a drawn line. The outward side surface of the plane normal of each rendering surface in the 3D model is a front surface, and the inward side surface is a back surface. Drawing a hook line means drawing a hook line in a side surface inward of the plane normal of each rendering surface. The method for drawing the line is that a back expansion method is adopted, namely, the back of the 3D model is drawn by using a pure color, and the model is expanded for a circle along the normal direction of the rendering surface, and the expanded part can be used as the line, namely the contour line.
The vertex normal is perpendicular to one face and lies above the vertex, and the vertex normal describes the degree of smoothness of the polygonal surface. In 3D rendering, all graphics can be considered to be composed of vertices, i.e. vertices are points of the 3D model surface, where data can be stored for adjusting the thickness and shape of the contour lines. Conventionally, the data stored in the vertex is fixed, while the vertex in this embodiment stores an offset value, and the specific offset value is stored by using the vertex color 3 channel: r channel, G channel, and B channel.
Wherein, R channel: thick lines controlling the contour lines. Illustratively, 0.5 may be set as a standard value, with 1 indicating the thickest contour and 0 indicating no contour.
And a G channel: the deviation of the contour line in a direction away from the camera is controlled. Illustratively, the standard value may be set to 0.5 without shifting, and more than 0.5 with a backward shift, and less than 0.5 with a forward shift, the larger the value is, the backward shift is in a direction away from the camera, and the forward shift is in a direction closer to the camera. The purpose of the offset is mainly to hide unwanted hooks, which can be achieved by a backward offset, or to fix problems with unclear hooks because the edges of the model structure are covered by other structure parts, which can be achieved by a forward offset.
And a channel B: the influence of the camera distance on the profile is controlled. When the camera is far away, the hook line can be adjusted to be thin. The larger B, the larger the camera distance and the larger the line thinning amplitude. The standard value of B was 0.5. The method is mainly used for adjusting the influence of the camera distance on the thickness of the hook line, under the action of perspective projection, the farther an object is away from the camera, the smaller the size of the object on a projection image is, and the hook line rendered by a back expansion method can be influenced by the size of the object. In addition, the wide viewing angle of the camera is also influenced by the projection size of the object, and the larger the wide viewing angle, the smaller the projection. If no intervention is added, the hook line at the far position may be thin and invisible, the hook line can have thick line change beyond expectation when the camera is adjusted to view a wide angle, and the influence caused by the perspective can be properly reduced by adjusting the thick line change, so that the hook line thickness of each part on the picture is more uniform.
And S120, drawing a hook line according to the vertex after the deviation.
And drawing a hook line according to the data in the vertex after the shift. And rendering more controllable delineation according to the deviation value pre-recorded in the 3D model vertex data. The method has the advantages that the deviant value is written into the top point of the 3D model to control the hook line near the top point, discontinuous places can be repaired, messy places can be erased, and the thickness change of the hook line can be controlled, so that the hook line is clean, tidy, vivid and smooth and is closer to a hand-drawing style.
And according to the R channel data in the vertex data after the offset, increasing the places needing to be thickened, and reducing the places needing to be thinned. Illustratively, a sharp corner structure on the model can be found, the sharp corner can cause a gap between the hook line and the model, and the gap problem is solved by assigning the channel value of the vertex R near the sharp corner to be 0.
And according to the G channel data in the vertex data after the deviation, increasing the values of the places which do not want to be subjected to line hooking until the lines are disappeared. For example, it is also possible to find where the edge of the model structure is embedded in another structure, resulting in a discontinuity in the delineation line, and to reduce the value until the delineation line becomes continuous.
And according to B channel data in the vertex data after the migration, pulling the model to a place which is farthest from the camera and can appear in practical application, and adjusting the value according to the requirement to enable the thickness of each part to meet the requirement.
In the embodiment, the vertex is shifted according to the offset value of the vertex normal to the projection unit vector direction of the projection on the projection plane of the camera and/or the offset value of the vertex facing to the direction away from the camera, and the hook line is drawn according to the vertex after the shift.
Example two
Fig. 2 is a flowchart of a line drawing rendering method according to a second embodiment of the present invention. The technical solution of this embodiment further optimizes, on the basis of any of the solutions of the embodiments described above, an operation of shifting the vertex according to the offset value in the unit vector direction of the projection of the vertex normal to the projection plane of the camera. Correspondingly, the method of the embodiment comprises the following steps:
s210, calculating a unit vector of projection of the vertex normal direction on the projection plane of the camera.
For example, the unit vector of the projection of the vertex normal onto the camera projection plane may be calculated according to a calculation formula of the unit vector of the projection of the vertex normal onto the camera projection plane:wherein N ispIs the unit vector of the projection of the vertex normal onto the camera projection plane, ObjectToCamera is the transformation matrix of the model space to the camera space, and N is the vertex normal of the model space.
And S220, calculating an offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera according to the distance between the vertex and the camera, the wide viewing angle of the camera and the vertex color channel.
Wherein the color channel may be at least one of an R channel, a G channel, and a B channel.
Illustratively, the calculating an offset value in a unit vector direction of a projection of the vertex normal onto the camera projection plane from the distance of the vertex from the camera, the wide angle of view of the camera, and the vertex color channel includes:
calculating the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane according to a calculation formula of the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane:wherein,offset value in unit vector direction of projection of vertex normal onto camera projection plane, where NpIs the unit vector of the projection of the vertex normal onto the camera projection plane, d is the distance of the vertex from the camera, Fov is the view angle of the camera, B is the vertex color B channel, W is the global thickness parameter, R is the vertex color R channel.
And S230, according to the deviation value of the vertex normal to the projection unit vector direction on the projection plane of the camera, the vertex is deviated towards the unit vector.
And S240, drawing a hook line according to the vertex after the deviation.
According to the embodiment, the offset value of the vertex normal direction in the unit vector direction of the projection of the vertex normal direction on the camera projection plane is calculated through the distance from the vertex to the camera, the visual wide angle of the camera and the vertex color channel, so that the offset of the vertex in the unit vector direction of the projection of the vertex normal direction on the camera projection plane is realized, the vertex can be adjusted according to the offset value, and the flexibility of line hooking is improved.
EXAMPLE III
Fig. 3 is a flowchart of a line drawing rendering method according to a third embodiment of the present invention. The technical solution of this embodiment further optimizes, on the basis of any of the solutions of the embodiments described above, an operation of shifting the vertex according to the offset value of the vertex in the direction away from the camera. Correspondingly, the method of the embodiment comprises the following steps:
s310, a unit vector with the vertex facing away from the camera is calculated.
And determining a unit vector between the vertex and the camera connecting line according to the vector of the vertex and the camera connecting line, and setting the direction of the vector as the direction that the vertex is far away from the camera, namely obtaining the unit vector of which the vertex faces the direction far away from the camera.
And S320, calculating the offset value of the vertex towards the unit vector direction away from the camera according to the global offset parameter and the vertex color channel.
The global offset parameter may be set according to a specific rendering task, and is not limited herein. The vertex color channel may select any at least one of an R channel, a G channel, and a B channel. Illustratively, the calculating an offset value of the vertex in a unit vector direction away from the camera according to the global offset parameter and the vertex color channel includes:
calculating an offset value of the vertex in the unit vector direction in the direction away from the camera according to a calculation formula of the offset value of the vertex in the unit vector direction in the direction away from the camera: offsetZmaxZOffset x (G-0.5), wherein, OffsetZIs an offset value of the vertex towards the direction of the unit vector away from the camera, Z is the unit vector of the vertex towards the direction away from the camera, MaxZOffset is a global offset parameter, and G is a vertex color G channel.
S330, according to the deviation value of the vertex towards the unit vector direction of the direction far away from the camera, the vertex is deviated towards the direction far away from the camera.
And S340, drawing a hook line according to the vertex after the deviation.
In the embodiment, the offset value of the vertex towards the unit vector direction away from the camera is calculated through the global offset parameter and the vertex color channel, so that the offset of the vertex towards the unit vector direction away from the camera is realized, the vertex can be adjusted according to the offset value, and the flexibility of line hooking is improved.
Example four
Fig. 4 is a schematic structural diagram of a line drawing rendering device according to a fourth embodiment of the present invention. The device is used for executing the line drawing rendering method provided by any embodiment. The device includes:
a shifting module 410, configured to shift the vertex according to a shift value of the vertex normal to the unit vector direction of the projection on the camera projection plane and/or a shift value of the vertex in a direction away from the camera;
and the hook drawing module 420 is configured to draw a hook according to the vertex after the deviation.
Further, the offset module 410 includes:
a projection plane unit vector calculation unit for calculating a unit vector of a projection of the vertex normal to the projection plane of the camera;
the projection direction offset value calculating unit is used for calculating an offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera according to the distance between the vertex and the camera, the wide viewing angle of the camera and the vertex color channel; and the projection direction offset unit is used for offsetting the vertex towards the unit vector according to the offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera.
Further, the projection direction offset value calculation unit is specifically configured to:
calculating the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane according to a calculation formula of the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane:wherein,offset value in unit vector direction of projection of vertex normal onto camera projection plane, where NpIs the unit vector of the projection of the vertex normal onto the camera projection plane, d is the distance of the vertex from the camera, Fov is the view angle of the camera, B is the vertex color B channel, W is the global thickness parameter, R is the vertex color R channel.
Further, the offset module 410 further comprises:
a camera-far direction unit vector calculation unit for calculating a unit vector of which vertex points face in a direction far from the camera;
the far camera direction offset value calculation unit is used for calculating an offset value of the vertex towards the unit vector direction of the far camera direction according to the global offset parameter and the vertex color channel;
and the far camera direction shifting unit is used for shifting the vertex towards the direction far from the camera according to the offset value of the vertex towards the unit vector direction of the far camera direction.
Further, the off-camera direction offset value calculation unit is specifically configured to:
calculating an offset value of the vertex in the unit vector direction in the direction away from the camera according to a calculation formula of the offset value of the vertex in the unit vector direction in the direction away from the camera: offsetZmaxZOffset x (G-0.5), wherein, OffsetZIs an offset value of the vertex towards the direction of the unit vector away from the camera, Z is the unit vector of the vertex towards the direction away from the camera, MaxZOffset is a global offset parameter, and G is a vertex color G channel.
Further, the projection plane unit vector calculation unit is specifically configured to:
calculating the unit direction of the projection of the vertex normal direction on the projection plane of the camera according to the calculation formula of the unit vector of the projection of the vertex normal direction on the projection plane of the cameraQuantity:wherein N ispIs the unit vector of the projection of the vertex normal onto the camera projection plane, ObjectToCamera is the transformation matrix of the model space to the camera space, and N is the vertex normal of the model space.
The shading rendering device provided by the fourth embodiment of the invention realizes real-time adjustment of the shading, so that the rendered shading is more controllable and vivid and smooth.
The line-hooking rendering device provided by the embodiment of the invention can execute the line-hooking rendering method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an apparatus according to a fifth embodiment of the present invention, as shown in fig. 5, the apparatus includes a processor 50, a memory 51, an input device 52, and an output device 53; the number of processors 50 in the device may be one or more, and one processor 50 is taken as an example in fig. 5; the processor 50, the memory 51, the input device 52 and the output device 53 in the apparatus may be connected by a bus or other means, which is exemplified in fig. 5.
The memory 51 is a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the delineation rendering method in the embodiment of the present invention. The processor 50 executes various functional applications of the device and data processing by executing software programs, instructions and modules stored in the memory 51, that is, implements the above-described delineation rendering method.
The memory 51 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 51 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, the memory 51 may further include memory located remotely from the processor 50, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 52 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the device/terminal/server. The output device 53 may include a display device such as a display screen.
EXAMPLE six
An embodiment of the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for delineating a rendering, the method including:
offsetting the vertex according to the offset value of the vertex in the unit vector direction of the projection on the projection plane of the camera in the normal direction and/or the offset value of the vertex in the direction far away from the camera;
and drawing a hook line according to the vertex after the shift.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the delineation rendering method provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the line drawing rendering device, each unit and each module included in the embodiment are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be realized; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A method for line tracing rendering is characterized by comprising the following steps:
offsetting the vertex according to the offset value of the vertex in the unit vector direction of the projection on the projection plane of the camera in the normal direction and/or the offset value of the vertex in the direction far away from the camera;
and drawing a hook line according to the vertex after the shift.
2. The method of claim 1, wherein shifting the vertex according to an offset value of the vertex normal to a unit vector direction of a projection on a camera projection plane comprises:
calculating a unit vector of projection of the vertex normal on a camera projection plane;
calculating an offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera according to the distance between the vertex and the camera, the wide-angle of view of the camera and the vertex color channel;
and offsetting the vertex towards the unit vector according to the offset value of the vertex normal to the unit vector direction of the projection on the camera projection plane.
3. The method of claim 2, wherein calculating the offset value for the unit vector direction of the projection of the vertex normal onto the camera projection plane based on the distance of the vertex from the camera, the wide angle of view of the camera, and the vertex color channel comprises:
calculating the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane according to a calculation formula of the offset value of the vertex normal direction in the unit vector direction of the projection on the camera projection plane:wherein,offset value in unit vector direction of projection of vertex normal onto camera projection plane, where NpIs the unit vector of the projection of the vertex normal onto the camera projection plane, d is the distance of the vertex from the camera, Fov is the view angle of the camera, B is the vertex color B channel, W is the global thickness parameter, R is the vertex color R channel.
4. The method of claim 1, wherein offsetting the vertex according to the offset value of the vertex in a direction away from the camera comprises:
calculating a unit vector of a vertex in a direction away from the camera;
calculating an offset value of the vertex towards a unit vector direction away from the camera according to the global offset parameter and the vertex color channel;
and shifting the vertex in the direction away from the camera according to the offset value of the vertex in the unit vector direction in the direction away from the camera.
5. The method of claim 4, wherein calculating the offset value of the vertex in the unit vector direction away from the camera according to the global offset parameter and the vertex color channel comprises:
calculating an offset value of the vertex in the unit vector direction in the direction away from the camera according to a calculation formula of the offset value of the vertex in the unit vector direction in the direction away from the camera: offsetZmaxZOffset x (G-0.5), wherein, OffsetZIs an offset value of the vertex towards the direction of the unit vector away from the camera, Z is the unit vector of the vertex towards the direction away from the camera, MaxZOffset is a global offset parameter, and G is a vertex color G channel.
6. The method of claim 2, wherein said calculating a unit vector of a projection of the vertex normal onto the camera projection plane comprises:
calculating the projected unit vector of the vertex normal direction on the camera projection plane according to a calculation formula of the projected unit vector of the vertex normal direction on the camera projection plane:wherein N ispIs the unit vector of the projection of the vertex normal onto the camera projection plane, ObjectToCamera is the transformation matrix of the model space to the camera space, and N is the vertex normal of the model space.
7. A line drawing rendering device, comprising:
the offset module is used for offsetting the vertex according to the offset value of the vertex in the unit vector direction of the projection normal to the projection plane of the camera and/or the offset value of the vertex in the direction far away from the camera;
and the hook line drawing module is used for drawing a hook line according to the vertex after the deviation.
8. The apparatus of claim 7, wherein the offset module comprises:
a projection plane unit vector calculation unit for calculating a unit vector of a projection of the vertex normal to the projection plane of the camera;
the projection direction offset value calculating unit is used for calculating an offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera according to the distance between the vertex and the camera, the wide viewing angle of the camera and the vertex color channel; and the projection direction offset unit is used for offsetting the vertex towards the unit vector according to the offset value of the vertex normal to the projection unit vector direction on the projection plane of the camera.
9. An apparatus, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the delineation rendering method of any of claims 1-6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the delineation rendering method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711090178.XA CN107730577B (en) | 2017-11-08 | 2017-11-08 | Line-hooking rendering method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711090178.XA CN107730577B (en) | 2017-11-08 | 2017-11-08 | Line-hooking rendering method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107730577A true CN107730577A (en) | 2018-02-23 |
CN107730577B CN107730577B (en) | 2021-08-31 |
Family
ID=61222986
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711090178.XA Active CN107730577B (en) | 2017-11-08 | 2017-11-08 | Line-hooking rendering method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107730577B (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110390709A (en) * | 2019-06-19 | 2019-10-29 | 北京巴别时代科技股份有限公司 | The round and smooth method of cartoon rendering crisperding |
CN111724463A (en) * | 2020-06-29 | 2020-09-29 | 苏州幻塔网络科技有限公司 | Rendering method and device for model line drawing |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1265502A (en) * | 1999-03-02 | 2000-09-06 | 世嘉企业股份有限公司 | Image processing apparatus and method |
US20040047506A1 (en) * | 2001-04-16 | 2004-03-11 | Parascript Llc | Reshaping freehand drawn lines and shapes in an electronic document |
CN201845456U (en) * | 2010-01-12 | 2011-05-25 | 黄首征 | Drawing card |
CN104966312A (en) * | 2014-06-10 | 2015-10-07 | 腾讯科技(深圳)有限公司 | Method for rendering 3D model, apparatus for rendering 3D model and terminal equipment |
-
2017
- 2017-11-08 CN CN201711090178.XA patent/CN107730577B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1265502A (en) * | 1999-03-02 | 2000-09-06 | 世嘉企业股份有限公司 | Image processing apparatus and method |
US20040047506A1 (en) * | 2001-04-16 | 2004-03-11 | Parascript Llc | Reshaping freehand drawn lines and shapes in an electronic document |
CN201845456U (en) * | 2010-01-12 | 2011-05-25 | 黄首征 | Drawing card |
CN104966312A (en) * | 2014-06-10 | 2015-10-07 | 腾讯科技(深圳)有限公司 | Method for rendering 3D model, apparatus for rendering 3D model and terminal equipment |
Non-Patent Citations (3)
Title |
---|
J.P.COLLOMOSSE等: ""Rendering cartoon-style motion cues in post-production video"", 《GRAPHICAL MODELS》 * |
李大锦: ""基于纹理合成的水墨山水画自动绘制"", 《计算机应用》 * |
李盈: ""卡通渲染中边缘着墨技术原理研究"", 《信息技术》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110390709A (en) * | 2019-06-19 | 2019-10-29 | 北京巴别时代科技股份有限公司 | The round and smooth method of cartoon rendering crisperding |
CN110390709B (en) * | 2019-06-19 | 2023-01-03 | 北京巴别时代科技股份有限公司 | Cartoon rendering edge-hooking smoothing method |
CN111724463A (en) * | 2020-06-29 | 2020-09-29 | 苏州幻塔网络科技有限公司 | Rendering method and device for model line drawing |
WO2022000970A1 (en) * | 2020-06-29 | 2022-01-06 | 苏州幻塔网络科技有限公司 | Method and apparatus for rendering outline of model |
Also Published As
Publication number | Publication date |
---|---|
CN107730577B (en) | 2021-08-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11514593B2 (en) | Method and device for image processing | |
CN108537861B (en) | Map generation method, device, equipment and storage medium | |
CN107274476B (en) | Shadow map generation method and device | |
TWI581209B (en) | Z culling method, three-dimensional graphics processing method of z culling and apparatus threrof | |
CN107749077B (en) | Card ventilation grid shadow rendering method, device, equipment and medium | |
CN115147579B (en) | Block rendering mode graphic processing method and system for expanding block boundary | |
CN111652791B (en) | Face replacement display method, face replacement live broadcast device, electronic equipment and storage medium | |
CN110910308B (en) | Image processing method, device, equipment and medium | |
EP3343516A1 (en) | Method and device for applying an effect of an augmented or mixed reality application | |
CN111275824A (en) | Surface reconstruction for interactive augmented reality | |
CN111462205B (en) | Image data deformation, live broadcast method and device, electronic equipment and storage medium | |
CN107730577B (en) | Line-hooking rendering method, device, equipment and medium | |
CN111652794B (en) | Face adjusting and live broadcasting method and device, electronic equipment and storage medium | |
JP7460641B2 (en) | Apparatus and method for generating a light intensity image - Patents.com | |
CN111652025B (en) | Face processing and live broadcasting method and device, electronic equipment and storage medium | |
CN108171784B (en) | Rendering method and terminal | |
CN115311397A (en) | Method, apparatus, device and storage medium for image rendering | |
CN111651033B (en) | Face driving display method and device, electronic equipment and storage medium | |
CN111652024B (en) | Face display and live broadcast method and device, electronic equipment and storage medium | |
CN111652978B (en) | Grid generation method and device, electronic equipment and storage medium | |
CN113436300A (en) | Method and device for realizing explosion animation, electronic equipment and storage medium | |
CN110889889A (en) | Oblique photography modeling data generation method applied to immersive display equipment | |
JP2002260003A (en) | Video display device | |
US10559122B2 (en) | System and method for computing reduced-resolution indirect illumination using interpolated directional incoming radiance | |
CN118552704B (en) | Graphics processing method and system based on Unity scene |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |