CN102768765B - Real-time soft shadow rendering method for point light sources - Google Patents

Real-time soft shadow rendering method for point light sources Download PDF

Info

Publication number
CN102768765B
CN102768765B CN201210210097.XA CN201210210097A CN102768765B CN 102768765 B CN102768765 B CN 102768765B CN 201210210097 A CN201210210097 A CN 201210210097A CN 102768765 B CN102768765 B CN 102768765B
Authority
CN
China
Prior art keywords
point light
light source
illumination
pointolite
shadow
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.)
Expired - Fee Related
Application number
CN201210210097.XA
Other languages
Chinese (zh)
Other versions
CN102768765A (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.)
NANJING ANXUN NETWORK SERVICE CO Ltd
Original Assignee
NANJING ANXUN NETWORK SERVICE 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 NANJING ANXUN NETWORK SERVICE CO Ltd filed Critical NANJING ANXUN NETWORK SERVICE CO Ltd
Priority to CN201210210097.XA priority Critical patent/CN102768765B/en
Publication of CN102768765A publication Critical patent/CN102768765A/en
Application granted granted Critical
Publication of CN102768765B publication Critical patent/CN102768765B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Image Generation (AREA)

Abstract

The invention discloses a method based on cubic texture shadow mapping in order to overcome the shortcomings that shadow edges are ubiquitously too hard in shadow mapping at present, and real soft shadows cannot be achieved. The shadow edges are softened in a special optimization mode, jags are eliminated, and satisfactory soft shadow effects of point light sources are achieved. The method includes the steps: judging whether the point light sources in a scene are visual point light sources or not by calculating whether a visual angle cone and a point light source illumination sphere are intersected or not to obtain a visual point light source list; judging whether each visual point light source is a potential projector or not by calculating whether the point light source illumination sphere and a spherical bounding box in the scene are intersected or not to obtain a potential projector list; rendering the potential projector into a cubic texture for each visual point light source; and performing scene illumination rendering for each visual point light source and optimizing shadow edge quality by a percentage approach filtering algorithm during shadow processing.

Description

