Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Materials on Ground Primitives #6393

Merged
merged 44 commits into from
May 15, 2018
Merged
Show file tree
Hide file tree
Changes from 40 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
bdf302e
able to get world coordinates from depth tex
likangning93 Feb 13, 2018
4fe0397
texcoords from naive inverse trig
likangning93 Feb 20, 2018
956df6c
using cg ref approx to compute spherical coordinates on CPU and GPU
likangning93 Mar 2, 2018
529b5ab
add separate shader for shadow volume final pass, use a cubic instead…
likangning93 Mar 4, 2018
7af7d47
merged in master
likangning93 Mar 8, 2018
3e5c724
WIP material support for ground primitives w/normals from depth tex
likangning93 Mar 20, 2018
0433738
change ground primitive normal computation to EC for less noise
likangning93 Mar 21, 2018
2b47810
reduce multifrustum artifacts for EC normals from depth
likangning93 Mar 21, 2018
693f7e2
bespoke shadow volume appearance shaders
likangning93 Mar 22, 2018
f9ca260
switch spherical coordinates computation to atan
likangning93 Mar 23, 2018
d02346b
simplified spherical coordinates via atan
likangning93 Mar 26, 2018
71b6095
merged in master
likangning93 Mar 28, 2018
e7c4679
added plane-based texcoords, still has precision artifacts
likangning93 Mar 28, 2018
23d6dfb
changed texcoord planes to use a model matrix attribute, less inaccur…
likangning93 Mar 29, 2018
62ab0ba
using double-precision points for planes, added switching between pla…
likangning93 Mar 29, 2018
2cb5132
add batching for ground primitives
likangning93 Mar 29, 2018
9212796
PR feedback
likangning93 Apr 5, 2018
8e59e2d
add texture coordinate rotation for materials on GroundPrimitives
likangning93 Apr 11, 2018
5ee2f07
added GroundPrimitives material support for 2D/CV [ci skip]
likangning93 Apr 12, 2018
849c8a6
reduce batch table use for 2D texcoords on GroundPrimitives [ci skip]
likangning93 Apr 12, 2018
6b43300
add batched drawing for pick [ci skip]
likangning93 Apr 19, 2018
de2268a
cleanup for shadow volume material vertex shaders [ci skip]
likangning93 Apr 20, 2018
1d9cb79
merged in master, issues with log depth [ci skip]
likangning93 Apr 20, 2018
2aba8f0
fix log depth with GroundPrimitive materials [ci skip]
likangning93 Apr 24, 2018
0844b9d
cleanup for materials on GroundPrimitives [ci skip]
likangning93 Apr 24, 2018
d9ed5c5
unit tests
likangning93 Apr 27, 2018
5e4f46c
updates for planar texcoords in 3D
likangning93 Apr 27, 2018
4a00da4
factor height into GroundPrimitive texcoord planes
likangning93 Apr 29, 2018
d13d97f
PR comments
likangning93 May 2, 2018
5b0c259
add fallback for IE
likangning93 May 3, 2018
e35db9d
merged in master
likangning93 May 3, 2018
6061880
added development Sandcastles, fixed dynamic Entities, updated CHANGE…
likangning93 May 3, 2018
5300fda
fix headers in new development Sandcastle examples
likangning93 May 4, 2018
892b7db
add support for materials on dynamic terrain entities, fix texture co…
likangning93 May 7, 2018
ac71c04
compute tight rectangles for rotated texture coordinates [ci skip]
likangning93 May 9, 2018
41236c4
add specs for tight oriented rectangles for texture coordinates
likangning93 May 9, 2018
921a3db
fix fallback picking
likangning93 May 9, 2018
75dcb60
fix test failures with webgl stub for StaticGroundGeometryPerMaterial…
likangning93 May 10, 2018
fe8d1f7
compute texture coordinate rotation parameters in local ENU for Ellip…
likangning93 May 11, 2018
9643b2c
doc tweaks
likangning93 May 11, 2018
2aaf979
PR feedback and cleanup
likangning93 May 11, 2018
16c7305
handle ClassificationType BOTH and CESIUM_3D_TILE with materials on G…
likangning93 May 15, 2018
fbf05c8
format CHANGES.md entry with bullets
likangning93 May 15, 2018
4f580be
add textured terrain entity example to Ground Clamping Sandcastle
likangning93 May 15, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
487 changes: 487 additions & 0 deletions Apps/Sandcastle/gallery/development/Ground Primitive Materials.html

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions Apps/Sandcastle/gallery/development/Terrain Entity Batching.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="description" content="Demo for batching-by-material of non-overlapping Entities on Terrain.">
<meta name="cesium-sandcastle-labels" content="Development">
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script type="text/javascript" src="../../../ThirdParty/requirejs-2.1.20/require.js"></script>
<script type="text/javascript">
if(typeof require === "function") {
require.config({
baseUrl : '../../../Source',
waitSeconds : 120
});
}
</script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var worldTerrain = Cesium.createWorldTerrain({
requestWaterMask: true,
requestVertexNormals: true
});

