Geiger counter data logging in C#

I got my hands on a Geiger counter the other day. It’s a GMC-300E, they’re affordable, and the build quality is decent.

The device has an unlocked serial interface via USB, and the manufacturer has published the protocol documentation. This allows you to download the logged data and read life data from the Geiger-Müller tube, and with the 320 model also from the temperature sensor and gyroscope.

This is a quick guide on how to access the GMC-300E serial interface in C#.

Continue reading Continue reading

in dev by Comments Off on Geiger counter data logging in C#

Dev Notes: Seamless LODs, pt. 2 – Normal interpolation

It’s been a while since the last post in this series, in which I described how to gradually blend geometric levels of detail. Now that we have seamless geometry, it’s time to compute the geometry normals, so we can tell in which way the terrain is oriented relative to a light source, and calculate the lightness.

Now, this whole article is just a workaround for a very basic problem – a problem that might not even exist if it wasn’t for the strange ways the OpenGL API has grown and mutated over the years. Continue reading Continue reading

Simplicity and software

computerI’m trying to make the things I program simpler. This is true for the graphics stuff I’ve been doing but even more so for UI applications.

Not too long ago, I firmly believed in the mantra: the more settings, the more ways to tweak something, the better. This was important in a world of slow computers, crappy operating systems and overall shittyness. Everything is broken anyway, so if all of the internal workings are exposed, we can at least try and work around it.

I also remember reinstalling my operating system at least once every three months, with ISOs generated with a special tool that allowed me to strip out some of the garbage that came with the vanilla install. Getting a computer to run properly was mostly an exercise of fighting everything from the hardware layer up to the software itself. Hence, the “more settings are better” thing. Continue reading Continue reading

Dev Notes: Seamless LODs, pt. 1

In my previous articles, I’ve often mentioned Levels of Detail (LOD). In a nutshell, it means that things that are further away get rendered with a lower amount of detail. Since there is only limited memory and computational power available, it makes sense to put more effort into rendering things that are closer to the camera.

When rendering terrain, the typical approach is to divide the total area into multiple layers or rings that are centered on the camera position. Each layer will be rendered with about the same detail “count”. That means that they all have the same amount of detail relative to their area, but the bigger, outer layers will have a lower absolute amount of detail. These rings are called Levels of Detail. Continue reading Continue reading

Binary file download in C# .Net with speed limiter

Downloading files over HTTP is easy in C#/.Net – in fact, it’s as easy as writing a single line of code:

new WebClient().DownloadFile("http://your.url", "saveAs_Filename.jpg");

However, there’s no .Net library function that allows you to limit the download speed. Here’s how you can write your own.

What you’ll need is at its core a simple TCP client. It will connect to a HTTP server, send a GET command, then receive the reply packets from the server until the server stops sending. This allows us to add speed measurement and speed limiting.
Continue reading Continue reading

Procedural Planet in WebGL and Three.js

Holger Ludvigsen – Procedural Planet in WebGL and Three.js (part one, part two)

The articles discuss the concepts of cube to sphere transformation by normalizing the vertices, perlin noise, bump mapping and using the GPU to increase rendering speed. If you’ve been following my recent articles, this might be interesting to you as well.

Click “continue reading” for an embedded live demo. Continue reading Continue reading

Dev notes: Creating Worlds, pt. 3

In the last part we left off with a quad that can be subdivided as needed, so there will always be a sufficient level of detail at the spot where the camera is positioned, and depending on how high above the terrain the camera is.

The next step is to create six quads like this and assemble them into a cube. And finally, extrude the quads outwards so the cube will turn into a sphere. Continue reading Continue reading

Dev notes: Creating Worlds, pt. 2

In the first part I explained the difference between an “endless plane” flat procedural world and a planet-type one.

We’ll start with a spherical body with uniform surface details. As the camera gets closer to the surface, more details appear, until we’ve “landed” on the planet, at which point things should look about the same as with a flat world.

There are two important ideas to this. One, the spherical body will be based on an extruded cube, which means that the “one threedimensional body” challenge will actually be a “six slightly curved planes” challenge, and thus much easier to solve. Continue reading Continue reading

Dev notes: Creating Worlds, pt. 1

Ah, procedural landscapes! So much fun. And easy to program.

You start with a chessboard mesh and place it under the camera. The height of each mesh point is generated by a fractal noise algorithm (such as Perlin).

It would be great if you could just increase the resolution of the mesh until you can’t make out the single polygons anymore, but resources are limited!

So you implement Level of Detail (LOD) and increase the mesh resolution only in the middle, where the camera is. Now the outer parts of the mesh look rather crude, but it doesn’t matter, because they’re far away from the camera – and the closer parts of the mesh look nice and detailed. Continue reading Continue reading

Dev notes: Getting it out the door

It’s been busy lately, and I’ve been able to wrap up a big project: Doki is now available for download from the Windows Phone store.

The total development time was three months for the beta version, and another month for polishing and waiting for the Feedly API keys. I decided to shoot for an early MVP release and to continue with adding lower priority features. Continue reading Continue reading

Dev notes: About DLLs

Note: there are no deeper insights in this article – just some rambling.

I have a confession to make. I never really understood DLLs. They were some sort of software blackbox for me, something that dawdles about in the install folders of proper software products, like minions waiting to be summoned. I knew that they contain executable code. But the stench of “unnecessary complexity” always kept me from actually looking up how they work and what they are good for. Continue reading Continue reading

The Liberation of Dotnet Nation

I vaguely remember musing about the implications of the open sourced .Net compiler half a year ago. Considering the news of late, it’s small fries in retrospect.

In case you’ve been living under a rock, here’s what Microsoft did – they…

  • open sourced the full server-side .NET stack (including ASP),
  • started porting .Net to Linux and Mac OS,
  • and released a full-featured version of Visual Studio for free

Continue reading Continue reading

Procedural Planet Generation

Andy Gainey wrote an article about procedural planet generation, discussing many interesting points:

– Generating a sphere by subdividing a primitive geometrical body
– Not using Perlin noise for elevation, but a plate tectonic model instead
– Climate systems
– Vegetation and Biomes

When it isn’t down due to heavy traffic, you can find the article here.

Fast times with Windows Phone, part 3

The one thing developers hate like nothing else is to get interrupted in their workflow. While this usually happens in the form of somebody barging into their dev cave, a flawed development tool or terrible APIs can be just as frustrating. You’ll never get any work done if you have to force yourself to open the IDE (I’m looking at you, Eclipse).

How does the Windows Phone development process hold up? I just published my first app on the Windows Phone Store, in order to find out if and how much everything sucks. Spoiler: Turns out it’s actually ok. Continue reading Continue reading

Fast times with Windows Phone, part one

A few weeks ago I felt like doing something silly, so I bought a Nokia Lumia 530, because that’s the cheapest windows phone available. Prior to this I had poked around in Visual Studio 2013 and the WP emulator for a bit.

I wanted to find out if somebody who’s a C#/.Net dev at day is able to release something on the WP app store without getting stuck in technobureaucratic madness (spoiler: yup). Continue reading Continue reading

Dev notes: About shading

Shading is super important in 3D computer graphics because it helps you understand what form an object has and where it is positioned in space. Basically, it helps our brain fill in the missing depth information.

It’s usually a two step process. First you compute how much light the faces of an object are receiving. This depends on their orientation towards the light source. If you hold a piece of cardboard in front of a lightbulb, the front side will be illuminated and the backside will be dark. If you turn it sideways, both sides will be somewhat illuminated.
Continue reading Continue reading