Real-time pointolite soft shadows rendering intent
Technical field
The present invention relates to graphics field, particularly relate to a kind of method of carrying out real-time rendering for pointolite model.
Background technology
Shade observes the mankind and cognitive three-dimensional world has very important meaning, and shade can help people to judge the position of shelter, size and geological information, and people also can be helped to understand the geometric configuration of the thing that is blocked.Shade gives the information of whether light source position in scene, highlight the spatial relationship between object, so shade can the sense of reality of greatly enhanced scene, be an indispensable ingredient in Rendering, Shading Rendering is with a wide range of applications in the field such as computer graphic image, digital multimedia.
As the pointolite model that indoor scene uses in a large number, because its projection is isotropic directivity, numerous technology employs umbra volume (Shadow Volume) and realizes Shading Rendering.They have the intrinsic shortcoming of umbra volume: Shadow edge is excessively stiff, can not reach the effect of true soft shadows; Triangle filling rate is too high, and performance is played up in impact.Also some technology employs the projection that common Shadow Mapping (Shadow Maps) plays up certain direction, but cannot accomplish the omnirange projection property of pointolite model.
Summary of the invention
For solving the problem, the invention discloses a kind of method based on cube texture Shadow Mapping (Cubemap Shadow Maps), use special optimal way to carry out softening to Shadow edge, eliminate crenellated phenomena, realize comparatively ideal pointolite soft shadows effect.
In order to achieve the above object, the invention provides following technical scheme:
A kind of pointolite soft shadows rendering intent in real time, comprises the following steps:
(1) whether intersect judge whether the pointolite in scene is visualization point light source, acquisition visualization point list of light sources by calculating visual angle cone and pointolite illumination spheroid;
(2) for each visualization point light source, whether intersected according to the sphere bounding boxes of object in spheroid and scene by calculation level light source light, determine whether potential Projection Body, thus obtain potential Projection Body list;
(3) for each visualization point light source, potential Projection Body is rendered in cube texture;
(4) carry out scene illumination for each visualization point light source to play up, in Shadows Processing process, carry out number percent optimize Shadow edge quality near filter algorithm.
As a kind of preferred version, the concrete methods of realizing of described step (3) is: the decomposition projection of the omnirange of pointolite being carried out 6 directions according to cubical 6 faces, obtain 6 projection view frustums, carry out world space depth value by 6 projection view frustums to potential Projection Body successively to play up, and be recorded in the 2D texture of cube texture correspondence direction.
As a kind of preferred version, the concrete methods of realizing of described step (4) is:
A cube texture is regarded as to be piled up according to constant spacing rule by virtual pixel point one by one and is formed by (), each summit represents a virtual representation vegetarian refreshments;
B () calculates the position coordinates in the painted pixel place world space of current light, this coordinate is deducted pointolite position and obtains illumination vector, illumination vector is carried out length scale according to cube texel size, be be (x with the vector of texel unit count by illumination vector transformation, y, z), this pixel has 8 neighbor pixels, calculates adjacent virtual pixel illumination vector to be: (x 0, y 0, z 0), (x 0, y 0+ 1, z 0), (x 0+ 1, y 0, z 0), (x 0+ 1, y 0+ 1, z 0), (x 0, y 0, z 0+ 1), (x 0, y 0+ 1, z 0+ 1), (x 0+ 1, y 0, z 0+ 1), (x 0+ 1, y 0+ 1, z 0+ 1), wherein x 0=x rounds value, y 0=y rounds value, z 0=z rounds value;
C () carries out to 8 adjacent virtual pixels the depth value that corresponding cube texture sampling obtains 8 neighbor records, then by object pixel to the depth value of depth value successively with 8 virtual pixel corresponding record of light source center carry out size contrast thus obtain each virtual representation vegetarian refreshments block value;
D (), according to the distance weighting of object pixel on X, Y, Z tri-directions, is blocked value to 8 groups that calculate and is carried out Tri linear interpolation calculating, finally obtain illumination intensity value.
Compared with prior art, soft shadows rendering intent provided by the invention has the following advantages:
1. algorithm is simple, save calculation resources, and effective softening edge details of pointolite shade, eliminates crenellated phenomena.
2. can on the computing machine only supporting Direct3D 9, high-quality be high performance plays up pointolite soft shadows effect, can be widely used in 3D game and virtual reality applications program.
Accompanying drawing explanation
Fig. 1 is visual angle cone and pointolite illumination spheres intersect schematic diagram;
Fig. 2 is two-dimensional projection's schematic diagram of the sphere bounding boxes of object in pointolite illumination spheroid and scene;
Fig. 3 is that cube texture plays up schematic diagram;
Fig. 4 is Shadow Mapping ultimate principle figure;
Fig. 5 is that soft shadows provided by the invention plays up schematic diagram;
Wherein Fig. 5-a is the cube texture maps that virtual representation vegetarian refreshments is piled up, and Fig. 5-b is the lattice schematic diagram that target pixel points falls into.
Embodiment
Below with reference to specific embodiment, technical scheme provided by the invention is described in detail, following embodiment should be understood and be only not used in for illustration of the present invention and limit the scope of the invention.
Real-time pointolite soft shadows rendering intent provided by the invention, comprises the following steps:
(1) first visualization point list of light sources (Visible point lights) is obtained.
Whether intersected by calculating visual angle cone and pointolite illumination spheroid and judge whether the pointolite in scene is visualization point light source, obtains all visualization point light sources.Fig. 1 is two-dimensional projection's schematic diagram of visual angle cone and pointolite illumination spheroid.Wherein, some V is viewpoint, and figure intermediate cam shape region is visual angle cone, the several spheroids disperseed in figure are pointolite, some spheroid is crossing with visual angle cone, and namely the oblique line portion of these spheroids falls within the scope of the cone of visual angle, and the spheroid having oblique line portion is visual light source.
(2) for each visualization point light source, potential Projection Body list (Potential projection objects) is obtained.
Whether intersected by the sphere bounding boxes of object in calculation level light source light photograph spheroid and scene and determine whether potential Projection Body.Fig. 2 is two-dimensional projection's schematic diagram of the sphere bounding boxes of object in pointolite illumination spheroid and scene.Wherein, middle large ball is pointolite illumination spheroid, other spheroids are object scene sphere bounding boxes, several object scene sphere bounding boxes and pointolite illumination spheres intersect in Fig. 2, namely the oblique line portion of object scene sphere bounding boxes falls in pointolite illumination sphere, and the spheroid having oblique line portion represents that corresponding object is potential Projection Body.
(3) for each visualization point light source, potential Projection Body is rendered in cube texture.
As shown in Figure 3, cube center is pointolite, the projection of the omnirange of pointolite is carried out the decomposition in 6 directions according to cubical 6 faces, be respectively just before, just, a positive left side, the positive right side, just go up, just, the spotlight illumination model in 6 directions as shown in Figure 3 and 6 projection view frustums of correspondence can be obtained like this, and the length and width in the view frustums that projects cutting face are equal, cone subtended angle is 90 degree, the region that its bend marks, represent the spotlight of illumination to the right, so just, obtain 6 spotlight projections, each spotlight projects certain direction 2D texture of corresponding cube pinup picture.Carry out world space depth value by 6 projection view frustums to potential Projection Body successively to play up, and be recorded in the 2D texture of cube texture correspondence direction.
(4) carry out scene illumination for each visualization point light source to play up.
The common practices playing up shade is: when drawing object scene illumination all over (Lighting Pass); common Phong illumination model is used to carry out illumination calculation pixel coloring device (Pixel Shader) is inner; calculate the position coordinates in the world space of the painted pixel of current light (i.e. object pixel) place simultaneously; this coordinate is deducted pointolite position and obtains direction vector; this direction vector can carry out the Projection Body depth value of record before sampling obtains to cube consideration figure, ask mould to obtain the depth value of current pixel to light source center more in addition to this direction vector.Two depth values are carried out size and relatively can determine whether current pixel is the need of illumination or not illumination, namely have shade.The comparison procedure of depth value as in Fig. 4 based on as shown in the Shadow Mapping principle schematic of Cubemap, illumination object pixel is Depth1 to the distance of light source, again corresponding cube texture sampling is carried out to this object pixel, obtain a depth value Depth2, this numerical value represents the distance of Projection Body to light source.When Depth1 is greater than Depth2, object pixel does not need to carry out illumination calculation, namely creates shade, then carry out Shadows Processing.But the render scenes obtained by said method " non-bright namely dark ", therefore in the process of Shadow edge, effect is stiff lofty, can not reach the natural soft shadows effect of shadow edge transition in real world.
The present invention is the natural transition effect reaching Shadow edge, carries out number percent near filtering (PCF) algorithm optimization Shadow edge quality in Shadows Processing process.This algorithm is different from the number percent of traditional 2D texture near filtering (PCF) algorithm, has innovated the PCF algorithm for cube texture (Cubemap).
The concrete principle of optimality is as follows: the coordinate due to cube texture sampling is actually a three-dimensional vector, this vector with cube center for starting point, and terminal is arbitrary, therefore cube texture can be imagined as to be piled up according to constant spacing rule by virtual pixel point one by one as shown in Fig. 5-a to form, each summit represents a virtual representation vegetarian refreshments, and the lattice indicating oblique line represents certain area of space be made up of 8 adjacent virtual pixels.Calculate the position coordinates in the world space of the painted pixel of current light (i.e. object pixel) place, this coordinate is deducted pointolite position and obtains illumination vector, illumination vector is carried out length scale according to cube texel size, be with the vector of texel unit count by illumination vector transformation, the terminal of this illumination vector and object pixel T must drop in the lattice as shown in Fig. 5-b, and the unit length of lattice is 1 texel.The process of asking for of the illumination vector of 8 adjacent virtual pixels of T is: the integral part first obtaining each component in terminal vector, then plus/minus 1 texel unit draws respectively, if the illumination vector of object pixel T is (x, y, z), if x 0=x rounds value, y 0=y rounds value, z 0=z rounds value, calculates adjacent virtual pixel illumination vector to be:
(x 0, y 0, z 0),(x 0, y 0, z 0+1),(x 0, y 0+1, z 0),(x 0, y 0+1, z 0+1),(x 0+1, y 0, z 0),(x 0+1, y 0, z 0+1),(x 0+1, y 0+1, z 0),(x 0+1, y 0+1, z 0+1)。
Below with one group of data instance, object pixel T illumination vector is (3.6,2.7,5.2), then the illumination vector of 8 adjacent virtual pixels is respectively:
(3,2,5),(3,2,6),(3,3,5),(3,3,6),(4,2,5),(4,2,6),(4,3,5),(4,3,6)。
The depth value that corresponding cube texture sampling obtains 8 neighbor records is carried out to 8 adjacent virtual pixels, then the depth value of object pixel to depth value Depth1 successively with 8 virtual pixel corresponding record of light source center is carried out size contrast thus obtain the hiding relation of each virtual representation vegetarian refreshments, can represent with 0 as shown in Fig. 5-b and not be blocked, 1 represent be blocked, obtain 8 groups or 0 or 1 block value.Last is reference system with lattice, according to object pixel at X, Y, (namely object pixel is to the distance on each face of lattice for distance on Z tri-directions, can be drawn by the fraction part of the illumination vector obtaining object pixel T) weight, block value to 8 groups that calculate above and carry out Tri linear interpolation calculating, floating type numerical value between final acquisition one 0 to 1, if 0 is the brightest, 1 is the darkest, therefore this floating type numeric representation illumination intensity value, carries out playing up of shade according to this illumination intensity value, reaches soft shadows effect.By above-mentioned computing, at Shadow edge place, because the virtual pixel near object pixel is blocked a bit, some is not blocked, by Tri linear interpolation computing, obtain one between the brightest and the darkest between gray-scale value, make shade transition naturally soft.
Technological means disclosed in the present invention program is not limited only to the technological means disclosed in above-mentioned technological means, also comprises the technical scheme be made up of above technical characteristic combination in any.