var viewer = new Cesium.Viewer('cesiumContainer', {
terrainProvider: worldTerrain
});

var concavePositions = [
new Cesium.Cartesian3(-2353381.4891308164, -3747386.1222378365, 4577999.291515961),
new Cesium.Cartesian3(-2359513.937204245, -3743087.2343810294, 4578357.188560644),
new Cesium.Cartesian3(-2356102.0286082155, -3739921.552293276, 4582670.218770547),
new Cesium.Cartesian3(-2353889.0353209395, -3741183.2274413602, 4582776.909071608),
new Cesium.Cartesian3(-2355072.390487758, -3742865.615615464, 4580808.044684757),
new Cesium.Cartesian3(-2356109.6661414686, -3741994.0607898533, 4580985.489703348),
new Cesium.Cartesian3(-2357041.8328847606, -3743225.9693035223, 4579509.2148039425),
new Cesium.Cartesian3(-2354586.752280607, -3744890.9511893727, 4579411.591389144),
new Cesium.Cartesian3(-2353213.0268325945, -3743712.1202877173, 4581070.08828045),
new Cesium.Cartesian3(-2353637.930711704, -3743402.9513476435, 4581104.219550749),
new Cesium.Cartesian3(-2352875.095159641, -3742564.819171856, 4582173.540953957),
new Cesium.Cartesian3(-2350669.646050987, -3743751.6823160048, 4582334.8406995395)
];

// concave polygon
viewer.entities.add({
name : 'concave polygon on surface',
polygon : {
hierarchy : concavePositions,
material : '../images/Cesium_Logo_Color.jpg'
},
stRotation : 1.0
});

// Randomly colored, nonoverlapping squares
var latitude = 46.2522;
var longitude = -122.2534;

Cesium.Math.setRandomNumberSeed(133);

for (var x = 0; x < 10; ++x) {
for (var y = 0; y < 10; ++y) {
var cornerLat = latitude + 0.01 * x;
var cornerLon = longitude + 0.01 * y;
viewer.entities.add({
id : x + ' ' + y,
rectangle : {
coordinates : Cesium.Rectangle.fromDegrees(cornerLon, cornerLat,
cornerLon + 0.009, cornerLat + 0.009),
material : Cesium.Color.fromRandom().withAlpha(0.5)
}
});
}
}

// Checkerboard
var checkerboard = new Cesium.CheckerboardMaterialProperty({
evenColor : Cesium.Color.ORANGE,
oddColor : Cesium.Color.YELLOW,
repeat : new Cesium.Cartesian2(14, 14)
});

viewer.entities.add({
name : 'checkerboard rectangle',
rectangle : {
coordinates : Cesium.Rectangle.fromDegrees(-122.17778, 46.36169, -120.17778, 48.36169),
material : checkerboard
}
});

// Ellipse with texture rotation and repetition
viewer.entities.add({
position: Cesium.Cartesian3.fromDegrees(-121.70711316136793, 45.943757948892845, 0.0),
name : 'ellipse',
ellipse : {
semiMinorAxis : 15000.0,
semiMajorAxis : 30000.0,
material : '../images/Cesium_Logo_Color.jpg',
stRotation : Cesium.Math.toRadians(45)
}
});

viewer.zoomTo(viewer.entities);
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ Change Log

