24 Commits

Author SHA1 Message Date
ztenghui
8def74de33 + correcting shadow visual appearance (b/17610926)
+ adjusting spot and ambient shadow opacity constants to achieve desired appearance
+ reducing ambient scale ratio back to 1.0 to address over-lightening at higher elevations
+ partially revert ag/546290

Change-Id: I9d7f664f73a7b9b83df73b739103c97054bd4f6e
2014-10-01 16:12:28 -07:00
ztenghui
f7d76dffd8 Update the shadow strength
b/17486691

Change-Id: I8e8f0b64e757772c18f038f6b329ef91a4e155a5
2014-09-12 15:29:44 -07:00
ztenghui
512e643ce8 Re-triangulate the spot shadow.
Fix the valid umbra detection.

This looks better b/c every vertex will have one ray shooting at it, such that
we don't miss the corner.

This performs better too, due to the polygon intersection is removed and less ray
intersection. 2x performance for rect and circle for spot shadow in test app.

    b/17288227
    b/15598793
    b/16712006

Change-Id: I4a5ee397b9e192e93c8e35e6260b499e3e38a6f4
2014-09-10 17:05:59 -07:00
ztenghui
c50a03d78a Improve the spot shadow computation.
Get rid of compuation of the intersection for penumbra and convex hull for umbra.
Use simple circle / normal to compute the penumbra and simple intersection for umbra.

The new way could be 2x to 4x faster from rectangle to round shape.
And this part is roughly half of the shadow computation, or 2/3 of spot shadow
computation.

This improve the spot shadow spikeness too.

b/16712006
b/14976551

Change-Id: I02911784868731369efa73f76fc915bc08248600
2014-08-22 13:51:16 -07:00
John Reck
1aa5d2d706 Fix ALL compile warnings
All warnings/errors fixed for GCC & Clang

Change-Id: I2ece3a136a5ae97a9acc3069537ed986238b5fd3
2014-07-24 14:28:08 -07:00
ztenghui
83f7ee8d12 Remove the unnessary log
We still need to investigate the underlying problem and fix it.

bug:16015708

Change-Id: If38b550d5af990d5aaa6633ee129a61e927d66c1
2014-07-09 23:53:54 +00:00
Chris Craik
05f3d6e511 Tessellate on worker threads
Tessellate and cache (where possible) shadow and round rect
tessellation tasks.

Change-Id: I2cfda8e11d83d51ea74af871235cf26e8f831d40
2014-06-10 01:53:17 +00:00
Chris Craik
797b95b26b Define light position (using new lighting spec) in Java
Also updates the relative shadow strengths.

Change-Id: I6cac7275d38df98aea9f0dda463cd7207102986a
2014-05-21 13:50:29 -07:00
ztenghui
f11310f395 Check the array before accessing it
TODO: Figure out why the path is generating empty polygon.

bug: 14615368

Change-Id: If116e34388b7c6a71bf5ddd36e0c9716d7450732
2014-05-14 21:02:45 +00:00
Chris Craik
64ab917e5e Merge "Add more shadow control knobs" 2014-05-01 01:31:12 +00:00
Chris Craik
f5be3ca5cc Add more shadow control knobs
Change-Id: I1ff500bf429029a97b681ced9df652f4ee9f1332
2014-04-30 18:20:30 -07:00
ztenghui
2e023f3827 Make sure the theta is correctly represented and incoming polygon is CW for shadow.
Now the theta = 0 should be on +x axis.
And cos(theta) should correctly represent x value.
Without this fix, the poly theta (from atan2) can be wrongly rotated 90 degrees.

Also, make sure the incoming polygon is CW for the shadow system.
This fix visual artifacts in recent regression for spot shadows.

bug:13553955

Change-Id: I9bbf54db094e7f133326da4dae4610962da849c1
2014-04-28 16:43:13 -07:00
ztenghui
af6f7ed8dd Early rejection on shadows which are outside of the clip bound.
All the computations are estimated using bounding box.
TODO: Spot shadow could have more accurate but also more expensive methods, we need
more experiments to decide.

Change-Id: I9c10c419576cee55daf0f9f278b0db78cb847447
2014-03-20 15:25:47 -07:00
ztenghui
50ecf849cb Create one hole inside the umbra area to avoid overdraw.
bug:13439450

Change-Id: I859575196bd5a3029f447883025a6ec3a1f1face
2014-03-17 10:10:02 -07:00
Chris Craik
726118b352 Improve shadow tessellation performance
- Tune and simplify shadow parameters
- Remove additional inner rings
- Improve polygon ray casting algorithm

Change-Id: If0f28b2d66ae0480b675942bb65e8fcd2864425d
2014-03-11 15:23:36 -07:00
Chris Craik
87f9df880e Update tessellation tracing
Change-Id: I6c73f2467817412d9936dde217df9938a6884003
2014-03-07 14:34:55 -08:00
ztenghui
63d41abb40 Use pre-computed index to draw the shadow.
Also draw the umbra part as triangle fans instead of zig zag fashion.

b/12840179

Change-Id: Iaa5d15e77351acdd71f076bd8f9bb2d4d2b92faf
2014-02-25 14:18:25 -08:00
Chris Craik
15a07a21eb Use path outlines to define shadow shapes
Fixes the simplifying assumption that shadow casters were always
rectangular.

Java side APIs + plumbing to pass down correct shapes still need to be added.

Change-Id: Ic4fee90af15679951a44bb5cc6ae454b98c4c194
2014-01-26 13:43:53 -08:00
ztenghui
cc3c25622c Property support for light positioning.
Tune up the light size to make it look better.

Change-Id: I139a05f3dd53dacbe55759b91188f0e1cc2c7f80
2014-01-17 13:42:09 -08:00
Chris Craik
8191effc83 Merge "Map shadow light position globally" 2014-01-17 02:09:19 +00:00
Chris Craik
7b3dfa4d13 Transform shadow casters correctly in 3d
Change-Id: I11067c5aa8c749089b6ee163ddafa91865cc0d9f
2014-01-16 16:21:10 -08:00
Chris Craik
3197cded4e Map shadow light position globally
Change-Id: Ic3201cecdf5d2a1dd628e7e40aee912ef516d3b2
2014-01-16 14:03:39 -08:00
ztenghui
7b4516e7ea Calculate and show the shadow from a spot light.
Change-Id: Ia558852e8cde5d33866b22875eb501e4c6858819
2014-01-10 17:18:53 -08:00
ztenghui
55bfb4e728 Calculate and show Ambient shadow.
Basically we compute the shadow as a strip of triangles, whose alpha value
is the strength of the shadow.
We use the normal to extend the geometry.
And we use static function and try to avoid new/malloc in the computation.

Change-Id: I382286f1cad351bd5ff983f76f446c075819dcaf
2013-12-13 17:25:47 -08:00