Claims (2)

1. a real-time pointolite soft shadows rendering intent, is characterized in that, comprise the following steps:
(1) whether intersect judge whether the pointolite in scene is visualization point light source, acquisition visualization point list of light sources by calculating visual angle cone and pointolite illumination spheroid;
(2) for each visualization point light source, whether intersected according to the sphere bounding boxes of object in spheroid and scene by calculation level light source light, determine whether potential Projection Body, thus obtain potential Projection Body list;
(3) for each visualization point light source, potential Projection Body is rendered in cube texture;
(4) carry out scene illumination for each visualization point light source to play up, in Shadows Processing process, carry out number percent optimize Shadow edge quality near filter algorithm;
The concrete methods of realizing of described step (4) is:
A cube texture is regarded as to be piled up according to constant spacing rule by virtual pixel point one by one and is formed by (), each summit represents a virtual representation vegetarian refreshments;
B () calculates the position coordinates in the painted pixel place world space of current light, this coordinate is deducted pointolite position and obtains illumination vector, illumination vector is carried out length scale according to cube texel size, be be (x with the vector of texel unit count by illumination vector transformation, y, z), this pixel has 8 neighbor pixels, calculates adjacent virtual pixel illumination vector to be: (x 0, y 0, z 0), (x 0, y 0+ 1, z 0), (x 0+ 1, y 0, z 0), (x 0+ 1, y 0+ 1, z 0), (x 0, y 0, z 0+ 1), (x 0, y 0+ 1, z 0+ 1), (x 0+ 1, y 0, z 0+ 1), (x 0+ 1, y 0+ 1, z 0+ 1), wherein x 0=x rounds value, y 0=y rounds value, z 0=z rounds value;
C () carries out to 8 adjacent virtual pixels the depth value that corresponding cube texture sampling obtains 8 neighbor records, then by object pixel to the depth value of depth value successively with 8 virtual pixel corresponding record of light source center carry out size contrast thus obtain each virtual representation vegetarian refreshments block value;
D (), according to the distance weighting of object pixel on X, Y, Z tri-directions, is blocked value to 8 groups that calculate and is carried out Tri linear interpolation calculating, finally obtain illumination intensity value.
2. real-time pointolite soft shadows rendering intent according to claim 1, it is characterized in that, the concrete methods of realizing of described step (3) is: the decomposition projection of the omnirange of pointolite being carried out 6 directions according to cubical 6 faces, obtain 6 projection view frustums, carry out world space depth value by 6 projection view frustums to potential Projection Body successively to play up, and be recorded in the 2D texture of cube texture correspondence direction.
CN201210210097.XA 2012-06-25 2012-06-25 Real-time soft shadow rendering method for point light sources Expired - Fee Related CN102768765B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210210097.XA CN102768765B (en) 2012-06-25 2012-06-25 Real-time soft shadow rendering method for point light sources

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210210097.XA CN102768765B (en) 2012-06-25 2012-06-25 Real-time soft shadow rendering method for point light sources

