1
\$\begingroup\$

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.

\$\endgroup\$
2
  • \$\begingroup\$ Is the shade of brown or black significant? Or are you treating the map as 2 colour? \$\endgroup\$ Commented Nov 20, 2012 at 21:47
  • \$\begingroup\$ I am treating it as 2-color. \$\endgroup\$ Commented Nov 21, 2012 at 8:23

2 Answers 2

3
\$\begingroup\$

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

\$\endgroup\$
3
  • \$\begingroup\$ 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? \$\endgroup\$ Commented Nov 21, 2012 at 8:30
  • \$\begingroup\$ Unfortunately no. The linked pages are all I know about these algorithms. \$\endgroup\$ Commented Nov 21, 2012 at 9:43
  • 1
    \$\begingroup\$ There's a good collection of .cg shaders, including those two, here: github.com/libretro/common-shaders \$\endgroup\$ Commented Nov 21, 2012 at 19:22
0
\$\begingroup\$

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.

\$\endgroup\$

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.