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

Sync v3.0.0-rc.1 with the release branch #12960

Merged
merged 53 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
09cbc98
Update description for `top` slot (#12937)
tayalav Oct 24, 2023
ca554ae
Revert "Update description for `top` slot (#12937)" (#12945)
stepankuzmin Oct 24, 2023
19a28a1
Replace lights requirement in property `doc` with `requires` (#12896)
tristen Oct 24, 2023
ccdd8e3
Add negate requirement for flood vs ambient properties set (#12947)
tristen Oct 25, 2023
d88d4b0
Update camera.js: fix missing space in example (#12943)
mvl22 Oct 27, 2023
125dfee
[WIP] Include shader preludes explicitly (internal-868)
endanke Oct 23, 2023
0ce7259
fix wireframe overlay for instanced rendering (internal-866)
alexey-romanov Oct 23, 2023
8e6396d
[MAPS3D-1072] update tiled_3d_model_bucket state after elevation upda…
akoylasar Oct 23, 2023
8ed536a
Remove the old benchmarks in the `bench` folder (internal-867)
mourner Oct 23, 2023
ae3b3df
[MAPS3D-1067] add zoom-based model rotation, scale and translation (i…
alexey-romanov Oct 24, 2023
4a7457d
[MAPS3D-1077] Filter out mutually exclusive data-driven properties fo…
akoylasar Oct 24, 2023
80d9ef1
Eliminate the rounding of projected line anchor coordinates (interna…
zmiao Oct 25, 2023
3baa53b
upgrade rollup, minify internal exports (internal-881)
mourner Oct 25, 2023
d3c6636
try minifying the spec more (internal-882)
mourner Oct 25, 2023
7024d0b
Honor emissive strength for 3D puck (internal-884)
jtorresfabra Oct 25, 2023
caeb881
Bump stylelint from 15.10.3 to 15.11.0 (internal-872)
dependabot[bot] Oct 26, 2023
0bcb4c8
Bump sinon from 16.1.0 to 17.0.0 (internal-874)
dependabot[bot] Oct 26, 2023
b534de0
Bump tape from 5.7.1 to 5.7.2 (internal-875)
dependabot[bot] Oct 26, 2023
887cac5
Bump puppeteer-core from 21.3.6 to 21.4.0 (internal-873)
dependabot[bot] Oct 26, 2023
8d39adb
[MAPS3D-1040] shader changes to get directional component in sync wit…
astojilj Oct 26, 2023
6490ed9
Ignore flaky elevation-not-yet-available render test (internal-887)
stepankuzmin Oct 26, 2023
591ff5d
[MAPS3D-1123] Ortho camera: Fix bumpy pan over terrain at zero pitch …
astojilj Oct 27, 2023
d45edba
Add a range-request capable local server for dev usage
rreusser Oct 27, 2023
fb4170a
Add comments on http dev server
rreusser Oct 27, 2023
881acd9
Reject duplicate ids of imports (internal-892)
miafan23 Oct 30, 2023
49e6ccf
Rename useProgram to getOrCreateProgram in painter (internal-888)
endanke Oct 30, 2023
4495ad5
Add render test for large fill extrusions (internal-894)
mpulkki-mapbox Oct 30, 2023
636fbe4
Bump browserify-sign from 4.2.1 to 4.2.2 (internal-895)
dependabot[bot] Oct 30, 2023
b3811fc
Bump react-devtools-core from 4.25.0 to 4.28.5 (internal-896)
dependabot[bot] Oct 30, 2023
323463b
[MAPS3D-1132][MAPS3D-1135] Disable occlusion culling of symbols on te…
akoylasar Oct 30, 2023
1744c07
Fix rendering of data-driven line-border values (internal-897)
endanke Oct 31, 2023
e39eace
[GLJS-526] Validate duplicate 3D light types (internal-902)
stepankuzmin Oct 31, 2023
e1870c6
Handle null in "raster-color" evaluation (internal-901)
stepankuzmin Oct 31, 2023
bbdf620
Bump @rollup/plugin-replace from 5.0.4 to 5.0.5 (internal-900)
dependabot[bot] Oct 31, 2023
720e457
Bump puppeteer-core from 21.4.0 to 21.4.1 (internal-898)
dependabot[bot] Oct 31, 2023
f5bd4bc
Add slot support in CustomLayer (internal-893)
stepankuzmin Oct 31, 2023
92856b8
Bump rollup from 4.1.4 to 4.1.5 (internal-899)
dependabot[bot] Oct 31, 2023
470bf7b
Improve shader precompilation (internal-879)
endanke Nov 1, 2023
ea4602d
Reduce program variants (internal-905)
endanke Nov 2, 2023
a6b5db0
Evaluate batched 3d models in the worker at bucket creation time (int…
jtorresfabra Nov 2, 2023
d0f6b0c
[GLJS-538] Ignore fill-extrusion-color alpha component also in 3D lig…
aleksigron Nov 2, 2023
0a262b3
Refactor style merging (internal-843)
stepankuzmin Nov 3, 2023
8b3ede2
Switch default style from standard-beta to standard (internal-910)
stepankuzmin Nov 5, 2023
050a368
[GLJS-546] Fix setting Transform.elevation to null when terrain is di…
astojilj Nov 5, 2023
7659da6
Shareable style changes (internal-908)
stepankuzmin Nov 6, 2023
9c07a19
Disable Terrain render cache on 3D Lights transition (internal-912)
stepankuzmin Nov 7, 2023
dc5ff7d
Bump puppeteer-core from 21.4.1 to 21.5.0 (internal-913)
dependabot[bot] Nov 7, 2023
96e5038
Bump selenium-webdriver from 4.14.0 to 4.15.0 (internal-914)
dependabot[bot] Nov 7, 2023
e75b0e8
Bump rollup from 4.1.5 to 4.3.0 (internal-915)
dependabot[bot] Nov 7, 2023
11a2884
Bump sinon from 17.0.0 to 17.0.1 (internal-916)
dependabot[bot] Nov 7, 2023
39c7a8f
Only precompile shaders when all imports are loaded (internal-918)
endanke Nov 7, 2023
88f04c3
Use layer.fqid for landmark bucket creation and conflation (internal-…
jtorresfabra Nov 7, 2023
466ee28
v3.0.0-rc.1 (internal-919)
mourner Nov 7, 2023
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
29 changes: 1 addition & 28 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,6 @@ workflows:
ignore: /.*/
branches:
only: main
- deploy-benchmarks:
requires:
- install-mbx-ci
- build
filters:
tags:
only: /v[0-9]+.[0-9]+.[0-9]+(-.+)?/
branches:
only:
- main
- /release-.*/
- deploy-release:
requires:
- install-mbx-ci
Expand Down Expand Up @@ -389,22 +378,6 @@ jobs:
at: ~/
- run: yarn run test-expressions

deploy-benchmarks:
<<: *linux-defaults
steps:
- attach_workspace:
at: ~/
- run:
name: Build
command: BENCHMARK_VERSION="${CIRCLE_TAG:-$CIRCLE_BRANCH} $(git rev-parse --short=7 HEAD)" yarn run build-benchmarks
- aws-cli/install
- run:
name: Upload benchmark
command: aws s3 cp --acl public-read --content-type application/javascript bench/versions/benchmarks_generated.js s3://mapbox-gl-js/${CIRCLE_TAG:-$CIRCLE_BRANCH}/benchmarks.js
- run:
name: Upload source maps
command: aws s3 cp --acl public-read --content-type application/javascript bench/versions/benchmarks_generated.js.map s3://mapbox-gl-js/${CIRCLE_TAG:-$CIRCLE_BRANCH}/benchmarks.js.map

deploy-release:
<<: *linux-defaults
steps:
Expand Down Expand Up @@ -600,4 +573,4 @@ jobs:
name: Trigger SLA performance tests
command: |
sha=$(git rev-parse HEAD)
curl --location --request POST 'https://circleci.com/api/v2/project/github/mapbox/mapbox-gl-js-performance-internal/pipeline' --header 'Content-Type: application/json' -u $CIRCLECI_API_TOKEN: -d "{ \"parameters\": { \"setup_sha\": \"$sha\", \"setup_source_branch\": \"internal\" } }"
curl --location --request POST 'https://circleci.com/api/v2/project/github/mapbox/mapbox-gl-js-performance-internal/pipeline' --header 'Content-Type: application/json' -u $CIRCLECI_API_TOKEN: -d "{ \"parameters\": { \"setup_sha\": \"$sha\", \"setup_source_branch\": \"internal\" } }"
55 changes: 51 additions & 4 deletions 3d-style/data/bucket/model_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import toEvaluationFeature from '../../../src/data/evaluation_feature.js';
import type {EvaluationFeature} from '../../../src/data/evaluation_feature.js';
import EvaluationParameters from '../../../src/style/evaluation_parameters.js';
import Point from '@mapbox/point-geometry';
import {vec3} from 'gl-matrix';
import type {Mat4} from 'gl-matrix';
import type {CanonicalTileID, OverscaledTileID} from '../../../src/source/tile_id.js';
import type {
Expand Down Expand Up @@ -37,10 +38,17 @@ class ModelFeature {
instancedDataOffset: number;
instancedDataCount: number;

rotation: Array<number>;
scale: Array<number>;
translation: Array<number>;

constructor(feature: EvaluationFeature, offset: number) {
this.feature = feature;
this.instancedDataOffset = offset;
this.instancedDataCount = 0;
this.rotation = [0, 0, 0];
this.scale = [1, 1, 1];
this.translation = [0, 0, 0];
}
}

Expand Down Expand Up @@ -92,15 +100,19 @@ class ModelBucket implements Bucket {
terrainElevationMin: number;
terrainElevationMax: number;

hasZoomDependentProperties: boolean;

/* $FlowIgnore[incompatible-type-arg] Doesn't need to know about all the implementations */
constructor(options: BucketParameters<ModelStyleLayer>) {
this.zoom = options.zoom;
this.canonical = options.canonical;
this.layers = options.layers;
this.layerIds = this.layers.map(layer => layer.id);
this.layerIds = this.layers.map(layer => layer.fqid);
this.projection = options.projection;
this.index = options.index;

this.hasZoomDependentProperties = this.layers[0].isZoomDependent();

this.stateDependentLayerIds = this.layers.filter((l) => l.isStateDependent()).map((l) => l.id);
this.hasPattern = false;
this.instancesPerModel = {};
Expand Down Expand Up @@ -163,6 +175,37 @@ class ModelBucket implements Bucket {
this.maxHeight = 0; // needs to be recalculated.
}

updateZoomBasedPaintProperties(): boolean {
if (!this.hasZoomDependentProperties) {
return false;
}

// layer.paint.get('model-rotation').isZoom
let reuploadNeeded = false;
for (const modelId in this.instancesPerModel) {
const instances = this.instancesPerModel[modelId];
for (const feature of instances.features) {
const layer = this.layers[0];
const evaluationFeature = feature.feature;
const canonical = this.canonical;
const rotation = layer.paint.get('model-rotation').evaluate(evaluationFeature, {}, canonical);
const scale = layer.paint.get('model-scale').evaluate(evaluationFeature, {}, canonical);
const translation = layer.paint.get('model-translation').evaluate(evaluationFeature, {}, canonical);

// $FlowFixMe.
if (!vec3.exactEquals(feature.rotation, rotation) ||
// $FlowFixMe.
!vec3.exactEquals(feature.scale, scale) ||
// $FlowFixMe.
!vec3.exactEquals(feature.translation, translation)) {
this.evaluate(feature, feature.featureStates, instances, true);
reuploadNeeded = true;
}
}
}
return reuploadNeeded;
}

isEmpty(): boolean {
for (const modelId in this.instancesPerModel) {
const perModelAttributes = this.instancesPerModel[modelId];
Expand Down Expand Up @@ -256,9 +299,13 @@ class ModelBucket implements Bucket {
const layer = this.layers[0];
const evaluationFeature = feature.feature;
const canonical = this.canonical;
const rotation = layer.paint.get('model-rotation').evaluate(evaluationFeature, featureState, canonical);
const scale = layer.paint.get('model-scale').evaluate(evaluationFeature, featureState, canonical);
const translation = layer.paint.get('model-translation').evaluate(evaluationFeature, featureState, canonical);
// $FlowFixMe.
const rotation = feature.rotation = layer.paint.get('model-rotation').evaluate(evaluationFeature, featureState, canonical);
// $FlowFixMe.
const scale = feature.scale = layer.paint.get('model-scale').evaluate(evaluationFeature, featureState, canonical);
// $FlowFixMe.
const translation = feature.translation = layer.paint.get('model-translation').evaluate(evaluationFeature, featureState, canonical);

const color = layer.paint.get('model-color').evaluate(evaluationFeature, featureState, canonical);
color.a = layer.paint.get('model-color-mix-intensity').evaluate(evaluationFeature, featureState, canonical);
const rotationScaleYZFlip: Mat4 = [];
Expand Down
11 changes: 7 additions & 4 deletions 3d-style/data/bucket/tiled_3d_model_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ class Tiled3dModelBucket implements Bucket {
expressionRequiresReevaluation(layer.paint.get('model-roughness').value, brightnessChanged) ||
expressionRequiresReevaluation(layer.paint.get('model-emissive-strength').value, brightnessChanged) ||
expressionRequiresReevaluation(layer.paint.get('model-height-based-emissive-strength-multiplier').value, brightnessChanged)) {
this.dirty = false;
this.projection = projection;
this.brightness = calculatedBrightness;
return true;
Expand Down Expand Up @@ -228,14 +227,16 @@ class Tiled3dModelBucket implements Bucket {
this.needsUpload = true;
}
}
this.dirty = false;
}

elevationUpdate(terrain: Terrain, exaggeration: number, coord: OverscaledTileID, source: string) {

assert(terrain);
const demTile = terrain.findDEMTileFor(coord);
if (demTile === this.terrainTile && exaggeration === this.terrainExaggeration) return;
if (!demTile) return;
if (demTile.tileID.canonical === this.terrainTile && exaggeration === this.terrainExaggeration) return;

if (terrain && demTile && demTile.dem && demTile.tileID.overscaledZ !== this.elevationReadFromZ) {
if (demTile.dem && demTile.tileID.overscaledZ !== this.elevationReadFromZ) {
this.elevationReadFromZ = demTile.tileID.overscaledZ;
const dem = DEMSampler.create(terrain, coord, demTile);
if (!dem) return;
Expand All @@ -255,6 +256,8 @@ class Tiled3dModelBucket implements Bucket {
node.elevation = elevation;
}
}
this.terrainTile = demTile.tileID.canonical;
this.terrainExaggeration = exaggeration;
}

updateDEM(terrain: Terrain, dem: DEMSampler, coord: OverscaledTileID, source: string) {
Expand Down
39 changes: 25 additions & 14 deletions 3d-style/render/draw_model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @flow

import type Painter from '../../src/render/painter.js';
import type {UseProgramParams} from '../../src/render/painter.js';
import type {CreateProgramParams} from '../../src/render/painter.js';
import type SourceCache from '../../src/source/source_cache.js';
import type ModelStyleLayer from '../style/style_layer/model_style_layer.js';

Expand Down Expand Up @@ -160,7 +160,7 @@ function drawMesh(sortedMesh: SortedMesh, painter: Painter, layer: ModelStyleLay
material,
layer);

const programOptions: UseProgramParams = {
const programOptions: CreateProgramParams = {
defines: []
};

Expand Down Expand Up @@ -189,7 +189,7 @@ function drawMesh(sortedMesh: SortedMesh, painter: Painter, layer: ModelStyleLay
(programOptions.defines: any).push('RENDER_CUTOFF');
}

const program = painter.useProgram('model', programOptions);
const program = painter.getOrCreateProgram('model', programOptions);

painter.uploadCommonUniforms(context, program, null, fogMatrixArray, cutoffParams);

Expand Down Expand Up @@ -268,7 +268,7 @@ function drawShadowCaster(mesh: Mesh, matrix: Mat4, painter: Painter, layer: Mod
const shadowMatrix = shadowRenderer.calculateShadowPassMatrixFromMatrix(matrix);
const uniformValues = modelDepthUniformValues(shadowMatrix);
const definesValues = ['DEPTH_TEXTURE'];
const program = painter.useProgram('modelDepth', {defines: ((definesValues: any): DynamicDefinesType[])});
const program = painter.getOrCreateProgram('modelDepth', {defines: ((definesValues: any): DynamicDefinesType[])});
const context = painter.context;
program.draw(painter, context.gl.TRIANGLES, depthMode, StencilMode.disabled, colorMode, CullFaceMode.backCCW,
uniformValues, layer.id, mesh.vertexBuffer, mesh.indexBuffer, mesh.segments, layer.paint, painter.transform.zoom,
Expand Down Expand Up @@ -407,7 +407,7 @@ function drawModels(painter: Painter, sourceCache: SourceCache, layer: ModelStyl
}

// If terrain changes, update elevations (baked in translation).
function updateModelBucketsElevation(painter: Painter, bucket: ModelBucket, bucketTileID: OverscaledTileID) {
function updateModelBucketsElevation(painter: Painter, bucket: ModelBucket, bucketTileID: OverscaledTileID): boolean {
let exaggeration = painter.terrain ? painter.terrain.exaggeration() : 0;
let dem: ?DEMSampler;
if (painter.terrain && exaggeration > 0) {
Expand All @@ -427,7 +427,7 @@ function updateModelBucketsElevation(painter: Painter, bucket: ModelBucket, buck

if (exaggeration === bucket.validForExaggeration &&
(exaggeration === 0 || (dem && dem._demTile && dem._demTile.tileID === bucket.validForDEMTile.id && dem._dem._timestamp === bucket.validForDEMTile.timestamp))) {
return;
return false;
}

let elevationMin: ?number;
Expand All @@ -451,8 +451,18 @@ function updateModelBucketsElevation(painter: Painter, bucket: ModelBucket, buck

bucket.validForExaggeration = exaggeration;
bucket.validForDEMTile = dem && dem._demTile ? {id: dem._demTile.tileID, timestamp: dem._dem._timestamp} : {id: undefined, timestamp: 0};
bucket.uploaded = false;
bucket.upload(painter.context);

return true;
}

function updateModelBucketData(painter: Painter, bucket: ModelBucket, bucketTileID: OverscaledTileID) {
const bucketContentsUpdatedByZoom = bucket.updateZoomBasedPaintProperties();
const bucketContentsUpdatedByElevation = updateModelBucketsElevation(painter, bucket, bucketTileID);

if (bucketContentsUpdatedByZoom || bucketContentsUpdatedByElevation) {
bucket.uploaded = false;
bucket.upload(painter.context);
}
}

// preallocate structure used to reduce re-allocation during rendering and flow checks
Expand Down Expand Up @@ -517,8 +527,7 @@ function drawInstancedModels(painter: Painter, source: SourceCache, layer: Model
const tileZoom = calculateTileZoom(coord, tr);
evaluationParameters.zoom = tileZoom;
const modelIdProperty = modelIdUnevaluatedProperty.possiblyEvaluate(evaluationParameters);

updateModelBucketsElevation(painter, bucket, coord);
updateModelBucketData(painter, bucket, coord);

renderData.shadowUniformsInitialized = false;
renderData.useSingleShadowCascade = !!shadowRenderer && shadowRenderer.getMaxCascadeForTile(coord.toUnwrapped()) === 0;
Expand Down Expand Up @@ -560,6 +569,8 @@ function drawInstancedModels(painter: Painter, source: SourceCache, layer: Model
const minimumInstanceCount = 20;

function drawInstancedNode(painter: Painter, layer: ModelStyleLayer, node: Node, modelInstances: any, cameraPos: [number, number, number], coord: OverscaledTileID, renderData: RenderData) {

// console.log(`LAYER: ${JSON.stringify(layer.paint.get('model-scale'))}`);
const context = painter.context;
const isShadowPass = painter.renderPass === 'shadow';
const shadowRenderer = painter.shadowRenderer;
Expand All @@ -583,12 +594,12 @@ function drawInstancedNode(painter: Painter, layer: ModelStyleLayer, node: Node,
definesValues.push('RENDER_CUTOFF');
}
if (isShadowPass && shadowRenderer) {
program = painter.useProgram('modelDepth', {defines: ((definesValues: any): DynamicDefinesType[])});
program = painter.getOrCreateProgram('modelDepth', {defines: ((definesValues: any): DynamicDefinesType[])});
uniformValues = modelDepthUniformValues(renderData.shadowTileMatrix, renderData.shadowTileMatrix, Float32Array.from(node.matrix));
colorMode = shadowRenderer.getShadowPassColorMode();
} else {
setupMeshDraw(definesValues, dynamicBuffers, mesh, painter);
program = painter.useProgram('model', {defines: ((definesValues: any): DynamicDefinesType[]), overrideFog: affectedByFog});
program = painter.getOrCreateProgram('model', {defines: ((definesValues: any): DynamicDefinesType[]), overrideFog: affectedByFog});
const material = mesh.material;
const pbr = material.pbrMetallicRoughness;
const layerOpacity = layer.paint.get('model-opacity');
Expand Down Expand Up @@ -755,7 +766,7 @@ function drawBatchedModels(painter: Painter, source: SourceCache, layer: ModelSt
continue;
}

const programOptions: UseProgramParams = {
const programOptions: CreateProgramParams = {
defines: []
};
const dynamicBuffers = [];
Expand Down Expand Up @@ -788,7 +799,7 @@ function drawBatchedModels(painter: Painter, source: SourceCache, layer: ModelSt
}
}

const program = painter.useProgram('model', programOptions);
const program = painter.getOrCreateProgram('model', programOptions);

if (!isShadowPass && shadowRenderer) {
shadowRenderer.useNormalOffset = !!mesh.normalBuffer;
Expand Down
8 changes: 4 additions & 4 deletions 3d-style/render/shadow_renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export class ShadowRenderer {

this._shadowLayerCount = painter.style.order.reduce(
(accumulator: number, layerId: string) => {
const layer = painter.style._layers[layerId];
const layer = painter.style._mergedLayers[layerId];
return accumulator + (layer.hasShadowPass() && !layer.isHidden(transform.zoom) ? 1 : 0);
}, 0);

Expand Down Expand Up @@ -332,10 +332,10 @@ export class ShadowRenderer {
context.clear({color: Color.white, depth: 1});

for (const layerId of style.order) {
const layer = style._layers[layerId];
const layer = style._mergedLayers[layerId];
if (!layer.hasShadowPass() || layer.isHidden(painter.transform.zoom)) continue;

const sourceCache = style._getLayerSourceCache(layer);
const sourceCache = style.getLayerSourceCache(layer);
const coords = sourceCache ? sourceCoords[sourceCache.id] : undefined;
if (layer.type !== 'model' && !(coords && coords.length)) continue;

Expand Down Expand Up @@ -374,7 +374,7 @@ export class ShadowRenderer {
for (const id of this._groundShadowTiles) {
const unwrapped = id.toUnwrapped();
const affectedByFog = painter.isTileAffectedByFog(id);
const program = painter.useProgram('groundShadow', {defines: baseDefines, overrideFog: affectedByFog});
const program = painter.getOrCreateProgram('groundShadow', {defines: baseDefines, overrideFog: affectedByFog});

this.setupShadows(unwrapped, program);

Expand Down
2 changes: 2 additions & 0 deletions 3d-style/shaders/fill_extrusion_depth.vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "_prelude_terrain.vertex.glsl"

uniform mat4 u_matrix;
uniform float u_edge_radius;
uniform float u_vertical_scale;
Expand Down
2 changes: 2 additions & 0 deletions 3d-style/shaders/ground_shadow.fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "_prelude_shadow.fragment.glsl"

#ifdef GL_ES
precision highp float;
#endif
Expand Down
2 changes: 2 additions & 0 deletions 3d-style/shaders/ground_shadow.vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#include "_prelude_fog.vertex.glsl"

uniform mat4 u_matrix;
uniform mat4 u_light_matrix_0;
uniform mat4 u_light_matrix_1;
Expand Down
9 changes: 8 additions & 1 deletion 3d-style/shaders/model.fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "_prelude_fog.fragment.glsl"
#include "_prelude_shadow.fragment.glsl"
#include "_prelude_lighting.glsl"

uniform float u_opacity;

Expand All @@ -9,6 +12,8 @@ uniform vec4 u_baseColorFactor;
uniform vec4 u_emissiveFactor;
uniform float u_metallicFactor;
uniform float u_roughnessFactor;
uniform float u_emissive_strength;


varying highp vec4 v_position_height;
varying lowp vec4 v_color_mix;
Expand Down Expand Up @@ -461,7 +466,9 @@ vec4 finalColor;
opacity *= v_roughness_metallic_emissive_alpha.w * saturate(1.0 - distance * distance);
#endif
#endif

// Use emissive strength as interpolation between lit and unlit color
// for coherence with other layer types.
color = mix(color, mat.baseColor.rgb, u_emissive_strength);
color = linearTosRGB(color);
color *= opacity;
finalColor = vec4(color, opacity);
Expand Down
3 changes: 3 additions & 0 deletions 3d-style/shaders/model.vertex.glsl
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "_prelude_fog.vertex.glsl"
#include "_prelude_shadow.vertex.glsl"

attribute vec3 a_pos_3f;

#pragma mapbox: define-attribute highp vec3 normal_3f
Expand Down
Loading
Loading