Publications (2)

Publication Number Publication Date
CN102768765A CN102768765A (en) 2012-11-07
CN102768765B true CN102768765B (en) 2015-07-15

Family

ID=47096158

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210210097.XA Expired - Fee Related CN102768765B (en) 2012-06-25 2012-06-25 Real-time soft shadow rendering method for point light sources

Country Status (1)

Country Link
CN (1) CN102768765B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104103092A (en) * 2014-07-24 2014-10-15 无锡梵天信息技术股份有限公司 Real-time dynamic shadowing realization method based on projector lamp
CN104103089A (en) * 2014-07-29 2014-10-15 无锡梵天信息技术股份有限公司 Real-time soft shadow realization method based on image screen space
GB2520822B (en) * 2014-10-10 2016-01-13 Aveva Solutions Ltd Image rendering of laser scan data
CN105447905B (en) * 2015-11-17 2018-03-06 长春理工大学 Three-dimensional scenic approximation soft shadows method for drafting based on observability smothing filtering
CN106447761B (en) * 2016-08-31 2019-03-08 北京像素软件科技股份有限公司 A kind of Shading Rendering method
CN106447759B (en) * 2016-10-19 2018-10-12 长春理工大学 The method for realizing the indirect lighting effect proximity rendering of three-dimensional scenic using visibility interpolation
CN106558092B (en) * 2016-11-16 2020-01-07 北京航空航天大学 Multi-light-source scene accelerated drawing method based on scene multidirectional voxelization
CN106991717B (en) * 2017-03-16 2020-12-18 珠海市魅族科技有限公司 Image processing method and system applied to three-dimensional scene
CN108090949A (en) * 2017-12-26 2018-05-29 苏州蜗牛数字科技股份有限公司 A kind of real-time global illumination method propagated based on luminous energy
US11145108B2 (en) * 2018-03-21 2021-10-12 Nvidia Corporation Uniform density cube map rendering for spherical projections
US10650578B2 (en) 2018-05-11 2020-05-12 Microsoft Technology Licensing, Llc Dynamic soft shadow
CN111028357B (en) * 2018-10-09 2020-11-17 北京嘀嘀无限科技发展有限公司 Soft shadow processing method and device of augmented reality equipment
CN110675479B (en) * 2019-10-14 2023-05-16 北京代码乾坤科技有限公司 Dynamic illumination processing method and device, storage medium and electronic device
CN111243077B (en) * 2020-01-17 2022-08-12 江苏艾佳家居用品有限公司 Real transition shadow realization method based on space pre-exploration
CN111292405B (en) * 2020-02-06 2022-04-08 腾讯科技(深圳)有限公司 Image rendering method and related device
CN111790150B (en) * 2020-06-18 2021-05-28 完美世界(北京)软件科技发展有限公司 Shadow data determination method, device, equipment and readable medium
CN112396683B (en) * 2020-11-30 2024-06-04 腾讯科技(深圳)有限公司 Shadow rendering method, device, equipment and storage medium for virtual scene
CN116109758B (en) * 2023-04-07 2023-06-16 北京渲光科技有限公司 Method and device for positioning projection position of light source and rendering scene

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882324A (en) * 2010-05-19 2010-11-10 北京航空航天大学 Soft shadow real-time rendering method based on bidirectional half-shadow graph

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101882324A (en) * 2010-05-19 2010-11-10 北京航空航天大学 Soft shadow real-time rendering method based on bidirectional half-shadow graph

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于阴影图的阴影生成算法研究现状;过洁等;《计算机辅助设计与图形学学报》;20100430;第22卷(第4期);第1部分第2段,第2.1部分 *
改进的百分比靠近软阴影技术的研究与实现;晏福兴等;《计算机工程与应用》;20111231;第47卷(第1期);全文 *

