XPS 13 “Developer Edition” Microphone Fix

It seems the microphone doesn’t work out of the box on the XPS 13 “Developer Edition”. Worse, you’ll actually need to re-compile your kernel to make it work… at least the patches are easy to find thanks to Dell’s “Project Sputnik” leader Barton George:

I used those on the Linux 4.0.2 (stable) kernel, recompiled, installed… and voilà! The microphone works!

Hopefully those fixes will soon be in the kernel main line…

XPS13 “Developer Edition”: Updating the graphics driver

Update: I previously indicated to use the “xorg-edgers” PPA. But it’s far too brutal since it will update a lot of other things (such as the X server) and it might just break. I now recommend using the Oibaf PPA to update only the drivers.

Following my article about a few “out of the box” fixes for the XPS 13 “Developer Edition”, I wanted to upgrade the Intel graphics driver and Mesa. Indeed, I noticed some issues with 3D apps:

  • most games were incredibly slow, or at least a lot slower than what ohter got with the same hardware on Windows (and OpenGL performance are supposed to be on-par or close – if not better – on Linux now);
  • WebGL was not available neither on Chromium nor Firefox, even through their latest stable version.

The pre-installed version of Mesa (10.1.3) is pretty old (May 2014). You can upgrade it to the latest version along with the latest Intel drivers using the “xorg-edgers” PPA the Oibaf “Updated and Optimized Open Graphics Drivers” PPA.

Updating the i915 drivers and Mesa should give you a very important performance boost on 3D apps. I noticed “Counter Strike: Global Offensive” went from barely playable to completely smooth. I also noticed WebGL is now properly available on both Firefox and Chrome.

XPS13 Developer Edition Fixes

I recently bought a brand new XPS 13 “Developer Edition” that I want to use as my main machine for development. I’m very happy to see Dell building machines fit for Linux. The Dell XPS 13 has many very very good reviews. And it’s even better when it comes with Ubuntu pre-installed with all the good drivers (or close…).

dell xps13

It’s too soon to draw any conclusions yet: I’ve been using the computer for only 1 day. Still, I must say it works overall very good and I’m satisfied so far (except for the one or two quirks listed below). Especially by the gorgeous incredible “infinity display”, which packs a 3200×1800 touchscreen in a 13′” screen that fits in 11″ case. The XPS 13 “Developer Edition” comes with Ubuntu pre-installed, and it also comes with a “factory reset” feature you come to expect from a brand such as Dell. So if you brick your Ubuntu install, you can easily reset it without much hassle.

The only problem I encountered is some trackpad freezes that happen to be very annoying. It gives you the feeling the rig is not responsive when it’s actually pretty fast. To fix this, I applied this kernel patch:

You can safely apply this patch to the 3.13 Linux kernel that comes with the XPS 13/Ubuntu 14.04 mint install. But as I had to re-compile the kernel, I wanted to try the recently released stable Linux 4.0.2 kernel.

If you do so, you’ll also need to patch the Broadcom drivers. And because they’re not compatible with Linux 4.0 kernels, you’ll have to apply a little patch: bcmwl driver fixed for Linux 4.0 kernel.

After upgrading to Linux 4.0, I noticed the overall computer feels a lot faster and responsive. I don’t know why but it just does. It might be related to the fact the old 3.13 kernel was not using the new Intel P-state CPU governor.

Last, I also encountered kernel panic issues at three occasions:

  1. When changing access-points or simply disconnecting the Wi-Fi. This fix seams to do the trick: fix for the bcmwl kernel panic/crash.
  2. When suspending, but I guess it’s related to the Wi-Fi issue.
  3. When running a VirtualBox VM. I had to use VirtualBox 5.0 beta and patch Vagrant to support it.

Update: You can get more out of the XPS13 battery using the following script:

3D Matrices Update Optimization

4×4 matrices are the heart of any 3D engine as far as math is concerned. And in any engine, how those matrices are computed and made available through the API are two critical points regarding both performances and ease of development. Minko was quite generous regarding the second point, making it easy and simple to access and watch local to world (and world to local) matrices on any scene node. Yet, the update strategy of those matrices was.. naïve, to say the least.


There is a new 3D transforms API available in the dev branch that provides a 50000% 25000% boost on scene nodes’ matrices update in the best cases, making it possible to display 50x 25x more animated objects. You can read more about the changes on Answers.

Continue reading 3D Matrices Update Optimization

Optimized AABB-Ray Intersection

As I am working on ray casting for Minko 2, I need to test the intersection between an axis aligned bounding box (AABB) and a ray. In order to do this, I implemented the slab method. Here is how it looks in AS3:

You can find this method in the latest version of the BoundingBox class on github. If you have questions/suggestions, you can post in the comments or on Aerys Answers.

Minko 1.2: Easier Post-Processing Effects

I’ve just pushed an update on Minko’s GitHub repository. It is tagged as version 1.3 1.2. This new version introduces new helper classes to make it easier to write post-processing effects.

The New Simplified Post-Processing API

Writing a single pass post-processing effect has never been easier, here is how to write a simple greyscale post-processing shader (go to the end of the post to see it in action):

