I have an android tablet which HeightReference doesn't work.
The screenshots are the result of showing this page.
The entities seems to be underground. The second screenshot is a view of under the surface.
Are there any possible reason why the entities don't rise to the ground?
This issue is causing in Android 8 and 9 in some devices even in browser or in my developing app.
These devices also have the problem which I mentioned in my last post. https://groups.google.com/forum/#!topic/cesium-dev/rTB9VanshCA
There may be no relationship between these issues but I'm curious that only particular devices causes too much problems.
I’m not able to reproduce this on my Pixel 3 Android phone. I think what happens here is that the terrain heights are sampled, and then stored in a texture as floating point numbers to be sent to the GPU.
Can you provide the output you get from https://webglreport.com/ on these devices? Specifically I’m looking for the float precision, if it might be too low to support this. Also, what devices have you encountered this issue in?
Here are my devices that have problems.
HUAWEI MediaPad M5 (Android 9)
HUAWEI MediaPad T5 (Android 8)
The screenshots of my last post was taken by MediaPad M5.
This new screenshot I attached is the web page you required. If you also need to see the WebGL 2 report please tell me, I will add them too.
This screenshot is MediaPad M5 but the report of MediaPad T5 was also the same.
Thanks for the additional information. It’s a little hard to track down since I’ve been unable to recreate this on any of the devices I have, but looking at the original PR that added support for this (https://github.com/AnalyticalGraphicsInc/cesium/pull/6717) I can see that the functionality is mostly coming from this TerrainOffsetProperty class:
Specifically, it looks like it uses globe.getHeight to figure out the height at the surface,and passes that down to the entities. I’m curious if you call this function at various locations if you get 0. Here’s a snippet that will print out the height value computed from globe.getHeight and from sampleTerrainMostDetailed:
var handler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);
handler.setInputAction(function(result) {
var position3D = viewer.scene.pickPosition(result.position);
var cartographic = Cesium.Cartographic.fromCartesian(position3D);
The numbers you get should be very close, and get closer together as the terrain loads in to the highest resolution. Are you getting similar values here?
I looked at my screenshot again and I noticed that the normals looks flipped. Isn't the surface inside the polygons rendered?
If the normals are flipped, are there any possibilities the polygon has extruded towards the direction the normal is facing?
And are there any reason why the normals are flipped?
I've done a little test.
When I made the polygons without using 'HeightReference.RELATIVE_TO_GROUND', the result was correct.
Only when I was using 'HeightReference.RELATIVE_TO_GROUND' for heightReference or extrudedHeightReference, the results weren't correct.
Thanks for the additional debugging here. It does sound plausible that this issue is not at all related to heights but more of the normals. I can’t believe i didn’t notice that initially in your first screenshot!
This may be a little hard to track down. The closest bug I can imagine is this distorted vertices on iOS which was happening due to a shader bug:
When I don't use 'RELATIVE_TO_GROUND' the normals and heights are correct.
The Sandcastle you suggested works fine. The extruded States are same to my PC and other devices.
But I can show you another example that doesn't work correct.
The attachments are the results of this Sandcastle.
The middle red ellipse doesn't appear correct. The common part to the first example is that they stick to the surface. I believe the root problem is the same.
I didn't mentioned this example because they are a little complicated.
Because in one device they don't show up at all. But in another device it appears in a particular angle and zoom.
The screenshots are taken in the same device. The first one is at the default angle. The second one is arranged to let the ellipse appear.
The top and bottom of the ellipse is cropped. It looks like there's a rectangle before the view, and as you change the view the crop area also changes.
Thanks for the additional information here. I think we should open a GitHub issue here, perhaps others experiencing in the community this problem can shed some light. Since I haven’t been able to recreate this myself, can you tell me the names of the devices you’ve tested on that have the issue? Feel free to post that here or in a new GitHub issue (https://github.com/AnalyticalGraphicsInc/cesium) and link it from here.