Also Published As

Publication number Publication date
CN102768765A (en) 2012-11-07

Similar Documents

Publication Publication Date Title
CN102768765B (en) Real-time soft shadow rendering method for point light sources
WO2017206325A1 (en) Calculation method and apparatus for global illumination
CN105205861B (en) Tree three-dimensional Visualization Model implementation method based on Sphere Board
CN107038745B (en) 3D tourist landscape roaming interaction method and device
CN104331918A (en) Occlusion culling and acceleration method for drawing outdoor ground surface in real time based on depth map
CN103903296B (en) Shading Rendering method in the design of virtual house ornamentation indoor scene
CN103500467A (en) Constructive method of image-based three-dimensional model
CN104318605B (en) Parallel lamination rendering method of vector solid line and three-dimensional terrain
CN104103092A (en) Real-time dynamic shadowing realization method based on projector lamp
CN104050708A (en) 3D game engine LOD system achievement method
CN104103089A (en) Real-time soft shadow realization method based on image screen space
CN104299257B (en) A kind of method that real-time dynamic shadow is realized based on outdoor sunlight
CN103700134A (en) Three-dimensional vector model real-time shadow deferred shading method based on controllable texture baking
CN103077552A (en) Three-dimensional displaying method based on multi-view video
CN108804061A (en) The virtual scene display method of virtual reality system
CN102243768A (en) Method for drawing stereo picture of three-dimensional virtual scene
CN104157000B (en) The computational methods of model surface normal
CN109461197B (en) Cloud real-time drawing optimization method based on spherical UV and re-projection
CN103366396A (en) Partial shadow image-based high-quality soft shadow fast generation method
CN112734892A (en) Real-time global illumination rendering method for virtual cable tunnel scene model
CN104217461A (en) A parallax mapping method based on a depth map to simulate a real-time bump effect
US10607394B2 (en) Methods and systems for volumetric reconstruction based on a confidence field
CN106204703A (en) Three-dimensional scene models rendering intent and device
CN106846474B (en) WebGIS (Web geographic information System) time-space process simulation method based on time sequence characteristics and particle systems
CN103645463A (en) Three-dimensional displaying method for synthetic aperture radar imaging data

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20150715

Termination date: 20160625

CF01 Termination of patent right due to non-payment of annual fee