* Fixed a bug causing custom TilingScheme classes to not be able to use a GeographicProjection. [#6524](https://github.com/AnalyticalGraphicsInc/cesium/pull/6524)

##### Breaking Changes :mega:
* Removed `Scene.copyGlobeDepth`. Globe depth will now be copied by default when supported. [#6393](https://github.com/AnalyticalGraphicsInc/cesium/pull/6393)

##### Additions :tada:
* Added support for materials on terrain entities and `GroundPrimitives`. This functionality requires depth texture support (`WEBGL_depth_texture` or `WEBKIT_WEBGL_depth_texture`), so it is not available in Internet Explorer. Textured materials on terrain entities and `GroundPrimitives` are best suited for notational patterns and are not intended for precisely mapping textures to terrain - for that use case, use `SingleTileImageryProvider`. [#6393](https://github.com/AnalyticalGraphicsInc/cesium/pull/6393)
* Added `GroundPrimitive.supportsMaterials` and `Entity.supportsMaterialsforEntitiesOnTerrain`, both of which can be used to check if materials on terrain entities and `GroundPrimitives` is supported. [#6393](https://github.com/AnalyticalGraphicsInc/cesium/pull/6393)

### 1.45 - 2018-05-01

##### Major Announcements :loudspeaker:
Expand Down
68 changes: 64 additions & 4 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,52 @@ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

### rbush

https://github.com/mourner/rbush

> MIT License

> Copyright (c) 2016 Vladimir Agafonkin

>Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

### quickselect

https://github.com/mourner/quickselect

> ISC License

> Copyright (c) 2018, Vladimir Agafonkin

>Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
and this permission notice appear in all copies.
>
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.

### crunch

https://github.com/BinomialLLC/crunch
Expand Down Expand Up @@ -670,6 +716,20 @@ https://github.com/KhronosGroup/glTF-WebGL-PBR
>CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
>OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### ShaderFastLibs

https://github.com/michaldrobot/ShaderFastLibs

> The MIT License (MIT)
>
> Copyright (c) <2014> <Michal Drobot>
>
> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

### Draco

https://github.com/google/draco
Expand All @@ -692,20 +752,20 @@ https://github.com/leizongmin/js-xss

> Copyright (c) 2012-2017 Zongmin Lei(雷宗民) <[email protected]>
> http://ucdok.com
>
>
> The MIT License
>
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Expand Down
9 changes: 9 additions & 0 deletions Source/Core/CircleGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,15 @@ define([
get : function() {
return this._ellipseGeometry.rectangle;
}
},
/**
* For remapping texture coordinates when rendering CircleGeometries as GroundPrimitives.
* @private
*/
textureCoordinateRotationPoints : {
get : function() {
return this._ellipseGeometry.textureCoordinateRotationPoints;
}
}
});

Expand Down
14 changes: 14 additions & 0 deletions Source/Core/CorridorGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -1045,6 +1045,20 @@ define([
}
return this._rectangle;
}
},
/**
* For stRotation on GroundPrimitives.
* Returns the rectangle part of an oriented rectangle that tightly bounds
* the oriented geometry in Cartographic space.
*
* Corridors don't support geometry orientation or stRotation,
* so just return the rectangle.
* @private
*/
unrotatedTextureRectangle : {
get : function() {
return this.rectangle;
}
}
});

Expand Down
35 changes: 35 additions & 0 deletions Source/Core/EllipseGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ define([
this._workerName = 'createEllipseGeometry';

this._rectangle = undefined;
this._unrotatedTextureRectangle = undefined;
}

/**
Expand Down Expand Up @@ -953,6 +954,31 @@ define([
});
};

function textureCoordinateRotationPoints(ellipseGeometry) {
var stRotation = -ellipseGeometry._stRotation;
if (stRotation === 0.0) {
return [0, 0, 0, 1, 1, 0];
}

var cep = EllipseGeometryLibrary.computeEllipsePositions({
center : ellipseGeometry._center,
semiMajorAxis : ellipseGeometry._semiMajorAxis,
semiMinorAxis : ellipseGeometry._semiMinorAxis,
rotation : ellipseGeometry._rotation,
granularity : ellipseGeometry._granularity
}, false, true);
var positionsFlat = cep.outerPositions;
var positionsCount = positionsFlat.length / 3;
var positions = new Array(positionsCount);
for (var i = 0; i < positionsCount; ++i) {
positions[i] = Cartesian3.fromArray(positionsFlat, i * 3);
}

var ellipsoid = ellipseGeometry._ellipsoid;
var boundingRectangle = ellipseGeometry.rectangle;
return Geometry._textureCoordinateRotationPoints(positions, stRotation, ellipsoid, boundingRectangle);
}

defineProperties(EllipseGeometry.prototype, {
/**
* @private
Expand All @@ -964,6 +990,15 @@ define([
}
return this._rectangle;
}
},
/**
* For remapping texture coordinates when rendering EllipseGeometries as GroundPrimitives.
* @private
*/
textureCoordinateRotationPoints : {
get : function() {
return textureCoordinateRotationPoints(this);
}
}
});

Expand Down
Loading