CN104183008B - Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method - Google Patents
Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method Download PDFInfo
- Publication number
- CN104183008B CN104183008B CN201410373494.8A CN201410373494A CN104183008B CN 104183008 B CN104183008 B CN 104183008B CN 201410373494 A CN201410373494 A CN 201410373494A CN 104183008 B CN104183008 B CN 104183008B
- Authority
- CN
- China
- Prior art keywords
- tinter
- subdivision
- pel
- original
- variable
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Image Generation (AREA)
Abstract
The invention discloses a shader classification method and device based on surface signal fitting and tessellation and a graphics rendering method. A subdivision shader and a geometry shader are inserted into an original shader by utilizing a tessellation method to subdivide a rendering model, a fitting machine is used for calculating the values of a variable and an expression, in a corresponding subdivision pel of the subdivision model, in an original pixel shader, and the formed fitting machine is inserted into the original pixel shader to replace value calculation to the corresponding variable or expression so as to simplify the calculation of the original pixel shader and shorten calculation time. Furthermore, since the subdivision shader and the geometry shader are inserted, fitting calculation can be carried out on the subdivision pel so as to improve fitting precision and reduce rendering errors brought by simplifying the shader.
Description
Technical field
The present invention relates to graphics rendering technology field, more particularly, to a kind of based on surface signal matching and surface subdivision
Color device method for simplifying, device and method for rendering graph.
Background technology
Tinter instead of traditional fixing rendering pipeline, it is possible to achieve the correlation computations in the calculating of 3d graphics, due to
Its editability, it is possible to achieve various image effects and limited without the fixing rendering pipeline by video card.This is great
Improve the image quality of image.Up-to-date gpu streamline provides 5 tinters, and tinter is top-down to be followed successively by vertex coloring
Device (vertex shader), shell tinter (hull shader), domain tinter (domain shader), geometric coloration
(geometry shader) and pixel coloring device (fragment shader).All of tinter can be divided into 3 classes by function.
First kind tinter is vertex shader, processes vertex information, the locus on summit are projected on screen, that is, calculate summit
Two-dimensional coordinate.Equations of The Second Kind tinter is geometric manipulations tinter, including shell tinter, domain tinter and geometric coloration,
They calculate and export new geometric graphic element.3rd class is pixel coloring device, its geometric attribute after inputting as interpolation, is output as
The color value of pixel.All of tinter is all completely programmable, and allows the customization of flexible real-time rendering effect.
But, the calculating speed of tinter is largely dependent upon the experience of programmer.Despite some rules and work
Tool collection is still time-consuming to process Interactive Modeling and coloration program optimization, whole render process.Usually, the most time-consuming render
Calculate all in pixel coloring device part, the main target of therefore former method is all in the calculating optimizing pixel coloring device.
Pellacini provides the configurable tinter method for simplifying of user to carry out process model building pixel-by-pixel.Program Generating
A series of tinters progressively being simplified generation by original tinter.The method is by the simplification that the application of the code of tinter is specified
Rule, to generate a series of candidate's mutation, is then assessed the difference measured between mutation and original tinter to select with minimum
Candidate's mutation of error.The tinter that this selection course circulates to the last always becomes constant.Sitthi-amorn makes
Automatically simplify render process with genetic programming.Similar with pellacini, this algorithm is same calculate a series of progressively simplify
Color device, but consider more code transformation rules, including the exchange of operand AND operator, language in expression statement in code
The deletion of sentence and insertion etc. of sentence, simultaneously the method choose the tinter after more simplification using genetic algorithm, and
Also faster and more reliable result can be generated.
The method of pellacini is limited to little code conversion rule, can miss a lot of optimum results.Although
The method of sitthi-amorn increased more code conversion rules, but the method is merely only the table to pixel coloring device
Reach formula to simplify, do not consider whole to render flow process.
From the perspective of signal processing, generate the signal life that the visual effect on a surface is equivalent on surface
Become, model and reconstruct.In rendering, graphics can widely represent perhaps eurypalynous signal: color, texture mapping, asperities
Reason, Displacement, bidirectional texture function it is contemplated that calculate render and from transmission texture, etc..In order to represent or approximation surface light
According to signal, mainly there are two kinds of different methods.One is that adjustment surface adapts it to signal, or one fine-grained net of sampling
Then lattice simplify grid preferably to represent given signal.Another one expresses these signals using basic function, such as high
The basic function that the polynomial function of rank, the sparse RBF of mesh free, or data are decomposed.Because the limit of tinter input
System, the restructuring of grid approximately seems unrealistic for the optimization of tinter.We have proposed one and use the many of high-order
Item formula function carrys out the surface signal on the pel that approximate tinter generates, and this approximation method has in graphics widely to be made
With.
Content of the invention
For the deficiencies in the prior art, the invention provides a kind of tinter based on surface signal matching and surface subdivision
Method for simplifying, device and method for rendering graph.
A kind of tinter method for simplifying based on surface signal matching and surface subdivision, original tinter to be simplified includes
Original vertices tinter and original pixels tinter, comprising:
(1) set some groups of subdivision parameters, treat rending model according to each group of subdivision parameter and be finely divided, obtain corresponding
Segmentation Model;
(2) several variables or expression formula are selected from the function of original pixels tinter as fit object, for every
One fit object, generates matching device corresponding with each Segmentation Model respectively, and described matching device is used for this fit object
The surface signal generating on corresponding subdivision pel in current Segmentation Model is fitted, and calculates this plan according to fitting result
Close the value on target corresponding subdivision pel in current Segmentation Model;
(3) vertex shader, geometric coloration are generated according to original vertices tinter, for any one Segmentation Model,
One subdivision tinter is generated according to the corresponding subdivision parameter of this Segmentation Model, and from the corresponding all matchings of current Segmentation Model
Select several to replace corresponding variable or expression formula in original pixels tinter in device to obtain revising pixel coloring device, and should
Revise pixel coloring device to obtain with vertex shader, geometric coloration and the corresponding subdivision tinter combination of current Segmentation Model
Corresponding correction tinter, and tinter is revised as simplification tinter using each.
It is to obtain matching device in the present invention, first treat rending model and be finely divided, thus the subdivision mould being obtained using subdivision
Type, is segmented in Segmentation Model accordingly using the variable in surface signal fitting process calculating original pixels tinter and expression formula
Value on pel.In the Segmentation Model actually getting each subdivision pel on all have respective pel call number, and scheme
First call number has determined according to the subdivision parameter setting and subdivision function in segmentation process: is to segment pel using after subdivision
Barycentric coodinates on accordingly original pel for each subdivided vertices be numbered, numbering result is this subdivision pel in subdivision
Pel call number in model.Concrete method for numbering serial is: a summit selecting original pel is zero, from zero
Set out, according to by outer layers towards inner layers, each layer of inside clockwise traversal order traversal subdivision pel, and to pel according to traversal
Order number consecutively.It is directed to each target variable or goal expression when forming matching device, with the current institute of this pixel coloring device
The call number of the subdivision pel corresponding to the pixel processing goes to index the fitting function of this subdivision pel, is obtained using index
Fitting function calculates the target variable or expression formula value on this subdivision pel.
In the tinter method for simplifying of the present invention based on surface subdivision method insert in original tinter subdivision tinter and
Geometric coloration, treats rending model and is finely divided, and is generated for calculating original pixels coloring using surface signal fitting process
The matching device of the value on the variable in device and expression formula corresponding subdivision pel in Segmentation Model, and the matching device that will be formed
Being inserted in original pixels tinter, substituting the exploitation to corresponding variable or expression formula, thus simplify original pixels
The calculating of color device, accelerates the calculating time.Further, due to inserting subdivision tinter and geometric coloration, can be in subdivision graph
Carry out the Fitting Calculation in unit, thus improving fitting precision, reducing and rendering error by what simplification tinter brought.
The group number of number matching device and step (3) in select for replacing the number of matching device and compound mode
Relevant.One fit object corresponding matching device on a Segmentation Model, for each Segmentation Model, forms and revises picture
During plain tinter, different fit object corresponding matching device and the different matching device of quantity can be selected, thus obtaining not
Same correction pixel coloring device.The number revising tinter is more, and the probability obtaining optimum simplification result after simplification is bigger, but
Amount of calculation also can increase, and concrete number can set according to practical application request, and the number of the correction tinter that the present invention obtains is
200~10000.Every group of subdivision parameter includes: inside each pel, the number of plies of subdivision, each pel are in every layer of subdivision every
The subdivision number on side and subdivision step-length.Can complete to treat the subdivision of rending model based on above subdivision parameter.If triangle
3 group length of side subdivision parameters of setting (i.e. the subdivision number of each edge and subdivision step-length), tetragon arranges 4 groups of length of side subdivision ginsengs
Number.
The computational methods passing through fixing subdivision function in graphic hardware streamline in described step (1) are segmented according to each group
Parameter is treated rending model and is finely divided.
Rending model subdivision can be treated using multiple methods, directly utilize fixing subdivision function in graphic hardware streamline
Form the corresponding function that segments to segment it is also possible to there is subdivision function using fixing subdivision function in graphic hardware streamline and being formed
Tinter complete segment.Preferably, described step (1) forms corresponding first tinter pair for each group of subdivision parameter
Model to be rendered is finely divided, and the first described tinter generates as follows:
(1-1) the first vertex coloring is generated as input variable and output variable using the property value on summit and vertex index number
Device, the first described vertex shader is used for for the value of each input variable being assigned to corresponding output variable;
(1-2) it is directed to any one group of subdivision parameter, the first subdivision tinter is generated according to current group subdivision parameter, described
Subdivision tinter is used for property value and the vertex index number on the summit according to the first vertex shader output, by graphic hardware stream
In waterline, the computational methods of fixing subdivision function are treated rending model according to current group subdivision parameter and are finely divided, and according to subdivision
Result exports the property value of subdivided vertices, and the vertex index number on all summits of original pel at each subdivided vertices place
With barycentric coodinates on this original pel for each summit;
(1-3) generate the first geometric coloration, the first described geometric coloration is used for receiving the first subdivision tinter
Output, and the property value according to the currently processed all subdivided vertices segmenting pel of the data output receiving, all subdivisions
The vertex index number on all summits of original pel and the barycentric coodinates on this original pel and this subdivision that summit is located
The subdivision call number of the original pel that pel is located, described subdivision call number is the first geometric coloration according to each subdivision top
Barycentric coodinates on this original pel for the point are calculated;It is additionally operable to all subdivided vertices to this subdivision pel in corresponding subdivision
Barycentric coodinates assignment on pel simultaneously exports;
(1-4) respectively by each first subdivision tinter and first vertex shader, the first geometric coloration and original
Pixel coloring device combination obtains corresponding first tinter, renders model to be rendered using each first tinter, will render
The output of the first geometric coloration in each first tinter in journey is as corresponding Segmentation Model.
Described step (2) comprises the steps:
(2-1) several sample points are set on each the subdivision pel in current Segmentation Model;
(2-2) by before the corresponding program point of fit object current in original pixels tinter, and calculate current matching mesh
The related sentence of mark as corresponding target fragment, using the property value of each sample point as corresponding target fragment input,
For the corresponding output of sample points all on any one subdivision pel in current Segmentation Model, with the corresponding institute of this subdivision pel
The surface signal that some output generates on subdivision pel as this fit object, is believed to this surface with the matching basic function setting
Number function is fitted obtaining fitting function;
(2-3) generate matching device, described matching device is used for sitting according to the center of gravity of current pixel point corresponding subdivision pel
Mark, calculates value on corresponding subdivision pel for the current fit object, corresponding subdivision pel using described fitting function
The subdivision pel being located in Segmentation Model for current pixel point.
The corresponding program point of current variable refers to this variable in original pixels tinter location, and variable name identical becomes
Amount, should be processed as different variables when at different positions in original pixels tinter.Current picture in step (2-3)
Vegetarian refreshments refers to the currently processed pixel of pixel coloring device, is deposited obtaining the fitting function on each subdivision pel in this step
Storage, and go to index the fitting function on this subdivision pel using the pel call number of subdivision pel.
Obtain several sample point by shaking sampling method on each subdivision pel in step (2-1), sample point individual
Number can determine according to pel size, generally can be set to 15~32.The property value of each sample point is sat according to the center of gravity of sample point
The property value on the summit that mark treats this sample point place pel of rending model respectively carries out rasterisation interpolation and obtains.
By original pixels tinter is carried out with syntactic analysiss in step (2-2), obtain the program of original pixels tinter
Dependency graph, and this mesh is formed according to the program dependency graph extraction pixel coloring device the obtaining part related to calculating this fit object
Tap section (actually to the abstract syntax tree obtaining target fragment, is then then converted to target fragment).
The number of target variable or goal expression is too small effectively to simplify effect it is impossible to reach.Accordingly, as preferred,
The number of described fit object is the variable in original pixels coloring and the 20~100% of the number of expression formula.
Described step (2) is fitted using method of least square, and the matching basic function of employing is bezier surface function.
Using least square fitting, can effectively reduce calculated target variable or goal expression and reality
Difference between value, improves fitting precision.During using bezier surface function as matching basic function, the fitting function obtaining is actual
For comprising the bezier surface function of control vertex.When being calculated using this fitting function, by current pixel point in corresponding subdivision graph
Barycentric coodinates in unit substitute into and can get, and wherein the barycentric coodinates on current pixel point corresponding subdivision pel colour from geometry
Device obtains.
Vertex shader is generated as follows in described step (3):
(a1) respectively using the input variable of original vertices tinter and output variable as input variable and output variable, just
One empty vertex shader of beginningization;
(a2) add principal function to the vertex shader after step (a1) process, described principal function is used for input variable
Value be assigned to corresponding output variable.
It is used for receiving the property value on currently processed summit by the vertex shader that above step generates, and will receive
Data output, the genus on the summit that the number data type of the described property value on summit is received with original vertices tinter
The number data type of property value is identical.The input variable of vertex shader and output variable and original top that present invention order generates
The input variable of Point Coloring device is identical with output variable (including input variable identical with the number data type of output variable),
The input of vertex shader can be enable general with the input of original vertices tinter.
For directx, described subdivision tinter includes shell tinter and domain tinter, generates as follows
Subdivision tinter:
(b1) using the output variable of original vertices tinter as input variable and output variable, initialize one empty outer
Shell tinter;
(b2) arranging the subdivision parameter in this shell tinter is the corresponding one group of subdivision parameter of corresponding Segmentation Model;
(b3) insert principal function in empty shell tinter, described principal function is used for being assigned to accordingly input variable
Output variable;
(b4) using the output variable of shell tinter as input variable, with the input variable of original pixels tinter and
Barycentric coodinates on corresponding original pel for the subdivided vertices of subdivision pel are output variable, initialize a domain tinter;
(b5) insert principal function in the tinter of domain, described principal function is used for being assigned to export accordingly by input variable
Variable;
(b6) principal function of original vertices tinter is inserted in the principal function of domain tinter;
For opengl, described subdivision tinter includes subdivision assessment tinter and micro-stepping control tinter, by step
Suddenly (b1) and (b6) generates, except that generating is subdivision assessment tinter and micro-stepping control tinter.
Segment tinter and be equivalent to setting subdivision parameter, and rending model is treated according to the subdivision parameter setting and carry out carefully
Point, further the carrying out of the subdivided vertices obtaining after subdivision is processed (predominantly evolution).For the tinter of domain,
Barycentric coodinates on corresponding original pel for the subdivided vertices of subdivision pel are calculated by hardware, fixing in hardware pipeline
The subdivided vertices of the method elaborate division by calculation pel of elaborate division by calculation pel of subdivision function, and by the result calculating input by intrinsic
Input structure be input to domain tinter.Wherein, in the tinter of domain, the output of the input variable of corresponding original pixels tinter becomes
Amount, the property value of the actually subdivided vertices of output, by hardware input, (hardware can calculate while treating rending model subdivision
The property value of the subdivided vertices arriving).
Geometric coloration is generated as follows in described step (3):
(c1) with described subdivision tinter output variable as input variable, with the input variable of original pixels tinter with
And pel call number in Segmentation Model for this subdivision pel is as output variable, initialize an empty geometric coloration;
(c2) add principal function to the geometric coloration after step (c1) process, described principal function is used for input variable
Value be assigned to corresponding output variable, be additionally operable to calculate the barycentric coodinates on corresponding original pel according to each subdivided vertices
Value calculates subdivision position on original pel for this subdivision pel, and using described subdivision this subdivision pel of position calculation in subdivision
Pel call number in model, and result of calculation is assigned to corresponding output variable, be additionally operable to represent subdivision pel each
The output variable assignment again of barycentric coodinates on this subdivision pel for the summit.
The input variable of original pixels tinter includes each subdivision top of the currently processed subdivision pel of geometric coloration
The barycentric coodinates of the property value of point and each subdivided vertices (start to sit in the center of gravity of corresponding original pel for this subdivided vertices
Mark).For geometric coloration, the fixed function in hardware is calculated each of pel according to model to be rendered and subdivision mode
The barycentric coodinates on original pel of subdivided vertices simultaneously input to geometric coloration, and geometric coloration utilizes the thin of hardware input
Barycentric coodinates value on original pel for the subdivided vertices of component unit is calculated currently processed subdivision pel in original pel
On position, according to subdivision pel call number in Segmentation Model for the pel index this subdivision pel, matching device is with indexed mode
Obtain this subdivision pel, according to this pel call number, the fitting function using can be quickly found on this subdivision pel, and then
Calculate value on this subdivision pel for the corresponding fit object.After being calculated the pel call number of subdivision pel, geometry
Tinter also need to represent subdivision pel barycentric coodinates output variable again assignment as each subdivided vertices current
The barycentric coodinates on subdivision pel processing.It is basic coordinates to the barycentric coodinates assigned value of each subdivided vertices in the present invention
Value, if subdivision pel is triangle, then assignment is respectively (0,0,1), (0,1,0) and (1,0,0).
The geometric coloration being generated by above step in the present invention is used for receiving the output of subdivision tinter, and according to connecing
The currently processed property value of each subdivided vertices of subdivision pel of the data output that receives and this subdivision pel are in Segmentation Model
In pel call number, and to the barycentric coodinates of each subdivided vertices again assignment and export, described subdivision pel is thin
Pel call number in sub-model by geometric coloration according to each subdivided vertices the barycentric coodinates on corresponding original pel
It is calculated, be additionally operable to barycentric coodinates assignment on this subdivision pel for each summit to this pel and export.
In described step (3) as follows obtain revise pixel coloring device:
(d1) with the output variable of geometric coloration as input variable, the output variable of original pixels tinter is that output becomes
Amount one empty pixel coloring device of initialization;
(d2) several matching devices are selected from the corresponding all matching devices of current Segmentation Model as target matching device, profit
Replace the corresponding variable of fit object or the expression formula with each target matching device in original pixels tinter with target matching device.
Step (d2) is replaced with matching device to be interpreted as replacing in original pixels tinter and is only used for calculating corresponding matching
All variables of target and expression formula.Go back after replacement and in pixel coloring device, also should generate corresponding calculating function, and replacing
Pass through the subdivision pel call number in Segmentation Model for the pel of input in matching device afterwards, select subdivision pel belonging to this pixel
On fitting function, using input this pixel belonging to segment pel barycentric coodinates pass through fitting function calculate replacement after
Variable or the value of expression formula.
Obtain in described step (3) revising after tinter by vertex shader, geometric coloration subdivision tinter and repairing
It is not used in positive pixel tinter revising input variable and the output variable deletion that pixel coloring device output variable calculates.
, after the calculating of matching device, the input of original pixels tinter becomes for Partial Variable in pixel coloring device and expression formula
It is only used for calculating the input variable of each fit object in amount, output variable and function, output variable does not all need to use.This
Outward, in corresponding vertex tinter, subdivision tinter and geometric coloration, corresponding processing procedure, input variable and output become
Amount needs carry out adapting to adjustment, delete unnecessary calculating and process shift process such that it is able to improving simplification rate and and reducing
The memory cost of the tinter obtaining after simplification.
Also include after tinter after being simplified in described step (3) screening to being simplified tinter:
Treat rending model using original tinter with each simplification tinter to be rendered, screened according to rendering result
To several as final simplification tinter.
Described step (3) comprises the steps:
(3-1) each color value rendering all pixels point in image is arranged in vector by row or column;
(3-2) calculate each simplify tinter corresponding vector with by original tinter corresponding vector between Europe several in
Distance, render error between the rendering result of the rendering result as this correction tinter and original tinter;
(3-3) according to all simplify tinters rendering result corresponding render error, render time and render needed for
Video memory space, using Pareto front end method choice, several simplify tinter as simplification tinter.
Screen simplification tinter using Pareto front end method (Pareto optimality method) to select to meet Pareto front end bar
All correction tinters of part.Under different situations, the number meeting Pareto head end conditional is also different, therefore, finally gives and treats
Select the number of tinter and do not know.Finished pigmented device selects according to rendering task, if rendering task needs to render quality, can
To select to render error less correction tinter, if requiring rendering rate fast, the less correction of render time can be selected
Tinter.When selecting the less tinter of revising of render time as finished pigmented device, rendering efficiency can be greatly improved, reduce
Render time consumption and render required video memory space, be particularly suited for the high scene of frame rate renders application.
Present invention also offers a kind of method for rendering graph based on surface signal matching and surface subdivision, render employing
Original tinter includes original vertices tinter and original pixels tinter, comprises the steps:
(s1) set some groups of subdivision parameters, treat rending model according to each group of subdivision parameter and be finely divided, obtain phase
The Segmentation Model answered;
(s2) several variables or expression formula are selected from the function of original pixels tinter as fit object, for every
One fit object, generates matching device corresponding with each Segmentation Model respectively, and described matching device is used for this fit object
The surface signal generating on corresponding subdivision pel in current Segmentation Model is fitted, and calculates this plan according to fitting result
Close the value on target corresponding subdivision pel in current Segmentation Model;
(s3) vertex shader, geometric coloration are generated according to original vertices tinter, for any one Segmentation Model,
One subdivision tinter is generated according to the corresponding subdivision parameter of this Segmentation Model, and from the corresponding all matchings of current Segmentation Model
Select several to replace corresponding variable or expression formula in original pixels tinter in device to obtain revising pixel coloring device, and should
Revise pixel coloring device to obtain with vertex shader, geometric coloration and the corresponding subdivision tinter combination of current Segmentation Model
Corresponding correction tinter, and tinter is revised as simplification tinter using each;
(s4) select one to treat rending model the tinter after simplifying to be rendered.
This rendering intent is actually first simplified (concrete simplification process is as described above), Ran Houcong to original tinter
One is selected to carry out treating rending model and rendered in tinter after simplification.
Present invention also offers a kind of tinter based on surface signal matching and surface subdivision simplifies device, to be simplified
Original tinter includes original vertices tinter and original pixels tinter, comprising:
Subdivision module, for setting some groups of subdivision parameters, treats rending model according to each group of subdivision parameter and carries out carefully
Point, obtain corresponding Segmentation Model;
Signal fitting module, for selecting several variables or expression formula as plan from the function of original pixels tinter
Close target, for each fit object, generate matching device corresponding with each Segmentation Model respectively, described matching device is used for
The surface signal generating on this fit object corresponding subdivision pel in current Segmentation Model is fitted, and according to matching
Result calculates the value on this fit object corresponding subdivision pel in current Segmentation Model;
Tinter generation module, for according to original vertices tinter generate vertex shader, geometric coloration, for appoint
One Segmentation Model of meaning, generates a subdivision tinter according to the corresponding subdivision parameter of this Segmentation Model, and from current subdivision mould
Select several to replace corresponding variable or expression formula in original pixels tinter in the corresponding all matching devices of type to be revised
Pixel coloring device, and this correction pixel coloring device is corresponding with vertex shader, geometric coloration and current Segmentation Model
Subdivision tinter combination is revised tinter accordingly, and revises tinter as simplification tinter using each.
Described tinter simplifies device and also includes screening module, described screening module be used for using original tinter with
Each correction tinter is treated rending model and is rendered, and selects several to simplify tinters as optimum according to rendering result
Simplify tinter.
Present invention also offers a kind of tinter, comprising:
Vertex shader, for receiving the property value on currently processed summit, and by the data output receiving;
Subdivision tinter, for setting subdivision parameter, and according to according to the mould to be rendered after the subdivision parameter subdivision setting
Type, exports barycentric coodinates on corresponding original pel for the currently processed property value of subdivided vertices and this subdivided vertices;
Geometric coloration is for receiving the output of subdivision tinter and currently processed according to the data output receiving
The property value of all subdivided vertices of the subdivision pel and subdivided vertices barycentric coodinates on corresponding subdivision pel, are additionally operable to
Calculated according to barycentric coodinates on corresponding original pel for each subdivided vertices receiving and export this subdivision pel in subdivision
Pel call number in model, is additionally operable to the barycentric coodinates assignment on Segmentation Model for each summit of the pel to input defeated
Go out;
Pixel coloring device, for calculated according to the output of described geometric coloration the color value of currently processed pixel with
Render this pixel, segment accordingly in the model to be rendered after subdivision in several variables in calculating process or expression formula
Value on pel is calculated using matching device, described matching device using surface signal fitting process calculate this target variable or
Value on goal expression corresponding subdivision pel in Segmentation Model, described Segmentation Model by treat rending model by
Obtain according to the subdivision of geometric coloration identical subdivision parameter.
Present invention also offers a kind of computer-readable recording medium of the computer program that is stored with, wherein said computer
Program makes computer execute:
Step 1: set some groups of subdivision parameters, treat rending model according to each group of subdivision parameter and be finely divided, obtain
Corresponding Segmentation Model;
Step 2: select several variables or expression formula from the function of original pixels tinter as fit object, for
Each fit object, generates matching device corresponding with each Segmentation Model respectively, and described matching device is used for this matching mesh
The surface signal generate is marked on corresponding subdivision pel in current Segmentation Model be fitted, and should according to fitting result calculating
Value on fit object corresponding subdivision pel in current Segmentation Model;
Step 3: vertex shader, geometric coloration are generated according to original vertices tinter, segments mould for any one
Type, generates a subdivision tinter according to the corresponding subdivision parameter of this Segmentation Model, and corresponding all from current Segmentation Model
Select several to replace corresponding variable or expression formula in original pixels tinter in matching device to obtain revising pixel coloring device, and
By this correction pixel coloring device and vertex shader, geometric coloration and the corresponding subdivision tinter combination of current Segmentation Model
Revised tinter accordingly, and tinter is revised as simplification tinter using each.
Described computer program also make computer execution following steps:
Treat rending model using original tinter with each correction tinter to be rendered, if being selected according to rendering result
Dry correction tinter is as simplification tinter.
The computer-readable recording medium of computer program present invention also offers another kind is stored with, wherein said calculating
Machine program makes computer execute:
Step 1: set some groups of subdivision parameters, treat rending model according to each group of subdivision parameter and be finely divided, obtain
Corresponding Segmentation Model;
Step 2: select several variables or expression formula from the function of original pixels tinter as fit object, for
Each fit object, generates matching device corresponding with each Segmentation Model respectively, and described matching device is used for this matching mesh
The surface signal generate is marked on corresponding subdivision pel in current Segmentation Model be fitted, and should according to fitting result calculating
Value on fit object corresponding subdivision pel in current Segmentation Model;
Step 3: vertex shader, geometric coloration are generated according to original vertices tinter, segments mould for any one
Type, generates a subdivision tinter according to the corresponding subdivision parameter of this Segmentation Model, and corresponding all from current Segmentation Model
Select several to replace corresponding variable or expression formula in original pixels tinter in matching device to obtain revising pixel coloring device, and
By this correction pixel coloring device and vertex shader, geometric coloration and the corresponding subdivision tinter combination of current Segmentation Model
Revised tinter accordingly, and tinter is revised as simplification tinter using each.
Step 4: select one to treat rending model the tinter after simplifying and rendered.
Do not make specified otherwise, input variable and output variable all include the variable name data of corresponding variable in the present invention
Type.In the present invention original tinter and simplify after tinter (correction tinter), include vertex shader, subdivision colour
The source code that device, geometric coloration, pixel coloring device etc. are all write using Shader Language (including hlsl, glsl, cg etc.).For
It is operable to, vertex shader, subdivision tinter, geometric coloration and pixel coloring device Mr. Shi Junshi generating in the present invention
Become corresponding abstract syntax tree, be then converted to the code based on Shader Language.
Compared with prior art, it is an advantage of the current invention that:
A (), by carrying out simplifying the tinter after being simplified to original tinter, is compared with original tinter, after simplification
The pixel coloring device of tinter in part (or all) variable or expression formula adopt matching device to calculate, original code calculates
Variable or expression formula are it may be necessary to substantial amounts of calculating, or even hundreds of instruction, and it is limited to utilize matching device only need to use when calculating
Individual multiplication and addition can be calculated, and reduce the amount of calculation of pixel coloring device, substantially increase rendering efficiency, shorten wash with watercolours
The dye time;
B () inserts subdivision tinter and geometric coloration, treat rending model when rendering and be finely divided, improve wash with watercolours
Dye quality;
C () firstly generates several and revises tinter, select finished pigmented device further according to rendering task, can be according to reality
Situation flexibly selects different rendering scheme, improves the scope of application of finished pigmented device;
D () can be automatically performed simplification it is not necessary to manual intervention.
Brief description
Fig. 1 is the schematic diagram of the tinter method for simplifying of the present embodiment.
Specific embodiment
Below in conjunction with specific embodiments and the drawings, the present invention is described in detail.
In the present embodiment, original tinter to be simplified includes original vertices tinter and original pixels tinter.A kind of base
It is as shown in Figure 1 in the simplified pinciple of the tinter method for simplifying of surface signal matching and surface subdivision, comprising:
(1) set some groups of subdivision parameters, by the computational methods of subdivision function fixing in graphic hardware streamline according to
Each group of subdivision parameter is treated rending model and is finely divided, and obtains corresponding Segmentation Model.
The number of plies of subdivision, each pel subdivision number of each edge and subdivision step in every layer of subdivision inside each pel
Long.For triangle primitives, then it is respectively directed to every a line and 3 length of side subdivision parameters (subdivision number and subdivision step-length) is set,
I.e. to should have 3 subdivision numbers with subdivision step-length.The group number of the subdivision parameter setting can adjust according to practical application request, setting
The group number of subdivision parameter is usually 4~256 groups (being 256 groups in the present embodiment).It is directed to each group of subdivision parameter in the present embodiment
Form corresponding first tinter, then treat rending model using the first tinter being formed and be finely divided, wherein pass through such as
Lower step generation the first tinter:
(1-1) the first vertex coloring is generated as input variable and output variable using the property value on summit and vertex index number
Device, this first vertex shader is used for for the value of each input variable being assigned to corresponding output variable;
(1-2) it is directed to any one group of subdivision parameter, the first subdivision tinter, this subdivision are generated according to current group subdivision parameter
Tinter is used for property value and the vertex index number on the summit according to the first vertex shader output, by graphic hardware streamline
The computational methods of middle fixing subdivision function are treated rending model according to current group subdivision parameter and are finely divided, and according to subdivision result
The property value of output subdivided vertices, and the vertex index number on all summits of original pel that is located of each subdivided vertices and each
Barycentric coodinates on this original pel for the individual summit;
(1-3) generate the first geometric coloration, this first geometric coloration is used for receiving the output of the first subdivision tinter,
And the property value according to the currently processed all subdivided vertices segmenting pel of the data output receiving, all subdivided vertices institute
The vertex index number on all summits of original pel and the barycentric coodinates on this original pel and this subdivision pel institute
Original pel subdivision call number, subdivision call number be the first geometric coloration according to each subdivided vertices in this original graph
Barycentric coodinates in unit are calculated;It is additionally operable to center of gravity on corresponding subdivision pel for all subdivided vertices to this subdivision pel
Coordinate assignment simultaneously exports;
(1-4) respectively by each first subdivision tinter and first vertex shader, the first geometric coloration and original
Pixel coloring device combination obtains corresponding first tinter, renders model to be rendered using each first tinter, will render
The output of the first geometric coloration in each first tinter in journey is as corresponding Segmentation Model.
(2) several variables or expression formula are selected from the function of original pixels tinter as fit object, for every
One fit object, generates matching device corresponding with each Segmentation Model respectively, and described matching device is used for this fit object
The surface signal generating on corresponding subdivision pel in current Segmentation Model is fitted, and calculates this plan according to fitting result
Close the value on target corresponding subdivision pel in current Segmentation Model, comprise the steps:
(2-1) setting several sample points on each the subdivision pel in current Segmentation Model (is 16 in the present embodiment
Individual);
(2-2) by before the corresponding program point of fit object current in original pixels tinter, and calculate current matching mesh
The related sentence of mark as corresponding target fragment, using the property value of each sample point as corresponding target fragment input,
For the corresponding output of sample points all on any one subdivision pel in current Segmentation Model, with the corresponding institute of this subdivision pel
The surface signal that some output generates on subdivision pel as this fit object, is believed to this surface with the matching basic function setting
Number function is fitted obtaining fitting function;
(2-3) generate matching device, this matching device is used for the barycentric coodinates according to current pixel point on corresponding subdivision pel,
Using corresponding fitting function (corresponding fitting function on the subdivision pel that i.e. current pixel point is located in Segmentation Model) meter
Calculate value on corresponding subdivision pel for the current fit object, corresponding subdivision pel is current pixel point in Segmentation Model
The subdivision pel being located.
In the present embodiment, fit object is the number of all of variable in original pixels coloring and expression formula.With all movements
Target, as fit object set, corresponds respectively to variable 1~variable r, and expression formula 1~expression formula m.Each matching device is equal
The different fit object of correspondence or Segmentation Model, the matching obtaining device is designated as matching device 1~matching device p respectively, the value of p with
The number of fit object is related with Segmentation Model.
Method of least square is adopted during matching, matching basic function is matching Bezier triangular surface function, obtains in the present embodiment
To fitting function be the Bezier triangular surface function with control vertex.Now, matching device is according to below equation:
Calculate value val on corresponding subdivision pel for the current fit object, wherein, (s, t) is current pixel point institute
Subdivision pel barycentric coodinates,It is Bezier 2.3 yuan multinomial (the i.e. Bezier triangle with regard to (s, t)
Toroidal function), cpijlFor the control vertex control point value of fitting function, wherein n is the polynomial exponent number of Bezier 2.3 yuan
(the present embodiment n=2), adopts second order Bezier 2.3 yuan multinomial in the present invention, i, j, l are the subscript of summation, value model
Enclose and arrive n for 0.
In the present embodiment, the number of fit object is all variables of the function in original pixels coloring.
In the present embodiment, current pixel point refers to currently processed pixel in model to be rendered.
(3) vertex shader, geometric coloration are generated according to original vertices tinter, for any one Segmentation Model,
One subdivision tinter is generated according to the corresponding subdivision parameter of this Segmentation Model, and from the corresponding all matchings of current Segmentation Model
Select several to replace corresponding variable or expression formula in original pixels tinter in device to obtain revising pixel coloring device, and should
Revise pixel coloring device to obtain with vertex shader, geometric coloration and the corresponding subdivision tinter combination of current Segmentation Model
Corresponding correction tinter, and tinter is revised as simplification tinter using each.
Generation vertex shader as follows:
(a1) respectively using the input variable of original vertices tinter and output variable as input variable and output variable, just
One empty vertex shader of beginningization;
(a2) add principal function to the vertex shader after step (a1) process, described principal function is used for input variable
Value be assigned to corresponding output variable.
The tinter of the present embodiment is based on directx and realizes, and for directx, segments tinter and includes shell tinter
With domain tinter, generate as follows and segment tinter:
(b1) using the output variable of original vertices tinter as input variable and output variable, initialize one empty outer
Shell tinter;
(b2) arranging the subdivision parameter in this shell tinter is the corresponding one group of subdivision parameter of corresponding Segmentation Model;
(b3) insert principal function in empty shell tinter, described principal function is used for being assigned to accordingly input variable
Output variable;
(b4) using the output variable of shell tinter as input variable, with the input variable of original pixels tinter and
Barycentric coodinates on corresponding original pel for the subdivided vertices of subdivision pel are output variable, initialize a domain tinter;
(b5) insert principal function in the tinter of domain, described principal function is used for being assigned to export accordingly by input variable
Variable;
(b6) principal function of original vertices tinter is inserted in the principal function of domain tinter.
According to original vertices tinter, for each Segmentation Model, generate geometric coloration as follows:
(c1) with segment tinter output variable as input variable, with the input variable of original pixels tinter and should
Subdivision pel call number in Segmentation Model for the pel, as output variable, initializes an empty geometric coloration;
(c2) add principal function to the geometric coloration after step (c1) process, this principal function is used for the value of input variable
It is assigned to corresponding output variable, be additionally operable to calculate the barycentric coodinates value meter on corresponding original pel according to each subdivided vertices
Calculate subdivision position on original pel for this subdivision pel, and using subdivision this subdivision pel of position calculation in Segmentation Model
Pel call number, and result of calculation is assigned to corresponding output variable, it is additionally operable to the weight representing subdivision each summit of pel
The output variable of heart coordinate assignment again.
The principal function of geometric coloration is by pel call number in Segmentation Model for the following steps elaborate division by calculation pel:
Obtain barycentric coodinates p of the currently processed center of gravity of subdivision pel of geometric coloration, judge which it is subordinated to
Region edge_id.(each summit of the center of gravity of original pel and pel being connected, pel can be divided into several regions).
Obtain that layer that this barycentric coodinates belongs to subdivision of reservoir, if in the centre coordinate of center of gravity minimum for t.The then number of plies
Layer=floor (3*t*n/2);Calculate which pel is this barycentric coodinates belong in number of plies layer, calculating process is as follows:
Calculate the subdivision number segment_num=n 2*layer on the pel side of current subdivision of reservoir;
Calculate in current subdivision of reservoir.Current two end points barycentric coodinates x0 segmenting side, x2, the length on each subdivision side
Segment_length, and calculate length d that current barycentric coodinates project on subdivision side, and the subdivision side that subpoint is located
Sequence number, segment_id;
X0=(2*layer/ (3*n), 1- (4*layer/ (3*n)), 1-2*layer/ (3*n) (1- (4*layer/ (3*
n)));
Y2=(x0.x, x0.z, x0.y);
Segment_length=1.414/n;
D=abs (dot ((p x0) * (x2 x0))/(segment_length*segment_num));
Segment_id=floor (d/segment_length);
Calculate current center of gravity to be made a little to be belonging to triangular or lower triangle up_and_down
If (p.x-x0.x) > 1/ (3*n), up_and_down=2;Otherwise up_and_down=1.
Obtain index local_index=(segment_num-1) the * 2*edge_id+ in current subdivision of reservoir
(segment_num-1)*2+up_and_down;
Calculate triangle number outer_triangle than current layer layer outer ring.
For each subdivision of reservoir layer_id < layer.
The triangle number of this layer is outer_triangle+=(n 2*layer_id-1) * 2*3.
Final triangle call number is outer_triangle+local_index.
This principal function is additionally operable to the output variable assignment again to the barycentric coodinates representing subdivision each summit of pel, if carefully
Component unit is triangle, then assignment is respectively (0,0,1), (0,1,0) and (1,0,0).
As follows obtain revise pixel coloring device:
(d1) with the output variable of geometric coloration as input variable, the output variable of original pixels tinter is that output becomes
Amount one empty pixel coloring device of initialization;
(d2) several matching devices are selected from the corresponding all matching devices of current Segmentation Model as target matching device, profit
Replace the corresponding variable of fit object or the expression formula with each target matching device in original pixels tinter with target matching device.
In the present embodiment, the geometric coloration of generation is designated as geometric coloration 1~geometric coloration k, subdivision tinter note
For subdivision tinter 1~subdivision tinter k, revise pixel coloring device and be designated as revising pixel coloring device 1~correction pixel coloring device
The value of k, k is relevant with the group number of subdivision parameter and the number of fit object, corresponding by obtaining the combination of corresponding each several part
Correction tinter.
The tinter method for simplifying based on surface signal matching and surface subdivision of the present embodiment, step is repaiied in (3)
Also comprise the steps: after positive tinter
First, delete the summit in this correction pixel coloring device according to the correction pixel coloring device in this correction tinter
Color device, geometric coloration and subdivision tinter in be not corrected pixel coloring device use input variable, output variable and
Expression formula.
The tinter method for simplifying of the present embodiment also utilizes original tinter to simplify with each after being simplified tinter
Tinter is treated rending model and is rendered, and carries out screening according to rendering result to simplification tinter and obtains several as optimum
Simplify tinter.The rendering result of the present embodiment includes rendering image, render time and renders required video memory space.Revise
The corresponding rendering result of color device is rendering result 1~rendering result k.The rendering result of original tinter is designated as original render knot
Really.Render in the present embodiment and carried out using each tinter in rendering pipeline, first by model to be rendered and corresponding
Color device is input in rendering pipeline, and in render process, model to be rendered, as the input of corresponding tinter, is input to coloring
In device.
Screening is specific as follows:
(3-1) each color value rendering all pixels point in image is arranged in vector by row or column;
(3-2) calculate each and simplify tinter (referred to herein as revising tinter) corresponding vector and by original tinter pair
Euclidean distance between the vector answered, as this simplification tinter rendering result and original tinter rendering result it
Between render error;
(3-3) according to all revise tinters rendering result corresponding render error, render time and render needed for
Video memory space, using Pareto front end method choice, several simplify tinter as simplification tinter.
In the present embodiment, time when rending model is rendered is treated for 0.05 millisecond with original tinter, after simplification
In color device, render time the shortest is 0.005 millisecond, renders the required minimum 1mb in video memory space, renders error minimum 0.
The simplification tinter being obtained based on simplification above method, is selected one to treat rending model as needed and carries out wash with watercolours
Dye.
The tinter method for simplifying of the present embodiment, simplifies dress by the tinter based on surface signal matching and surface subdivision
Put realization, this tinter simplifies device and includes:
Subdivision module, for setting some groups of subdivision parameters, treats rending model according to each group of subdivision parameter and carries out carefully
Point, obtain corresponding Segmentation Model;
Signal fitting module, for selecting several variables or expression formula as plan from the function of original pixels tinter
Close target, for each fit object, generate matching device corresponding with each Segmentation Model respectively, described matching device is used for
The surface signal generating on this fit object corresponding subdivision pel in current Segmentation Model is fitted, and according to matching
Result calculates the value on this fit object corresponding subdivision pel in current Segmentation Model;
Tinter generation module, for according to original vertices tinter generate vertex shader, geometric coloration, for appoint
One Segmentation Model of meaning, generates a subdivision tinter according to the corresponding subdivision parameter of this Segmentation Model, and from current subdivision mould
Select several to replace corresponding variable or expression formula in original pixels tinter in the corresponding all matching devices of type to be revised
Pixel coloring device, and this correction pixel coloring device is corresponding with vertex shader, geometric coloration and current Segmentation Model
Subdivision tinter combination is revised pixel coloring device accordingly, and revises tinter as simplification tinter using each;
Screening module, is rendered for treating rending model using original tinter with each correction tinter, and root
Several are selected to revise tinter as simplification tinter according to rendering result.
In the present embodiment original tinter and finally give simplify tinter and intermediate formation pixel coloring device,
Subdivision coloring, geometric coloration etc. are all write using Shader Language, during simplification, based on Shader Language write
Color device can not directly operate, and needs to be converted into corresponding abstract syntax tree, by being operated (practical operation to abstract syntax tree
Correspond to each node of abstract syntax tree, the operation such as movement, duplication, deletion, interpolation can be executed), complete to pixel coloring device
After becoming all operations, it is then converted to Shader Language, and then completes the operation to tinter.To form vertex shader it is below
Example illustrates:
First original vertices tinter is converted into abstract syntax tree, and an initial empty vertex shader is corresponding abstract
Syntax tree, original vertices is coloured the input variable corresponding to original vertices tinter in corresponding abstract syntax tree and output becomes
The node of amount copies in the corresponding abstract syntax tree of vertex shader that initialization obtains, and continues in this abstract syntax tree
Add the corresponding node of principal function.Again the abstract syntax tree obtaining is converted into Shader Language after the completion of interpolation, that is, obtains phase
The vertex shader answered.
Each module of the embodiment of the present application or each step can be realized with general computing device, and alternatively, they can
To be realized with the executable program code of computing device, such that it is able to be stored in storage device being come by computing device
Execution, or they are fabricated to respectively each integrated circuit modules, or the multiple modules in them or step are fabricated to
Single integrated circuit module is realizing.Therefore, the embodiment of the present application is not restricted to any specific hardware and software combination.
The foregoing is only presently most preferred embodiment of the invention, be not limited to the present invention, all principles in the present invention
In the range of any modification, supplement and equivalent of being made etc., should be included within the scope of the present invention.
Claims (10)
1. a kind of tinter method for simplifying based on surface signal matching and surface subdivision, original tinter to be simplified includes former
Beginning vertex shader and original pixels tinter are it is characterised in that include:
(1) set some groups of subdivision parameters, treat rending model according to each group of subdivision parameter and be finely divided, obtain thin accordingly
Sub-model;
(2) several variables or expression formula are selected from the function of original pixels tinter as fit object, for each
Fit object, generates matching device corresponding with each Segmentation Model respectively, and described matching device is used for this fit object is being worked as
The surface signal generating on corresponding subdivision pel in front Segmentation Model is fitted, and calculates this matching mesh according to fitting result
It is marked on the value on corresponding subdivision pel in current Segmentation Model;
(3) vertex shader, geometric coloration are generated according to original vertices tinter, for any one Segmentation Model, according to
The corresponding subdivision parameter of this Segmentation Model generates a subdivision tinter, and from the corresponding all matching devices of current Segmentation Model
Select several to replace corresponding variable or expression formula in original pixels tinter to obtain revising pixel coloring device, and this is revised
Pixel coloring device and vertex shader, geometric coloration and the corresponding subdivision tinter combination of current Segmentation Model obtain corresponding
Correction tinter, and using each revise tinter as simplify tinter;
Every group of subdivision parameter includes: the number of plies of subdivision, the subdivision of each pel each edge in every layer of subdivision inside each pel
Number and subdivision step-length;
Treated according to each group of subdivision parameter by the computational methods of subdivision function fixing in graphic hardware streamline in step (1)
Rending model is finely divided;
Step (1) is directed to each group of subdivision parameter and forms corresponding first tinter and treat rending model and is finely divided, described
First tinter generates as follows:
(1-1) the first vertex shader is generated as input variable and output variable using the property value on summit and vertex index number,
The first described vertex shader is used for for the value of each input variable being assigned to corresponding output variable;
(1-2) it is directed to any one group of subdivision parameter, the first subdivision tinter is generated according to current group subdivision parameter, described subdivision
Tinter is used for property value and the vertex index number on the summit according to the first vertex shader output, by graphic hardware streamline
The computational methods of middle fixing subdivision function are treated rending model according to current group subdivision parameter and are finely divided, and according to subdivision result
The property value of output subdivided vertices, and the vertex index number on all summits of original pel that is located of each subdivided vertices and each
Barycentric coodinates on this original pel for the individual summit;
(1-3) generate the first geometric coloration, the first described geometric coloration is used for receiving the output of the first subdivision tinter,
And the property value according to the currently processed all subdivided vertices segmenting pel of the data output receiving, all subdivided vertices institute
The vertex index number on all summits of original pel and the barycentric coodinates on this original pel and this subdivision pel institute
Original pel subdivision call number, described subdivision call number be the first geometric coloration according to each subdivided vertices at this
Barycentric coodinates on original pel are calculated;It is additionally operable to all subdivided vertices to this subdivision pel on corresponding subdivision pel
Barycentric coodinates assignment and export;
(1-4) respectively by each first subdivision tinter and the first vertex shader, the first geometric coloration and original pixels
Tinter combination obtains corresponding first tinter, renders model to be rendered using each first tinter, by render process
The output of the first geometric coloration in each first tinter is as corresponding Segmentation Model;
Step (2) comprises the steps:
(2-1) several sample points are set on each the subdivision pel in current Segmentation Model;
(2-2) by the corresponding program point of fit object current in original pixels tinter to calculate the related language of current fit object
Sentence as corresponding target fragment, using the property value of each sample point as corresponding target fragment input, for currently thin
The corresponding output of all sample points on any one subdivision pel in sub-model, is made with the corresponding all of output of this subdivision pel
The surface signal generating on subdivision pel for this fit object, is carried out to this surface signal function with the matching basic function setting
Matching obtains fitting function;
(2-3) generate matching device, described matching device is used for the barycentric coodinates according to current pixel point corresponding subdivision pel, profit
Calculate value on corresponding subdivision pel for the current fit object with described fitting function, corresponding subdivision pel is current
The subdivision pel that pixel is located in Segmentation Model.
2. the method for simplifying based on surface signal matching and the tinter of surface subdivision as claimed in claim 1, its feature exists
In the number of described fit object is the variable in original pixels coloring and the 20~100% of the number of expression formula.
3. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 1 it is characterised in that
Described step (2) is fitted using method of least square, and the matching basic function of employing is bezier surface function.
4. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 1 it is characterised in that
Vertex shader is generated as follows in described step (3):
(a1) respectively using the input variable of original vertices tinter and output variable as input variable and output variable, initialize
One empty vertex shader;
(a2) add principal function to the vertex shader after step (a1) process, described principal function is used for the value of input variable
It is assigned to corresponding output variable.
5. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 1 it is characterised in that
For directx, described subdivision tinter includes shell tinter and domain tinter, generates subdivision coloring as follows
Device:
(b1) using the output variable of original vertices tinter as input variable and output variable, initialize an empty shell and
Color device;
(b2) arranging the subdivision parameter in this shell tinter is the corresponding one group of subdivision parameter of corresponding Segmentation Model;
(b3) insert principal function in empty shell tinter, described principal function is defeated accordingly for being assigned to input variable
Go out variable;
(b4) using the output variable of shell tinter as input variable, with the input variable of original pixels tinter and subdivision
Barycentric coodinates on corresponding original pel for the subdivided vertices of pel are output variable, initialize a domain tinter;
(b5) insert principal function in the tinter of domain, described principal function is used for being assigned to export accordingly change by input variable
Amount;
(b6) principal function of original vertices tinter is inserted in the principal function of domain tinter;
For opengl, described subdivision tinter includes subdivision assessment tinter and micro-stepping control tinter, by step
(b1) generate with (b6), except that generating is subdivision assessment tinter and micro-stepping control tinter.
6. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 1 it is characterised in that
Geometric coloration is generated as follows in described step (3):
(c1) with described subdivision tinter output variable as input variable, with the input variable of original pixels tinter and should
Subdivision pel call number in Segmentation Model for the pel, as output variable, initializes an empty geometric coloration;
(c2) add principal function to the geometric coloration after step (c1) process, described principal function is used for the value of input variable
It is assigned to corresponding output variable, be additionally operable to calculate the barycentric coodinates value meter on corresponding original pel according to each subdivided vertices
Calculate subdivision position on original pel for this subdivision pel, and using described subdivision this subdivision pel of position calculation in Segmentation Model
In pel call number, and result of calculation is assigned to corresponding output variable, is additionally operable to representing subdivision each summit of pel
Barycentric coodinates output variable assignment again.
7. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 1 it is characterised in that
In described step (3) as follows obtain revise pixel coloring device:
(d1) with the output variable of geometric coloration as input variable, the output variable of original pixels tinter is at the beginning of output variable
One empty pixel coloring device of beginningization;
(d2) several matching devices are selected as target matching device from the corresponding all matching devices of current Segmentation Model, using mesh
The corresponding variable of fit object or the expression formula in original pixels tinter with each target matching device replaced by mark matching device.
8. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 1 it is characterised in that
After obtaining in described step (3) revising tinter, vertex shader, geometric coloration subdivision tinter and correction pixel
It is not used in color device revising input variable and the output variable deletion that pixel coloring device output variable calculates.
9. the coloring based on surface signal matching and surface subdivision as described in any one claim in claim 1~8
Device method for simplifying is it is characterised in that also include to being simplified tinter after tinter after being simplified in described step (3)
Screened:
Treat rending model using original tinter with each simplification tinter to be rendered, if being obtained according to rendering result screening
Dry as final simplification tinter.
10. the tinter method for simplifying based on surface signal matching and surface subdivision as claimed in claim 9, its feature exists
Include rendering image, render time in, described rendering result and render required video memory space, described step (3) include as
Lower step:
(3-1) each color value rendering all pixels point in image is arranged in vector by row or column;
(3-2) calculate each simplify tinter corresponding vector with by original tinter corresponding vector between Euclid away from
From rendering error between the rendering result of the rendering result as this correction tinter and original tinter;
(3-3) according to all simplify tinters rendering result corresponding render error, render time and render needed for video memory
Space, using Pareto front end method choice, several simplify tinter as simplification tinter.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410373494.8A CN104183008B (en) | 2014-07-31 | 2014-07-31 | Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410373494.8A CN104183008B (en) | 2014-07-31 | 2014-07-31 | Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104183008A CN104183008A (en) | 2014-12-03 |
CN104183008B true CN104183008B (en) | 2017-01-18 |
Family
ID=51964022
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410373494.8A Active CN104183008B (en) | 2014-07-31 | 2014-07-31 | Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104183008B (en) |
Families Citing this family (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2016090535A1 (en) * | 2014-12-08 | 2016-06-16 | Intel Corporation | Graphic rendering quality improvements through automated data type precision control |
CN105427366B (en) * | 2015-11-11 | 2018-07-27 | 广州华多网络科技有限公司 | A kind of image rendering method and image rendering system |
CN106056661B (en) * | 2016-05-31 | 2018-08-28 | 钱进 | Three-dimensional graphics renderer engine based on Direct3D 11 |
CN106228594B (en) * | 2016-07-18 | 2018-11-09 | 中国人民解放军理工大学 | Typhoon model cloud cartoon display method based on tessellation |
CN106709863B (en) * | 2016-12-28 | 2020-04-28 | 杭州趣维科技有限公司 | GPU-based efficient 2D vector graphics rendering method |
US10706612B2 (en) * | 2017-04-01 | 2020-07-07 | Intel Corporation | Tile-based immediate mode rendering with early hierarchical-z |
US11244502B2 (en) | 2017-11-29 | 2022-02-08 | Adobe Inc. | Generating 3D structures using genetic programming to satisfy functional and geometric constraints |
CN114187421B (en) * | 2021-09-30 | 2022-09-02 | 北京博能科技股份有限公司 | Method and system for simplifying finite element mesh model |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101479701A (en) * | 2006-06-28 | 2009-07-08 | 微软公司 | Fast reconfiguration of graphics pipeline state |
CN102272798A (en) * | 2008-12-31 | 2011-12-07 | 英特尔公司 | A tessellator whose tessellation time grows linearly with the amount of tessellation |
CN103810756A (en) * | 2014-01-17 | 2014-05-21 | 浙江大学 | Adaptive Loop subdivision surface drawing method based on irregular region |
-
2014
- 2014-07-31 CN CN201410373494.8A patent/CN104183008B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101479701A (en) * | 2006-06-28 | 2009-07-08 | 微软公司 | Fast reconfiguration of graphics pipeline state |
CN102272798A (en) * | 2008-12-31 | 2011-12-07 | 英特尔公司 | A tessellator whose tessellation time grows linearly with the amount of tessellation |
CN103810756A (en) * | 2014-01-17 | 2014-05-21 | 浙江大学 | Adaptive Loop subdivision surface drawing method based on irregular region |
Non-Patent Citations (3)
Title |
---|
User-Configurable Automatic Shader Simplification;Fabio Pellacini;《ACM Transactions Graphics》;20050630;第24卷(第3期);第445-452页 * |
着色器简化和优化的研究与实现;宋西军;《中国优秀硕士学位论文全文数据库》;20130115(第1期);第3.3-3.4节 * |
细分曲面拟合的局部渐进插值方法;赵宇 等;《计算机研究与发展》;20121231;第49卷(第8期);第1699-1707页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104183008A (en) | 2014-12-03 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104183008B (en) | Shader classification method and device based on surface signal fitting and tessellation and graphics rendering method | |
CN104167015B (en) | Shader simplifying method and device and image rendering method based on surface signal fitting | |
Pirk et al. | Plastic trees: interactive self-adapting botanical tree models | |
CN113096234B (en) | Method and device for generating three-dimensional grid model by using multiple color pictures | |
JP7343963B2 (en) | Dataset for learning functions that take images as input | |
CN110288695A (en) | Single-frame images threedimensional model method of surface reconstruction based on deep learning | |
Siddiqui et al. | Texturify: Generating textures on 3d shape surfaces | |
CN110097609A (en) | A kind of fining embroidery texture moving method based on sample territory | |
CN105787865A (en) | Fractal image generation and rendering method based on game engine and CPU parallel processing | |
WO2018113502A1 (en) | Method for automatically generating grid and multi-level of detail of shader | |
CN104616327B (en) | A kind of tinter method for simplifying, device and method for rendering graph based on surface subdivision | |
US10762669B2 (en) | Colorization of vector images | |
CN107481313A (en) | A kind of dense three-dimensional object reconstruction method based on study available point cloud generation | |
CN109215123A (en) | Unlimited landform generation method, system, storage medium and terminal based on cGAN | |
KR20140142470A (en) | Method for generating a tree model and a forest model and apparatus for the same | |
CN102339479A (en) | Stretch-driven mesh parameterization method using spectral analysis | |
CN112132970B (en) | Natural texture synthesis system and method for 3D printing | |
CN109118593A (en) | A kind of system and method creating threedimensional model editable configuration | |
CN117280387A (en) | Displacement micro-grid for ray and path tracing | |
CN104537706B (en) | Shader simplifying method, shader simplifying device and graphic rendering method based on code motion | |
CN101984465A (en) | Image seamless copying method | |
Eyiyurekli et al. | Interactive free-form level-set surface-editing operators | |
Tian et al. | A survey of smooth vector graphics: Recent advances in representation, creation, rasterization and image vectorization | |
Schollmeyer et al. | Direct trimming of NURBS surfaces on the GPU | |
CN106484511A (en) | A kind of spectrum attitude moving method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
TR01 | Transfer of patent right |
Effective date of registration: 20210713 Address after: Room 288-8, 857 Shixin North Road, ningwei street, Xiaoshan District, Hangzhou City, Zhejiang Province Patentee after: ZHEJIANG SHANGTANG TECHNOLOGY DEVELOPMENT Co.,Ltd. Address before: 310027 No. 38, Zhejiang Road, Hangzhou, Zhejiang, Xihu District Patentee before: ZHEJIANG University |
|
TR01 | Transfer of patent right |