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

added Horizon-Based Ambient Occlusion #5645

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
127 changes: 127 additions & 0 deletions Apps/Sandcastle/gallery/HBAO.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
<!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="Change color of 3D models.">
<meta name="cesium-sandcastle-labels" content="Showcases">
<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">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</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">
<table>
<tbody>
<tr>
<td>HBAO</td>
<td>
<input type="checkbox" data-bind="checked: HBAOShow">
</td>
</tr>
<tr>
<td>HBAO Only</td>
<td>
<input type="checkbox" data-bind="checked: HBAOonly">
</td>
</tr>
<tr>
<td>Intensity</td>
<td>
<input type="range" min="1" max="10" step="1" data-bind="value: HBAOintensity, valueUpdate: 'input'">
</td>
</tr>
<tr>
<td>LenCap</td>
<td>
<input type="range" min="0" max="1" step="0.01" data-bind="value: HBAOlenCap, valueUpdate: 'input'">
</td>
</tr>
<tr>
<td>StepSize</td>
<td>
<input type="range" min="1" max="10" step="0.01" data-bind="value: HBAOstepSize, valueUpdate: 'input'">
</td>
</tr>
<tr>
<td>Bias</td>
<td>
<input type="range" min="0" max="1" step="0.01" data-bind="value: HBAObias, valueUpdate: 'input'">
</td>
</tr>
</tbody>
</table>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var postProcess = scene.postProcess;
scene.globe.depthTestAgainstTerrain = true;
scene.fxaa = false;

var tileset = viewer.scene.primitives.add(new Cesium.Cesium3DTileset({
url: 'https://beta.cesium.com/api/assets/1459?access_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIzNjUyM2I5Yy01YmRhLTQ0MjktOGI0Zi02MDdmYzBjMmY0MjYiLCJpZCI6NDQsImFzc2V0cyI6WzE0NTldLCJpYXQiOjE0OTkyNjQ3ODF9.SW_rwY-ic0TwQBeiweXNqFyywoxnnUBtcVjeCmDGef4'
}));

tileset.readyPromise.then(function () {
var boundingSphere = tileset.boundingSphere;
viewer.camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(0.5, -0.4, boundingSphere.radius * 1.0));
viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
}).otherwise(function (error) {
throw (error);
});


var viewModel = {
HBAOShow: false,
HBAOonly: false,
HBAOintensity: 4.0,
HBAObias: 0.1,
HBAOlenCap: 0.1,
HBAOstepSize: 2.0
};

Cesium.knockout.track(viewModel);
var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar);
for (var name in viewModel) {
if (viewModel.hasOwnProperty(name)) {
Cesium.knockout.getObservable(viewModel, name).subscribe(updatePostProcess);
}
}

function updatePostProcess() {
postProcess.HBAO.show = Boolean(viewModel.HBAOShow);
postProcess.HBAO.uniformValues.HBAOonly = Boolean(viewModel.HBAOonly);
postProcess.HBAO.uniformValues.intensity = Number(viewModel.HBAOintensity);
postProcess.HBAO.uniformValues.bias = Number(viewModel.HBAObias);
postProcess.HBAO.uniformValues.lenCap = Number(viewModel.HBAOlenCap);
postProcess.HBAO.uniformValues.stepSize = Number(viewModel.HBAOstepSize);
scene.fxaa = Boolean(viewModel.fxaaShow);
}
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
Binary file added Apps/Sandcastle/gallery/HBAO.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
105 changes: 105 additions & 0 deletions Apps/Sandcastle/gallery/LensFlare.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!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="Change color of 3D models.">
<meta name="cesium-sandcastle-labels" content="Showcases">
<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">
require.config({
baseUrl : '../../../Source',
waitSeconds : 60
});
</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">
<table>
<tbody>
<tr>
<td>Lens Flare</td>
<td>
<input type="checkbox" data-bind="checked: LensFlare_Show">
</td>
</tr>
<tr>
<td>Intensity</td>
<td>
<input type="range" min="0" max="10" step="0.01" data-bind="value: LensFlare_Intensity, valueUpdate: 'input'">
</td>
</tr>
<tr>
<td>Distortion</td>
<td>
<input type="range" min="1" max="20" step="0.01" data-bind="value: LensFlare_Distortion, valueUpdate: 'input'">
</td>
</tr>
<tr>
<td>Dispersion</td>
<td>
<input type="range" min="0" max="1" step="0.01" data-bind="value: LensFlare_Dispersion, valueUpdate: 'input'">
</td>
</tr>
<tr>
<td>HaloWidth</td>
<td>
<input type="range" min="0" max="1" step="0.01" data-bind="value: LensFlare_HaloWidth, valueUpdate: 'input'">
</td>
</tr>

</tbody>
</table>
</div>
<script id="cesium_sandcastle_script">
function startup(Cesium) {
'use strict';
//Sandcastle_Begin
var viewer = new Cesium.Viewer('cesiumContainer');
var scene = viewer.scene;
var postProcess = scene.postProcess;

var viewModel = {
LensFlare_Show: false,
LensFlare_Intensity: 2.0,
LensFlare_Distortion: 10.0,
LensFlare_Dispersion: 0.4,
LensFlare_HaloWidth: 0.4,
};

Cesium.knockout.track(viewModel);
var toolbar = document.getElementById('toolbar');
Cesium.knockout.applyBindings(viewModel, toolbar);
for (var name in viewModel) {
if (viewModel.hasOwnProperty(name)) {
Cesium.knockout.getObservable(viewModel, name).subscribe(updatePostProcess);
}
}

function updatePostProcess() {
postProcess.lensFlare.show = Boolean(viewModel.LensFlare_Show);
postProcess.lensFlare._uniformValues.intensity = Number(viewModel.LensFlare_Intensity);
postProcess.lensFlare._uniformValues.distortion = Number(viewModel.LensFlare_Distortion);
postProcess.lensFlare._uniformValues.ghostDispersal = Number(viewModel.LensFlare_Dispersion);
postProcess.lensFlare._uniformValues.haloWidth = Number(viewModel.LensFlare_HaloWidth);
postProcess.lensFlare._uniformValues.earthRadius = Cesium.Ellipsoid.WGS84.maximumRadius;
}
//Sandcastle_End
Sandcastle.finishedLoading();
}
if (typeof Cesium !== "undefined") {
startup(Cesium);
} else if (typeof require === "function") {
require(["Cesium"], startup);
}
</script>
</body>
</html>
Binary file added Apps/Sandcastle/gallery/LensFlare.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/Assets/Textures/HBAO/RandomNoiseTex.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/Assets/Textures/LensFlare/DirtMask.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/Assets/Textures/LensFlare/StarBurst.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading