-
Notifications
You must be signed in to change notification settings - Fork 303
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
Geoid2 #511
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the rebase :)
Please use proper wording for your commits (see http://codeinthehole.com/writing/a-useful-template-for-commit-messages/ for some help) and split them in separate topics (e.g: 1 for the zFactor feature and 1 for the new example)
@@ -14,6 +14,8 @@ uniform sampler2D dTextures_00[1]; | |||
uniform vec3 offsetScale_L00[1]; | |||
uniform int loadedTexturesCount[8]; | |||
|
|||
uniform float zFactor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move all the zFactor
stuff to a specific commit.
src/Renderer/Shader/TileVS.glsl
Outdated
@@ -59,7 +59,8 @@ void main() { | |||
} | |||
|
|||
#elif defined(DATA_TEXTURE_ELEVATION) | |||
float dv = max(texture2D( dTextures_00[0], vVv ).w, 0.); | |||
float dv = texture2D( dTextures_00[0], vVv ).w; | |||
dv *=zFactor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be doing dv *=zFactor;
below (just before vPosition = vec4( position + vNormal * dv ,1.0 )
).
This way it would work with all elevation data sources.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i did it before like you said and it work but i dont know why it does not work now if i put it before vPosition = vec4( position + vNormal * dv ,1.0 )). I think three is a problem with vNormal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. I don't know what is the underlying issue here, but you need to fix this so the z factor
feature works independently of the elevation data source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i set zFactor value by default to 1, so it will not impact on elevation data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My point is: we want this to work regardless of the data source used for elevation.
As an example, zFactor
feature should work on planar.html demo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick review, focusing mostly on style issues.
.gitignore
Outdated
@@ -6,3 +6,5 @@ | |||
/node_modules/ | |||
/dist/ | |||
/lib/ | |||
/nbproject/private/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't belong to the itowns's .gitignore
- gitignore is only populated with folders/files that are by-product or temp files of itowns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(You can add your own ignore stuff in the .gitignore in your home folder)
examples/geoid.html
Outdated
@@ -0,0 +1,71 @@ | |||
<!DOCTYPE html> | |||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this generated header.
examples/geoid.html
Outdated
--> | ||
<html> | ||
<head> | ||
<title>Globe</title> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And fix the title :)
examples/geoid.html
Outdated
promises.push(itowns.Fetcher.json('layers/JSONLayers/GeoidTexture.json').then(function(result) { return globeView.addLayer(result); })); | ||
//promises.push(itowns.Fetcher.json('layers/JSONLayers/Ortho.json').then(function(result) { return globeView.addLayer(result); })); | ||
promises.push(itowns.Fetcher.json('layers/JSONLayers/GeoidMNT.json').then(function(result) { return globeView.addLayer(result); })); | ||
//promises.push(itowns.Fetcher.json('layers/JSONLayers/IGN_MNT.json').then(function(result) { return globeView.addLayer(result); })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And remove dead code in all this file.
nbproject/project.properties
Outdated
@@ -0,0 +1,3 @@ | |||
files.encoding=UTF-8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This nbproject
folder must not be added to iTowns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for your advice
src/Renderer/Shader/TileVS.glsl
Outdated
@@ -59,7 +59,8 @@ void main() { | |||
} | |||
|
|||
#elif defined(DATA_TEXTURE_ELEVATION) | |||
float dv = max(texture2D( dTextures_00[0], vVv ).w, 0.); | |||
float dv = texture2D( dTextures_00[0], vVv ).w; | |||
dv *=zFactor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. I don't know what is the underlying issue here, but you need to fix this so the z factor
feature works independently of the elevation data source.
utils/debug/Main.js
Outdated
@@ -2,3 +2,4 @@ export { default as Debug } from './Debug'; | |||
export { default as PointCloudDebug } from './PointCloudDebug'; | |||
export { default as createTileDebugUI } from './TileDebug'; | |||
export { default as create3dTilesDebugUI } from './3dTilesDebug'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add empty lines please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/Renderer/Shader/TileVS.glsl
Outdated
@@ -69,6 +70,7 @@ void main() { | |||
#endif | |||
|
|||
vPosition = vec4( position + vNormal * dv ,1.0 ); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not add empty lines please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/Core/TileMesh.js
Outdated
return this.geometry.OBB; | ||
var zFactor = this.material.uniforms.zFactor.value; | ||
var OBB = this.geometry.OBB; | ||
OBB.box3D.min.z *= zFactor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is wrong here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't understant! We need it to adapt Bbox to geoid tiles'bbox, zFactor is set by default to 1 so it will not have an impact on DTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code indentation is wrong.
Btw, the code is wrong too since you're going to modify OBB.box3D.min.z
(and max) each time the OBB()
function is called.
So for instance if min.z = 1.0
and zFactor = 3.0
initially, min.z
will be: 3
then 9
then 27
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a posibility that in TileMesh i can have a notification when zFactor is changed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@peppsac is there a copy function of OBB? what do you think if i make a copy of OBB and modify it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, I don't think you want to build a copy of the OBB.
You should be able to use the OBB.scale attribute to store the zFactor
(ie: scale = (1, 1, zFactor)
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank @peppsac for help, i tried it before but it did not work (i have holes as you can see in image), i think i need to modify OBB max min to adapt bbox for SSE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My reasonning is the following: OBB
is an Object3D
. If you can't get Object3D
properties (like scale) to work then it's a bug in OBB
.
And this bug needs to be fixed (instead of adding another function to OBB
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, there is no bug and i understand what you said but I tried the scale and it did not work, because the problem is Box3D in OBB. Do not update it, the calculation of SSE will be wrong and the results as you can see in the picture above.
Btw, i also do not think the code above is wrong, because in the case there is no geoid, zFactor is always equal to 1, there is no effect on MNT. In geoid case, when zFactor is greater than 1, i saw it runs just fine as you can see in picture below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please dont take into account my last comment, i forgot update OBB, it work now by using OBB.scale and OBB.update .
src/Renderer/LayeredMaterial.js
Outdated
@@ -491,5 +493,9 @@ LayeredMaterial.prototype.setSelected = function setSelected(selected) { | |||
this.uniforms.selected.value = selected; | |||
}; | |||
|
|||
LayeredMaterial.prototype.setLayerZFactor = function setLayerZFactor(zFactor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method useful? It's just a one-line method and you don't use it https://github.com/iTowns/itowns/pull/511/files#diff-caf5227be4f9e2f283d82df32a678e4bL523 so I'd suggest removing it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, i used it in updateLayeredMaterialNodeElevation to deform geoid
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant: it's a one-liner and you only use once.
So I'd prefer you to remove it (and replace it's usage in updateLayeredMaterialNodeElevation
with material.uniforms.zFactor.value = layer.zFactor;
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Just tested:
Thanks! |
c8c79f4
to
fa5920b
Compare
ok, pr is ready to merge |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is improving, thanks.
You still need to fix a few minor issues.
Then you can rebase you commits on master and:
- keep only 2 commits:
- 1 adding the
zFactor
feature - 1 adding an example
- 1 adding the
- make sure your commit wording matches the template from Adopt angular convention for git commit messages #518
src/Core/Prefab/GlobeView.js
Outdated
@@ -107,7 +107,7 @@ export function createGlobeLayer(id, options) { | |||
} | |||
} | |||
|
|||
const wgs84TileLayer = new GeometryLayer(id, options.object3d || new THREE.Group()); | |||
const wgs84TileLayer = new GeometryLayer(id, options.object3d); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you changed this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's changed automatically when i did rebase, i will change it back!
src/Core/Prefab/GlobeView.js
Outdated
@@ -194,6 +194,8 @@ function GlobeView(viewerDiv, coordCarto, options = {}) { | |||
// Setup View | |||
View.call(this, 'EPSG:4978', viewerDiv, options); | |||
|
|||
options.object3d = options.object3d || this.scene; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question: why did you change this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need to modify GlobeView, except for adding the setZFactor
method.
return this.geometry.OBB; | ||
var zFactor = this.material.uniforms.zFactor.value; | ||
var OBB = this.geometry.OBB; | ||
OBB.scale.z = zFactor; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code indentation is still wrong (#511 (comment)).
And please use const
instead of var
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what wrong? it work for me!
@@ -1,4 +1,4 @@ | |||
export { default as Debug } from './Debug'; | |||
export { default as PointCloudDebug } from './PointCloudDebug'; | |||
export { default as createTileDebugUI } from './TileDebug'; | |||
export { default as create3dTilesDebugUI } from './3dTilesDebug'; | |||
export { default as create3dTilesDebugUI } from './3dTilesDebug'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to modify this file.
ok, it's ready to merge now :) |
@qdnguyen Any news on that nice feature? |
no, as i said it's ready to merge! |
@qdnguyen Could you rebase? |
rebased! |
You have some lint problems Plus, could you add the example.html in the example/index.html page with the right screenshot as it's a new feature? |
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of iTowns#511
moved in #1174 |
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of iTowns#511
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of iTowns#511
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of iTowns#511
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of iTowns#511
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of iTowns#511
Changing the `scale` property of an `ElevationLayer` can changed the aspect of the visual, allowing exageration of the elevation of the globe, as in the tiff.html example. This is an up-to-date version of #511
Description
This PR is needed to visualize geoid color and DTM.
The changes were done
Screenshots