Mac only issue with sky rendering

I have attached a short video clip which demonstrates what happens on a MacBook Air with Intel HD 3000 graphics. I don’t see this when running on my Nvidia powered VAIO. Both Chrome and Firefox exhibit this behavior, so it may be a core WebGL issue.

I have disabled ( by commenting out ) SkyBox rendering and used a cyan color for the background. This problem occurs every time map tiles near the horizon have to be rendered, regardless of their source. It appears as if the renderer is trying to clear the background with a black color, but I’m not sure this is the case. I would be happy to get my hands dirty if any of you could point me in the right direction, but I have to tell you that I am GLSL-illiterate :-/

Happy New Year!

Peter

MacIssue.m4v (3.06 MB)

Peter,

If you open the WebGL Report, how many Depth / Stencil Bits are reported? For example, is it [24, 8]? The default near-to-far ratio is setup for a 24-bit depth buffer. If you have 16-bits (common on mobile, but I bet unlikely in your case), the default ratio of 1,000 may be too high. Try changing scene.farToNearRatio to 500 or even lower.

Otherwise, the code to look at is executeCommands in Scene.js. The skybox is drawn towards the top with skyBoxCommand.execute. You may also find the WebGL Inspector useful.

Regards,

Patrick

Here are screenshots from WebGL Report:

I’ll play with the near-to-far ratio and post back later.

Thanks!

Peter

Installing WebGL Inspector in Chrome makes the problem go away. I can reproduce at will with WebGL Inspector disabled, and never with it enabled.

Peter

WebGL Inspector inserts WebGL calls, so it is possible that there is a real bug in Cesium and that WebGL Inspector is covering it up in this case.

Patrick

That’s what I thought. Any ideas about how to chase it? It it possible developers use the debugger all the time and thus never observed Cesium without it?

Peter

Peter,

Many developers run without WebGL Inspector, but I think I know why WebGL Inspector is fixing it. Try changing Line 91 of Scene.js from:

this._clearColorCommand.clearState = context.createClearState({

color : Color.BLACK

});

to

this._clearColorCommand.clearState = context.createClearState({

color : Color.BLACK,
depth : 1.0,

stencil : 0.0

});

If this doesn’t work, I would start trimming down the executeCommands function, e.g., exit right after drawing the sky atmosphere, and see if it still flickers.

Patrick

Got it.

I had changed that section to use my choice of color instead of black, but not completely. Changing it to this fixed it:

this._clearColorCommand = new ClearCommand();

this._clearColorCommand.clearState = context.createClearState({

        //color : Color.BLACK

color : new Color(0.86, 0.925, 1.0, 1.0),

depth: 1.0,

stencil: 0.0

});

this._clearDepthStencilCommand = new ClearCommand();

this._clearDepthStencilCommand.clearState = context.createClearState({

color : new Color(0.86, 0.925, 1.0, 1.0),

depth : 1.0,

stencil : 0.0

});

Of course, this is probably not the right way to specify a different background color but I couldn’t find the right place for it.

Case closed. Thanks a bunch!

Peter

Peter,

I don’t think you need to add the color to _clearDepthStencilCommand. I fixed the flicking and added Scene.background color. Can you please try it?

https://github.com/AnalyticalGraphicsInc/cesium/pull/420

Thanks,

Patrick

I’ll give it a whirl sometime later today. I’m on the terrain branch, is there a chance I’ll get conflicts if I just cherry-pick these commits?

Peter

Peter,

These commits should merge smoothly.

Patrick

I wish … I did it and re-ran ant, but now things are broken.

  1. GET http://localhost:8080/Source/Core/MouseEventType.js 404 (Not Found) dojo.js:1556

  2. GET http://localhost:8080/Source/Core/EventHandler.js 404 (Not Found)

Those files got renamed back when the Camera branch got merged. They’ve been gone for a while now. Try clearing the browser cache, and see if your own code has any references to them that didn’t get renamed (the list of renames is in CHANGES.md).

–Ed.

I was working on the terrain branch. Has it been merged to master yet?

The terrain has those changes, so it sounds like a caching issue. To eliminate all doubt, I merged in master just now anyway.

I don’t see CesiumTerrainProvider anywhere …?

Also, what happened to Camera.lookAt()? Did it move somewhere else?

CesiumTerrainProvider is still in the terrain branch on github so it must be something up with your local repo. Also, you now do camera.controller.lookAt().

hth,

Chris

Correct. The change from camera.lookAt to camera.controller.lookAt also happened when the Camera branch got merged in. It sounds like the code base you’ve got hasn’t been updated since before then. Are you pulling the terrain branch from your own GitHub clone of Cesium, or from ours?

–Ed.

I have been working with a local clone I pulled on December 9th using read-only access to GitHub (git://github.com/AnalyticalGraphicsInc/cesium.git). I checked out the terrain branch, left it alone and started coding. The last commit according to ‘git log’ was on December 6.

Should I be pulling from somewhere else?

Peter