CN100555334C - Shade drafting method and device - Google Patents

Shade drafting method and device Download PDF

Info

Publication number
CN100555334C
CN100555334C CNB2007101124533A CN200710112453A CN100555334C CN 100555334 C CN100555334 C CN 100555334C CN B2007101124533 A CNB2007101124533 A CN B2007101124533A CN 200710112453 A CN200710112453 A CN 200710112453A CN 100555334 C CN100555334 C CN 100555334C
Authority
CN
China
Prior art keywords
graphical pointv
offset point
shade
distance
color
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
Application number
CNB2007101124533A
Other languages
Chinese (zh)
Other versions
CN101071511A (en
Inventor
刘皓
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CNB2007101124533A priority Critical patent/CN100555334C/en
Publication of CN101071511A publication Critical patent/CN101071511A/en
Application granted granted Critical
Publication of CN100555334C publication Critical patent/CN100555334C/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Image Generation (AREA)

Abstract

The invention discloses a kind of shade drafting method, comprising: light source is offset, obtains first offset point and second offset point of light source; With first offset point and second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene; Calculate the distance value of first graphical pointv to first offset point; From the first shade depth pinup picture, obtain the depth value of the first graphical pointv correspondence; If judge to obtain depth value, then calculate the distance value of first graphical pointv to second offset point more than or equal to the distance value of graphical pointv to first offset point; Otherwise draw described graphical pointv is first color value; From the second shade depth pinup picture, obtain the depth value of graphical pointv correspondence; If judge to obtain depth value less than the distance value of first graphical pointv to second offset point, then drawing described graphical pointv is second color value.The invention also discloses a kind of shade drafting device, realize reality scene illumination, rendering shadow zone.

Description

Shade drafting method and device
Technical field
The present invention relates to image processing field, relate in particular to a kind of shade drafting method and device.
Background technology
In real illumination scene, if light runs into opaque object in communication process, just can't move on, and form shade, and the shape of shade is the same with the profile of object in the behind of this object.
When using a computer drafting 2 dimensions or 3 dimension scenes, for stereoscopic sensation and the stereovision that increases scene, enrich the expression effect of scene, need lighting effect that is virtually reality like reality, draw out 2 dimensions or 3 shades of tieing up in the scenes.
Existing shade drafting method comprises: echo method (Shadow Maps) method etc.
Adopt the process of Shadow Maps method drafting shade as follows:
The first step: with the light source position is viewpoint, obtain the shade depth pinup picture of scene, and the shade depth pinup picture also can be called shadow outline figure;
As everyone knows, the scene of computer drawing is made of various picture elements, therefore, want to draw the shade of scene, just need know which picture element that constitutes this scene can stop light, so, need with the light source position viewpoint, remove to see the picture element that constitutes scene, because the picture element that can see from light source position is certain to stop light, calculate these and stop the distance value of the picture element of light to light source, and be kept in Z impact damper corresponding with its distance value to light source of coordinate of picture element, this distance value can be called as the depth value of picture element, and the depth value of preserving in the whole Z impact damper is called as the shade depth pinup picture.
Second step: calculate the distance value of graphical pointv to light source;
Wherein, graphical pointv is for constituting any one picture element of this scene, and graphical pointv may be also may be not in shade in shade.
The 3rd step: graphical pointv is projected to light source space, obtain a coordinate, according to this coordinate, from the shade depth pinup picture, obtain the depth value of above-mentioned coordinate correspondence, and this depth value and the graphical pointv distance value to light source is compared, if the former is less than the latter, illustrate that then this graphical pointv in shade, is plotted as black with this graphical pointv, if the former is greater than or equal to the latter, illustrate that then this graphical pointv not in shade, is plotted as white with this graphical pointv.
Below illustrate the implementation procedure of Shadow Maps.
Figure 1 shows that a simple scene, comprise, light source, object A, object B; Wherein, Shadow
Light source is desirable pointolite in the Maps method;
Can see the picture element C of object A from light source position, and the picture element D of object B, calculate the distance value of picture element C, i.e. the depth value of picture element C to light source; Calculating pixel point D is to the distance value of light source, i.e. the depth value of picture element D; Be kept in Z impact damper corresponding of coordinate of picture element C, be kept in Z impact damper corresponding of coordinate of picture element D with its depth value with its depth value; If graphical pointv is picture element E, calculate the distance value of graphical pointv E to light source; E projects to light source space with graphical pointv, obtain a coordinate, the depth value of supposing this coordinate correspondence is the depth value of picture element C, from Fig. 1, can intuitively find out, graphical pointv E is to the distance of the light source depth value greater than picture element C, graphical pointv E is described in shade, the color of graphical pointv E is plotted as black; If graphical pointv is picture element D, calculate the distance value of graphical pointv D to light source, D projects to light source space with graphical pointv, the depth value of the coordinate figure correspondence that obtains is the distance value that himself arrives light source, both equate, can find out intuitively also that from Fig. 1 graphical pointv D is not in shade, D is plotted as white with graphical pointv.
But real light source is the object that size dimension is arranged, and therefore, light source irradiation is behind object, and the shadow region of generation comprises this shadow zone and penumbra region, and so-called this shadow zone is exactly the zone that light is blocked fully, and the penumbra region is that light only has been blocked a part of zone.
Shadow Maps method is modeled to a desirable pointolite with light source when drawing shade, the shade of a desirable pointolite generation does not have the difference of this shadow zone and penumbra region.Therefore, employing ShadowMaps method generation shade can not effectively be drawn out the echo in the true illumination scene.
In addition, the echo that adopts Shadow Maps method to obtain is a pixel pattern, because resolution is limited, makes the shade edge can produce square and sawtooth sense.
Summary of the invention
The technical problem to be solved in the present invention provides a kind of shade drafting method and device, to realize the true lighting effect of simulation, draws the scene shade.
For solving the problems of the technologies described above, the objective of the invention is to be achieved through the following technical solutions:
A kind of shade drafting method comprises:
Light source is offset, obtains first offset point and second offset point of described light source; Described second offset point is positioned at described first offset point to the zone that the marginal ray that produces the shade object forms, and described first offset point arrives the distance of described generation shade object greater than described second offset point to the distance of described generation shade object;
With described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
Calculate the distance value of first graphical pointv to described first offset point;
From the first shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence;
If judge to obtain described depth value, then calculate the distance value of described first graphical pointv to described second offset point more than or equal to the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
From the second shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color.
Preferably, the method for described acquisition second color specifically comprises:
Obtain first color that presets;
Obtain second graphical pointv, described second graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object;
Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object;
Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
Multiply by described first distance and the ratio of described second distance as described second color with described first color.
Preferably, from the first shade depth pinup picture, the depth value that obtains the described first graphical pointv correspondence comprises:
Obtain the coordinate of described first graphical pointv in light source space, from the first shade depth pinup picture, obtain the depth value of described coordinate correspondence.
A kind of shade drafting method comprises:
Light source is offset, obtains first offset point and second offset point of described light source; Described first offset point is positioned at described second offset point to the zone that the marginal ray that produces the shade object forms, and described second offset point arrives the distance of described object greater than first offset point of described light source to the distance of object;
With described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
Calculate the distance value of first graphical pointv to described first offset point;
From the first shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence;
If judge to obtain described depth value, then calculate the distance value of described first graphical pointv to described second offset point less than the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
From the second shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence;
If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color value.
Preferably, the method for described acquisition the 3rd color specifically comprises:
Obtain second color that presets;
Obtain second graphical pointv, described second graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object;
Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object;
Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
Multiply by described first distance and the ratio of described second distance as described the 3rd color with described second color.
A kind of shade drafting device comprises: offset point acquiring unit, shade depth pinup picture acquiring unit, the first distance value computing unit, the first shade drafting unit, second distance value computing unit, the second shade drafting unit;
Described offset point acquiring unit is used for light source is offset, and obtains first offset point and second offset point of described light source; Described second offset point is positioned at described first offset point to the zone that the marginal ray that produces the shade object forms, and described first offset point arrives the distance of described generation shade object greater than described second offset point to the distance of described generation shade object;
Described shade depth pinup picture acquiring unit, being used for described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
The described first distance value computing unit is used to calculate the distance value of first graphical pointv to described first offset point;
The described first shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the first shade depth pinup picture; If judge to obtain described depth value, then trigger described second distance value computing unit more than or equal to the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
Described second distance value computing unit is used to calculate the distance value of described first graphical pointv to described second offset point;
The described second shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the second shade depth pinup picture; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color.
Preferably, said apparatus further comprises: the second color acquiring unit;
The described second color acquiring unit comprises:
The first color acquiring unit is used to obtain first color that presets;
The graphical pointv acquiring unit is used to obtain second graphical pointv, and described second graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object; Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object; Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Distance acquiring unit is used to obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
The color acquiring unit obtains described first color and multiply by described first distance and the ratio of described second distance as described second color.
A kind of shade drafting device comprises:
The offset point acquiring unit, shade depth pinup picture acquiring unit, the first distance value computing unit, the first shade drafting unit, second distance value computing unit, the second shade drafting unit;
Described offset point acquiring unit is used for light source is offset, and obtains first offset point and second offset point of described light source; Described first offset point is positioned at described second offset point to the zone that the marginal ray that produces the shade object forms, and described second offset point arrives the distance of described object greater than first offset point of described light source to the distance of object;
Described shade depth pinup picture acquiring unit, being used for described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
The described first distance value computing unit is used to calculate the distance value of first graphical pointv to described first offset point;
The described first shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the first shade depth pinup picture; If judge to obtain described depth value, then trigger described second distance value computing unit less than the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
Described second distance value computing unit is used to calculate the distance value of described first graphical pointv to described second offset point;
The described second shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the second shade depth pinup picture; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color.
Preferably, said apparatus further comprises: the 3rd color acquiring unit;
Described the 3rd color acquiring unit comprises:
The second color acquiring unit is used to obtain second color that presets;
The graphical pointv acquiring unit is used to obtain second graphical pointv, and described second graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object; Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object; Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Distance acquiring unit is used to obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
The color acquiring unit is used to obtain described second color and multiply by the ratio of described first distance and described second distance as described the 3rd color.
Above technical scheme as can be seen, in the embodiment of the invention, light source is offset, obtain two offset points of light source, and be the light source loca with two offset points respectively, obtain two shade depth pinup pictures, with the benchmark of these two figure as the drafting shade, draw different shadow colors to graphical pointv, realized illumination scene that is virtually reality like reality, draw this shadow zone and penumbra region.
Description of drawings
The scene synoptic diagram of Fig. 1 Shadow Maps method;
The scene synoptic diagram that Fig. 2 embodiment of the invention is used;
The shade drafting method process flow diagram that Fig. 3 first embodiment of the invention provides;
The method flow diagram of the dynamic calculation penumbra region color that Fig. 4 embodiment of the invention provides;
The synoptic diagram that obtains offset point that Fig. 5 embodiment of the invention provides;
The shade drafting device that Fig. 6 second embodiment of the invention provides is formed synoptic diagram;
The shade drafting device that Fig. 7 third embodiment of the invention provides is formed synoptic diagram.
Embodiment
The embodiment of the invention provides a kind of shade drafting method and device, to realize lighting effect that is virtually reality like reality, draws the echo of scene.
Below in conjunction with accompanying drawing, the specific embodiment that develops simultaneously is described in detail the embodiment of the invention.
Real light source is the object that size dimension is arranged, and Figure 2 shows that the scene that the embodiment of the invention is used, and comprising: light source offset point I, light source offset point J, object CD (producing the object of shade), object XY.
Wherein, light source AB does not comprise light source AB for needing the true light source with a certain size of simulation in the illumination scene of the embodiment of the invention.
Under the situation of not considering optical diffraction, when the light that the left side point A of light source AB irradiates arrived object CD, the subpoint of some C in a left side on object XY of object CD was F, and the subpoint of some D in the right side on object XY of object CD is H; When the light that the right side point B of light source AB irradiates arrived object CD, the subpoint of some C in a left side on object XY of object CD was E, and the subpoint of some D in the right side on object XY of object CD is G.Wherein, area E F and regional GH are the penumbra zones of object CD, and regional FG is the umbra zone of object CD.
In the existing shadow maps shade drafting method, with an ideal point light source analog light source AB, from the background technology analysis as can be known, only can not be enough to light source that is virtually reality like reality with an ideal point light source, as shown in Figure 2, adopt at least two pointolites to be used for analog light source AB in embodiments of the present invention, these two pointolites are positioned at I point and J point place as shown in the figure.
The following specifically describes, the method that the embodiment of the invention provides is drawn the process of scene shade shown in Figure 2, Figure 3 shows that the method flow diagram that the embodiment of the invention provides, and comprising:
Step 301: by light source is offset, obtain the offset point I and the J of light source, wherein, offset point I and offset point J cannot overlap;
Because, during computer graphics, only acquiescence has a light source to exist, and this light source is the pointolite of a location aware, so, light source in the step 301 is the pointolite of computing machine acquiescence, for light source AB that is virtually reality like reality, the embodiment of the invention, light source to the computing machine acquiescence is offset, and just the coordinate to light source is offset, and obtains the offset point of two these light sources, and think at light source offset point I and two pointolites of J place existence, with light source AB of this two pointolites simulations with a certain size.
As can be seen from Figure 2, if offset point I and J are in position shown in Figure 2, so, suppose that there are two pointolites at offset point I and J place, the hatching effect that can real simulated light source AB be produced of these two pointolites then, at this moment, offset point I and J can calculate to the distance of object CD:
Be the parallel lines BO of straight line AD, the extended line of BO and CD meets at the O point, according to the leg-of-mutton principle of similitude, triangle ICD is similar to triangle BCO as can be known, then can calculate offset point I and equal (AK*CD)/(CD+AB) apart from IM to object CD, wherein, AK is the distance of the light source of computing machine acquiescence to object CD; Be the parallel lines CM of straight line JD, the extended line of CM and AB meets at the M point, and triangle MCA is similar to triangle JCD as can be known, then can calculate offset point J and equal AK*CD/ (CD-AB) to object CD apart from JL.
During specific implementation, the light source in the step 301 is as the pointolite of computing machine acquiescence, and its coordinate is known, light source is to the distance A K of object AB, the length of the length of object AB and object CD is known quantity, so the position of offset point I and J can be obtained by counter the pushing away of above-mentioned formula.
Step 302: with offset point J is the light source loca, and is viewpoint with this point, obtains the shade depth pinup picture DMAP_J of scene with Shadow Maps method;
In the Shadow Maps method, with the light source is viewpoint, obtain shade depth pinup picture process, actual is to calculate when light source is seen this scene, the picture element that can see is to the distance of light source, in embodiments of the present invention, think that there are two pointolites at light source offset point I and J place, real light source AB of this two pointolite simulations, therefore, be viewpoint with offset point J in the above-mentioned steps, what calculate is when offset point J sees this scene, and the picture element that can see is to the distance value of offset point J, and this distance value can be called as the depth value of picture element, with be kept in Z impact damper corresponding with its depth value of coordinate of picture element, the data of preserving in the whole Z impact damper are called as the shade depth pinup picture.
Can find out intuitively from Fig. 2, if pointolite when J point place, the shadow region of object CD is this shadow zone;
Step 303: with offset point I is the light source loca, and is viewpoint with this point, obtains the shade depth pinup picture DMAP_I of scene with Shadow Maps method;
Can find out intuitively from Fig. 2, if pointolite when I point place, the shadow region of object CD promptly comprises this shadow zone and penumbra region;
Step 304: P projects to light source space with graphical pointv, obtains a coordinate;
Step 305: calculate the distance of graphical pointv P to offset point J;
Step 306: according to this coordinate, from DMAP_J, obtain the depth value of this coordinate correspondence, if this value is less than the distance of graphical pointv P to offset point J, illustrate that then graphical pointv P is arranged in the shadow region that light source produces when offset point J, as shown in Figure 2, what light source produced when offset point J is this shadow zone, enters step 307, if this value enters step 308 more than or equal to the distance of graphical pointv P to offset point J;
Step 307: the color that graphical pointv P is plotted as the shade depth pinup picture DMAP_J correspondence that sets in advance;
Wherein, the color of shade depth pinup picture DMAP_J correspondence is the color in this shadow zone.
Step 308: calculate the distance value of graphical pointv P to offset point I;
Step 309: project to the coordinate that obtains in the light source space according to the graphical pointv P that obtains in the step 304, from DMAP_I, obtain the depth value of this coordinate correspondence, if this value is less than the distance of graphical pointv P to offset point I, illustrate that then graphical pointv P is arranged in the shadow region that light source produces when offset point I, as shown in Figure 2, the shadow region that light source produces when offset point I comprises umbra and penumbra region, enter step 310, if this value is more than or equal to the distance of graphical pointv P to offset point I, illustrate that then graphical pointv P not in shade, enters step 311;
Though, the shadow region that light source produces when offset point I comprises umbra and penumbra region, but whether be arranged in the shadow region that light source produces when offset point J because prejudged graphical pointv P, if not, illustrate that then graphical pointv P is not in this shadow zone, so, if judge that obtaining graphical pointv is positioned at the shadow region that light source produces when offset point I, then this shadow region is the penumbra region in the step 309.
Step 310: the color that graphical pointv P place is plotted as the shade depth pinup picture DMAP_I correspondence that sets in advance;
As the above analysis, the color of shade depth pinup picture DMAP_I correspondence should be the color of penumbra region in the step 310.
Step 311: graphical pointv P place is plotted as the nonshaded area color.
In the above-described embodiments, the color of shade depth pinup picture DMAP_I correspondence can set in advance, but, according in the scene, the color of penumbra region is dynamic change in actual light, so, illumination scene for better simulation reality, in other embodiments of the invention, the color of penumbra region can dynamically obtain by the color in this shadow zone, and realizes the effect of penumbra region color gradient.
Suppose that graphical pointv P is among the penumbra region GH, dynamically obtain graphical pointv P color value method as shown in Figure 4, comprising:
Step 401: obtain the color of shade depth pinup picture DMAP_J correspondence, i.e. the color in this shadow zone;
Step 402: the edge projection point G that calculates object CD to the edge projection point H of object CD apart from GH, and the zone between edge projection point H and the edge projection point G is the penumbra region of object CD;
Step 403: calculate the distance P H of graphical pointv P to edge projection point H;
As can be seen from Figure 2, triangle JFG is similar to triangle JCD, so JG: (JL+CN)=JD: JL=(JG-JD): (JL+CD-JL)=DG: CN, obtain DG: DJ=CN: JL, so the length of DG is DJ*CN/JL, the length of DH equals DA*CD/AK, the position that G is ordered equals D point position and is offset DJ*CN/JL to the right, the position that H is ordered equals the position that D orders and is offset DA*CD/AK to the right, determined the position that G point and H are ordered, the graphical pointv P distance of ordering to G point and H also just can calculate accordingly so, and wherein, the N point is an optional point in this shadow zone.
Step 404: the color that calculates graphical pointv P by this shadow zone color * PH/GH;
In the shade drafting method that second embodiment of the invention provides, can judge earlier also whether graphical pointv is arranged in the shadow region that light source produces when offset point I, if not, this graphical pointv then is described not in the shadow region, if judge again then whether graphical pointv is arranged in the shadow region of light source point in offset point J generation, if, illustrate that then this graphical pointv is positioned at this shadow zone, if not, illustrate that then this graphical pointv is positioned at the penumbra region.Above-mentioned detailed process is identical with the method that first embodiment of the invention provides, and does not repeat them here.
Offset point I shown in Figure 2 and the residing position of offset point J are the embodiment of optimum of the present invention, in other embodiments of the invention, offset point I and J need be in positions shown in Figure 2, the position of offset point I and J can obtain arbitrarily by the skew to light source, but, suppose that the shade that pointolite produced that is positioned at these two offset points must meet situation shown in Figure 5, be that the shade that light source produces at some offset points must comprise the shade that light source produces at the another one offset point, in this case, need to obtain a light source offset point by skew earlier to light source, then, again from this offset point produce in two formed zones of marginal ray that produce the shade object, obtain another light source offset point.As shown in Figure 5, obtain offset point I earlier, produce in IA and two formed zones of marginal ray of IB from offset point I again, obtain a J point arbitrarily.
Among the said method embodiment, all graphical pointvs in the scene are all adopted method as step 301 graphical pointv P shade of drafting as described in the step 311, and in a scene, the drafting of all graphical pointvs is parallel to be handled.
More than be the shade drafting method that the embodiment of the invention provides, from the foregoing description process as can be known, this method has realized reality scene illumination, draws penumbra region and this shadow zone of object.
Second embodiment of the invention also provides a kind of shade drafting device, as shown in Figure 6, comprising:
Offset point acquiring unit 601 is used for light source is offset, and obtains first offset point and second offset point of described light source;
Shade depth pinup picture acquiring unit 602, being used for described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
The first distance value computing unit 603 is used to calculate the distance value of first graphical pointv to described first offset point;
The first shade drafting unit 604 is used for obtaining the depth value of the described first graphical pointv correspondence from the first shade depth pinup picture; If judge to obtain described depth value, then trigger described second distance value computing unit more than or equal to the distance value of described graphical pointv to described first offset point; Otherwise draw described graphical pointv is first color;
Second distance value computing unit 605 is used to calculate the distance value of described first graphical pointv to described second offset point;
The second shade drafting unit 606 is used for obtaining the depth value of described graphical pointv correspondence from the second shade depth pinup picture; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described graphical pointv is second color; Otherwise draw described graphical pointv is the 3rd color.
According in the scene, the color of penumbra region is dynamic change in actual light, so for better simulation actual illumination scene, in the embodiment of the invention, described device further comprises: the second color acquiring unit 607;
The described second color acquiring unit 607 comprises:
The first color acquiring unit is used to obtain first color that presets;
The graphical pointv acquiring unit is used to obtain second graphical pointv, and described second graphical pointv is for being light source position with described second offset point, the subpoint that described object produces; Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described first offset point, the subpoint that described object produces; Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Distance acquiring unit is used to obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
The color acquiring unit obtains described first color and multiply by described first distance and the ratio of described second distance as described second color.
Also a kind of shade drafting device of third embodiment of the invention as shown in Figure 7, comprising:
Offset point acquiring unit 701 is used for light source is offset, and obtains first offset point and second offset point of described light source;
Shade depth pinup picture acquiring unit 702, being used for described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
The first distance value computing unit 703 is used to calculate the distance value of first graphical pointv to described first offset point;
The first shade drafting unit 704 is used for obtaining the depth value of the described first graphical pointv correspondence from the first shade depth pinup picture; If judge to obtain described depth value, then trigger described second distance value computing unit less than the distance value of described graphical pointv to described first offset point; Otherwise draw described graphical pointv is first color;
Second distance value computing unit 705 is used to calculate the distance value of described first graphical pointv to described second offset point;
The second shade drafting unit 706 is used for obtaining the depth value of described graphical pointv correspondence from the second shade depth pinup picture; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described graphical pointv is second color; Otherwise draw described graphical pointv is the 3rd color.
According in the scene, the color of penumbra region is dynamic change in actual light, so for better simulation actual illumination scene, in the embodiment of the invention, described device further comprises: the 3rd color acquiring unit 707;
Described the 3rd color acquiring unit 707 comprises:
The second color acquiring unit is used to obtain second color that presets;
The graphical pointv acquiring unit is used to obtain second graphical pointv, and described second graphical pointv is for being light source position with described first offset point, the subpoint that described object produces; Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described second offset point, the subpoint that described object produces; Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Distance acquiring unit is used to obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
The color acquiring unit is used to obtain described second color and multiply by the ratio of described first distance and described second distance as described the 3rd color.
More than a kind of shade drafting method provided by the present invention and device are described in detail, used specific case herein principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that all can change in specific embodiments and applications, in sum, this description should not be construed as limitation of the present invention.

Claims (9)

1, a kind of shade drafting method is characterized in that, comprising:
Light source is offset, obtains first offset point and second offset point of described light source; Described second offset point is positioned at described first offset point to the zone that the marginal ray that produces the shade object forms, and described first offset point arrives the distance of described generation shade object greater than described second offset point to the distance of described generation shade object;
With described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
Calculate the distance value of first graphical pointv to described first offset point;
From the first shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence;
If judge to obtain described depth value, then calculate the distance value of described first graphical pointv to described second offset point more than or equal to the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
From the second shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color.
2, the method for claim 1 is characterized in that, the method for described acquisition second color specifically comprises:
Obtain first color that presets;
Obtain second graphical pointv, described second graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object;
Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object;
Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
Multiply by described first distance and the ratio of described second distance as described second color with described first color.
3, method as claimed in claim 1 or 2 is characterized in that, from the first shade depth pinup picture, the depth value that obtains the described first graphical pointv correspondence comprises:
Obtain the coordinate of described first graphical pointv in light source space, from the first shade depth pinup picture, obtain the depth value of described coordinate correspondence.
4, a kind of shade drafting method is characterized in that, comprising:
Light source is offset, obtains first offset point and second offset point of described light source; Described first offset point is positioned at described second offset point to the zone that the marginal ray that produces the shade object forms, and described second offset point arrives the distance of described object greater than first offset point of described light source to the distance of object;
With described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
Calculate the distance value of first graphical pointv to described first offset point;
From the first shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence;
If judge to obtain described depth value, then calculate the distance value of described first graphical pointv to described second offset point less than the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
From the second shade depth pinup picture, obtain the depth value of the described first graphical pointv correspondence;
If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color value.
5, method as claimed in claim 4 is characterized in that, the method for described acquisition the 3rd color specifically comprises:
Obtain second color that presets;
Obtain second graphical pointv, described second graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object;
Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object;
Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
Multiply by described first distance and the ratio of described second distance as described the 3rd color with described second color.
6, a kind of shade drafting device is characterized in that, comprising: offset point acquiring unit, shade depth pinup picture acquiring unit, the first distance value computing unit, the first shade drafting unit, second distance value computing unit, the second shade drafting unit;
Described offset point acquiring unit is used for light source is offset, and obtains first offset point and second offset point of described light source; Described second offset point is positioned at described first offset point to the zone that the marginal ray that produces the shade object forms, and described first offset point arrives the distance of described generation shade object greater than described second offset point to the distance of described generation shade object;
Described shade depth pinup picture acquiring unit, being used for described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
The described first distance value computing unit is used to calculate the distance value of first graphical pointv to described first offset point;
The described first shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the first shade depth pinup picture; If judge to obtain described depth value, then trigger described second distance value computing unit more than or equal to the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
Described second distance value computing unit is used to calculate the distance value of described first graphical pointv to described second offset point;
The described second shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the second shade depth pinup picture; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color.
7, device as claimed in claim 6 is characterized in that, described device further comprises: the second color acquiring unit;
The described second color acquiring unit comprises:
The first color acquiring unit is used to obtain first color that presets;
The graphical pointv acquiring unit is used to obtain second graphical pointv, and described second graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object; Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object; Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Distance acquiring unit is used to obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
The color acquiring unit obtains described first color and multiply by described first distance and the ratio of described second distance as described second color.
8, a kind of shade drafting device is characterized in that, comprising:
The offset point acquiring unit, shade depth pinup picture acquiring unit, the first distance value computing unit, the first shade drafting unit, second distance value computing unit, the second shade drafting unit;
Described offset point acquiring unit is used for light source is offset, and obtains first offset point and second offset point of described light source; Described first offset point is positioned at described second offset point to the zone that the marginal ray that produces the shade object forms, and described second offset point arrives the distance of described object greater than first offset point of described light source to the distance of object;
Described shade depth pinup picture acquiring unit, being used for described first offset point and described second offset point is light source position, obtains the first shade depth pinup picture and the second shade depth pinup picture of scene;
The described first distance value computing unit is used to calculate the distance value of first graphical pointv to described first offset point;
The described first shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the first shade depth pinup picture; If judge to obtain described depth value, then trigger described second distance value computing unit less than the distance value of described first graphical pointv to described first offset point; Otherwise drawing described first graphical pointv is first color;
Described second distance value computing unit is used to calculate the distance value of described first graphical pointv to described second offset point;
The described second shade drafting unit is used for obtaining the depth value of the described first graphical pointv correspondence from the second shade depth pinup picture; If judge to obtain described depth value less than the distance value of described first graphical pointv to described second offset point, then drawing described first graphical pointv is second color; Otherwise drawing described first graphical pointv is the 3rd color.
9, device as claimed in claim 8 is characterized in that, described device further comprises: the 3rd color acquiring unit;
Described the 3rd color acquiring unit comprises:
The second color acquiring unit is used to obtain second color that presets;
The graphical pointv acquiring unit is used to obtain second graphical pointv, and described second graphical pointv is for being light source position with described first offset point, the subpoint of described generation shade object; Obtain the 3rd graphical pointv, described the 3rd graphical pointv is for being light source position with described second offset point, the subpoint of described generation shade object; Wherein, described second graphical pointv is positioned at the right side of described first graphical pointv;
Distance acquiring unit is used to obtain first distance of first graphical pointv to second graphical pointv, and second graphical pointv and the 3rd graphical pointv second distance;
The color acquiring unit is used to obtain described second color and multiply by the ratio of described first distance and described second distance as described the 3rd color.
CNB2007101124533A 2007-06-26 2007-06-26 Shade drafting method and device Active CN100555334C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2007101124533A CN100555334C (en) 2007-06-26 2007-06-26 Shade drafting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2007101124533A CN100555334C (en) 2007-06-26 2007-06-26 Shade drafting method and device

Publications (2)

Publication Number Publication Date
CN101071511A CN101071511A (en) 2007-11-14
CN100555334C true CN100555334C (en) 2009-10-28

Family

ID=38898716

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2007101124533A Active CN100555334C (en) 2007-06-26 2007-06-26 Shade drafting method and device

Country Status (1)

Country Link
CN (1) CN100555334C (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882323B (en) * 2010-05-19 2012-06-13 北京航空航天大学 Microstructure surface global illumination real-time rendering method based on height map
JP6944134B2 (en) * 2016-07-29 2021-10-06 ソニーグループ株式会社 Image processing device and image processing method
CN107808410B (en) * 2017-10-27 2021-04-27 网易(杭州)网络有限公司 Shadow depth migration processing method and device
CN114283267A (en) * 2018-02-11 2022-04-05 鲸彩在线科技(大连)有限公司 Shadow map determination method and device
CN109447925B (en) * 2018-09-28 2021-07-09 Oppo广东移动通信有限公司 Image processing method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN101071511A (en) 2007-11-14

Similar Documents

Publication Publication Date Title
Raskar et al. Table-top spatially-augmented realty: bringing physical models to life with projected imagery
CN102243768B (en) Method for drawing stereo picture of three-dimensional virtual scene
CN100555334C (en) Shade drafting method and device
CN105005970A (en) Augmented reality implementation method and apparatus
CN107194978A (en) A kind of three-dimensional Home Fashion & Design Shanghai and display systems based on WebGL
CN104680532A (en) Object labeling method and device
CN104103092A (en) Real-time dynamic shadowing realization method based on projector lamp
CN105282536A (en) Naked-eye 3D picture-text interaction method based on Unity3D engine
CN102760308A (en) Method and device for node selection of object in three-dimensional virtual reality scene
CN104238730A (en) Smart grid visualization platform and demonstration control method
CN104732592A (en) Real-time three-dimensional data generation method based on two-dimensional LED rotating screen
CN103337093A (en) Method for realizing three-dimensional machine room real-time temperature field effect based on Unity3D shader
CN107978019A (en) Augmented reality system and method
CN105389846A (en) Demonstration method of three-dimensional model
CN103745448A (en) Rapid generating method for ultrahigh-resolution composite image in raster 3D displaying
CN103745687A (en) Image display method and image display device
CN110930492B (en) Model rendering method, device, computer readable medium and electronic equipment
CN106780704B (en) The direct lighting effect proximity rendering method of three-dimensional scenic reused based on visibility
Sandnes Sketching 3D immersed experiences rapidly by hand through 2D cross sections
CN208506731U (en) Image display systems
CN102316354A (en) Parallelly processable multi-view image synthesis method in imaging technology
CN204559792U (en) Device and the display device of stereo-picture or video is shown for display screen
CN101771891A (en) 3D (three-dimensional) display equipment and display method
CN104318509A (en) Large-scale target high-speed plotting method based on GPU
CN101511034A (en) Truly three-dimensional stereo display method facing Skyline

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