And here is another example to create a “vignettage” effect (it darkens the corners of the viewport):

And then, where you initialize the Viewport:

As you can see, writing a single pass post-processing shader is really simple:

  1. Extend the PostProcessingActionScriptShader class.
  2. Override the getFinalColor() method to implement your shader.
  3. Set the Viewport.postProcessingEffect property to a new SinglePassPostProcessingEffect using your shader.

Multipass Post-Processing

If you need to write multipass post-processing effects, it’s just as simple as when you work with a rendering effect: implement the IEffect interface and create an IEffectPass class for each pass or reuse the provided SinglePassEffect class (because a single pass effect is… a single pass).

In Blacksun, we use this technique to create the HDR Bloom effect that uses 5 passes:

Live demo right after the jump…

How to: handle C++ exceptions with Adobe Alchemy

Alchemy is a great project that enables C++ code to be transformed to ActionScript 3.0 bytecode. But some of the C++ features are not available. Exceptions handling is one of them. It is a big issue because any decent C++ project uses exceptions.

Exception objects are actually properly created and raised. But try/catch blocks have no effect. As far as synchronous Alchemy functions are concerned, this causes an uncatchable exception to be raised when the C++ methods or any sub-routine raises an exception. Even the new global error handler can not catch those exceptions. When using asynchronous Alchemy functions, it is even worse: the main thread crashes and your application exits immediatly.

Sample code right after the jump…

Google Maps 3D Overlay

The Flash Google Maps API offers what they call a 3D map. It’s nothing more than a component that enables a perspective view of a classic 2D map with the associated controls. Here is how it works:

  1. The 3D view is engine independant and uses Flash 10 3D maths and “drawTriangles” method if available
  2. The API provides everything one needs to integrate 3D graphics as an overlay using the library of its choice
  3. It works just the same as the good old 2D Google Maps API

The first point is very important. It ensures the library is lightweight and does not include any third party software you wouldn’t want to use.

The second is what makes the magic possible: the API exposes the viewport and camera data and provides methods to convert latitude/longitude into 3D world coordinates. With a little math and a few hours of debugging it is then easy to wrap it with the 3D engine of your choice.

The Experiment

You can use CTRL + mouse drag or SHIFT + mouse drag to look around.

The Code

You might want to read the official Google Maps Flash API documentation first, including the dedicated 3D maps section.

The Viewport

The Google Maps API provides the viewport width and height and the focal length. I use the field-of-view instead of the focal length but there is a simple formula to convert from one to the other:

Another issue is to find proper values for the near and far clipping planes. I chose 0.000001 for the near plane and 0.2 for the far plane. Those values are extremely low and might cause floating point inconsistencies. The best thing to do would be to scale the whole scene to be able to use reasonable clipping values. Maybe for a later version! This problem does not seem to affect the experiment though…
The following function presents how to get the relevant viewport values from the Google Maps API:

The Camera

The following function retrieves the camera position and look-at vectors from the Google Maps API:

I prefer computing the eye position and look-at vectors and using them to create the transform matrix rather than just creating the matrix directly. This way, you can expose the actual camera parameters (even if in read-only) and still use the transform matrix to do the math.

The Scene

The last step is to make it possible to position 3D objects on the map. What you actually want to do is to be able to add objects specifying their latitude/longitude instead of their actual (x, y, z) coordinates. Then again, the Google Maps API does it just fine:

Know Issues

As said previously, the extremely low far and near clipping plane values might introduce float point inconsistencies. Therefore, some clipping glitches might appear and frustum culling is performed only on the far clipping plane.


Credits goes to Marc Fahmi for the low-polygon 3D model of the Eiffel Tower.

Frustum Culling in Flash 10

Update: corrected a few glitches in the bounding sphere creation routine.

Optimization is always important. But when it comes to 3D for the Flash Platform, it’s an everyday battle. The first ideas that come to mind are to avoid:

  1. redrawing the same regions : each pixel value must be set once and only once
  2. rendering invisible objects : objects that are out of sight still take a lot of CPU horsepower

While Flash takes care of the first one in its very renderer, the second one is not handled. But that is something we can easily address!

The Technic

The method is called “frustum culling”. The big picture is that every mesh is approximated using a bounding volume (typically a sphere or a box). If the bounding volume is visible, the corresponding mesh is rendered. The two following pictures show the frustum culling caught in action:

The mesh is visible
The mesh is visible: TPS counter indicates 18900 triangles per seconds
Frustum culling in action (TPS counter indicates 0!)
The mesh is out of sight: frustum culling is acting and TPS counter indicates 0!

Code snippets and a live experiment right after the jump!

Edit XML Namespaces with sed

Even if you are a high level programing language user, you sometimes have to use some good old tools to gain some productivity. Sed is one of those tools that might come to be handy.

I recently needed to change the xmlns attribute of a lot of XML/XSL files and doing it file by file would have been a real mess. So I wrote this little piece of script shell:

You can run the script with the following command line:

Where :

  • myns is the namespace name (html, xsl, xhtml, etc…)
  • http://my.namespace.uri is the URI of the namespace
  • my_file.xml is the file to edit