Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a game where the map is generated with Perlin Noise, but on the CPU. I am generating some perlin noise onto a texture with a small size, and then I stretch it out to the whole screen to simulate a map.

The reason for the CPU generating the noise is that I want it to look the same on all devices.

Now, here's the end-result.

enter image description here

Please ignore the bullets and the explosion on the picture. What matters is the background (the black/gray pixels) and the ground (the brown-ish pixels). They are rendered to the same texture through perlin noise.

However, this doesn't look very pretty. So I was wondering if it would be possible to double the amount of pixels using a shader, and rounding edges at the same time? In other words, improve the DPI.

I'm using SharpDX with DirectX 11, through its toolkit feature. But any help that'll lead me in the right direction (for instance through HLSL) would be a great help.

Thanks in advance.

share|improve this question
Is the shade of brown or black significant? Or are you treating the map as 2 colour? – tugs Nov 20 '12 at 21:47
I am treating it as 2-color. – Mathias Lykkegaard Lorenzen Nov 21 '12 at 8:23
up vote 3 down vote accepted

You could try HQx or xBR filters. They are used e.g. in NES / SNES emulators to upscale pixel graphics.

share|improve this answer
The xBR shader is for DirectX 9, and the HQx link doesn't give me enough information to implement it properly. How can I convert it into a DirectX 11 capable shader? Can you link me to other resources? – Mathias Lykkegaard Lorenzen Nov 21 '12 at 8:30
Unfortunately no. The linked pages are all I know about these algorithms. – msell Nov 21 '12 at 9:43
There's a good collection of .cg shaders, including those two, here: – tugs Nov 21 '12 at 19:22

If you're using a monochrome noise texture, with a color ramp in the shader to apply the brown-red and blue-black colors to different ranges of noise, then you could probably get some interesting results by using a second copy of the noise texture (or a different noise texture) scaled down and added to the first. It would be effectively a detail map. Adding the two noise values together before applying the color ramp should have the effect of breaking up the pixellated features and creating an irregular coastline. You'd probably also want to turn on bilinear filtering for the noise textures, as you're using nearest-neighbor now.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.