18 Mar 2013

Updated Nebula3/emscripten Demos

Update 3: I replaced SQLite with a TableData addon, this reduces the map-viewer-demo size from 8 MB down to 5 MB (uncompressed), and reduces startup time dramatically.

Update 2: Demos should now properly work on all WebGL configs again (which support DXT textures to be exact). I've been using more then 254 vertex shader uniforms, and at least ANGLE restrict this number even if the GPU could actually handle a lot more).

Update: Demos don't work on Windows and some other configs since one of the new GLSL shaders doesn't compile. Tested configs are: OSX 10.7.5 with GeForce 9400M, Intel HD3000, HD4000 and Radeon HD 6770M. Fix is coming later today.

Finally a new demo update! If you're a Chrome user, please be aware that you need to run these demos in the very latest Chrome Canary (Version 27.0.1444.3 canary) since this contains a bugfix in the V8 Javascript engine (details are here: https://code.google.com/p/chromium/issues/detail?id=177883). This bug was also the reason why I held back updates for so long, I couldn't overwrite the version which reproduces this bug, but I also didn't feel like setting up yet another AppEngine project.

Updated demos are here: http://n3emscripten.appspot.com

The DSO map viewer demo is now much closer to the actual map renderer of the Drakensang Online client:


The ground-decals system has been moved over which helps a lot in hiding the tiling structure of the level. The rendering pipeline now includes posteffects like bloom and color-balancing. You're now controlling a "player character", and I added a few more "NPCs" to the map in order to check performance with a couple of characters on screen.

All demos now come in 2 flavours: "regular" and "asm.js". 

ASM.JS is a Mozilla project to define a small subset of Javascript which can be exceptionally well optimized. More about that here: http://asmjs.org/

And I identified the long pause at the start of the map viewer demo, originally I thought this would be caused by generating the collision mesh, which is built at startup from tens-of-thousands of very small mesh fragments, but surprisingly this is extremely fast. The pause is actually caused by parsing the structure of an SQLite database file and reading many small items from the database. Replacing this with a more efficient "table data" subsystem is the next thing on my weekend todo list. The SQLite stuff is really a left-over from the single-player Drakensangs where the world-state was loaded from and written back to SQLite database files.

That's it for today!

5 comments:

Chad Austin said...

For me, they all fail with the following message. Both Chrome and Firefox. Macbook Pro, 2010:

SysFunc::Setup() called!
DBG: --- PhasedApplication::OnInitial()
EMSCHttpVirtualFileSystem::Setup(): host addr: ''
EMSCFileSystem::Setup() called (4 workers)
PhasedApplication::AddPreloadFile(export:tables/gfxskintags.bin)
PhasedApplication::AddPreloadFile(sysmsh:system/placeholder_s_0.nvx2)
PhasedApplication::AddPreloadFile(systex:system/placeholder.dds)
PhasedApplication::AddPreloadFile(systex:system/nobump.dds)
PhasedApplication::AddPreloadFile(systex:system/black.dds)
PhasedApplication::AddPreloadFile(mdl:system/placeholder.n3)
--- PhasedApplication::OnSetupPreloadQueue()
EMSCDisplayCore::Open(): width=900, height=452
GL_SUBPIXEL_BITS: 4
GL_MAX_TEXTURE_SIZE: 8192
GL_MAX_CUBE_MAP_TEXTURE_SIZE: 8192
GL_MAX_VIEWPORT_DIMS: 8192,8192
GL_SAMPLE_BUFFERS: 1
GL_SAMPLES: 4
GL_NUM_COMPRESSED_TEXTURE_FORMATS: 0
GL_NUM_SHADER_BINARY_FORMATS: 0
GL_MAX_VERTEX_ATTRIBS: 16
GL_MAX_VERTEX_UNIFORM_VECTORS: 254
GL_MAX_VARYING_VECTORS: 10
GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: 20
GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: 4
GL_MAX_TEXTURE_IMAGE_UNITS: 16
GL_MAX_FRAGMENT_UNIFORM_VECTORS: 221
GL_MAX_RENDERBUFFER_SIZE: 8192
GL_RED_BITS: 8
GL_GREEN_BITS: 8
GL_BLUE_BITS: 8
GL_ALPHA_BITS: 0
GL_DEPTH_BITS: 24
GL_STENCIL_BITS: 0
GL_RENDERER: Mozilla
GL_SHADING_LANGUAGE_VERSION: OpenGL ES GLSL 1.00 (WebGL)
GL_VENDOR: Mozilla
GL_VERSION: WebGL 1.0
GL_EXTENSIONS:
OES_texture_float
OES_standard_derivatives
EXT_texture_filter_anisotropic
MOZ_WEBGL_lose_context
MOZ_WEBGL_compressed_texture_s3tc
N3 ERROR: *** ERROR ***
Application: N3 DSO CharacterViewer Test App
Error: GLESShaderCompiler: failed to compile shader 'decal_instancing'!

--- CALLSTACK BACKTRACE NOT IMPLEMENTED ON THIS PLATFORM

Andre Weissflog said...

Yep, just noticed this on Windows as well, one of the new shaders doesn't compile. Strangely it works on several OSX configs I tested (Intel HD3000, HD4000, Radeon6550HD and GForce 9400M). I'll try to fix the problem later this day.

eRiC Werner said...

So does the N3 Web-interface already feature a model viewer? ;D

And how far do you think are you away from Drakensang running without JNI in the browser?

Andre Weissflog said...

Full DSO client is a bit tricky right now, not because of JS performance or WebGL, but because audio and networking are not very standardized yet (audio tag vs WebAudio, and WebSockets vs WebRTC vs CU-RTC). But I'm not giving up hope :)

Jugin said...

Flog, can you share PhasedApplication class sources?
Thanx in advance.