10
$\begingroup$

Whenever I use a Displace Modifier, it looks like it does no interpolation of my height map.

Aliased

Green is how it should be, Red how it is. Notice how the mesh is dense. The texture I use as height-map is extremely smooth, it should produce a really nice mesh instead of this "aliasing effect".

I tried to set the number of vertices to the resolution of the height-map (Loop-cut x time on x-axis and y time on y-axis for a x*y height-map) but it produces the same strange mesh.

How can I get a good looking and precise displacement, independently of the mesh resolution ?

Solutions without the displacement modifier are accepted if they exist, but I must use the full resolution of my height-map as I must produce a precise work.

To clarify more what I'm looking for, here, nearly how it should looks like (not all the height-map points are used): Correct

I made some further testing. Here a picture with 2 lines. Top left to down right is "anti-aliased" the other is not.

Height-map to test

I tested it on a 512*512 vertices plane (510 Loop-cuts on x and 510 on y) Here is the result : enter image description here Strange enough, the line which is anti-aliased has more aliasing with the displacement modifier. Problem is, LIDAR datas are "antialiased" (data from real world, like a photo). Setting the colour space to linear improves the quality. In texture panel, a filter size above 2 creates nice but wrong geometry.

$\endgroup$
1
  • $\begingroup$ Edited with some drawing :) $\endgroup$
    – matali
    Jul 11, 2013 at 16:23

4 Answers 4

6
$\begingroup$

Since the displacement modifier uses textures, you can make use of texture sampling options which apply with the example you give.

In the texture's Image Sampling panel, make sure Interpolation is enabled, and increase the filter size (values between [1.5 ... 2.0] give quite smooth result, 3.0 and above are smooth but you loose definition).

You may also want to change the color-space of the image between linear/srgb.

$\endgroup$
8
  • $\begingroup$ It seems to be the solution, however, after many tries with different bit depths, different paint programs and 3D Packages to produces meshes out of the heigh-maps, etc... I wasn't able to get a result that I'm sure is right. For example, img2stl gives a very different result. So I have at the moment nothing to compare Blender's result. Problem is I get that aliasing effect until I set the filter size to 7-8, which I'm not sure keeps all the information intact. They all do correct mapping from grey value to height value, but the artifacts are different in each package. Still investigating... $\endgroup$
    – matali
    Jul 13, 2013 at 15:10
  • $\begingroup$ I Have a GIS Programm at school that creates TIN (3D Meshes) out of geotiffs. I'll try to compare results with it as it should give the most exact results. $\endgroup$
    – matali
    Jul 13, 2013 at 15:13
  • $\begingroup$ @matali, I think the nature of this problem is that you notice pixelation when the surface makes a 3D shape more then your do as an image. also added note about color space. $\endgroup$
    – ideasman42
    Jul 13, 2013 at 16:53
  • $\begingroup$ Setting to "Linear" improves the quality, thanks. I added an example image in the question for testing. I hope it doesn't get a lossy compression. My tests gives : a filter size under 4 still show aliasing effects. But above 2, the line starts to get too large (so the 3D Model is not exact anymore). $\endgroup$
    – matali
    Jul 14, 2013 at 9:49
  • $\begingroup$ @matali, quite sure the artifacts are correct, at least in that - if the resolution is too low and there is a sharp variation you are going to get artifacts. So unless you can find evidence otherwise (in that case it could be a bug), I would suggest to avoid by using higher resolution images. $\endgroup$
    – ideasman42
    Jul 14, 2013 at 10:18
2
$\begingroup$

It looks like part of the problem is that you're using both a subsurf and a displace modifier.

If you're going for accuracy, make sure your subsurf is ABOVE the displace. This will give you more polygons to work with (and can be handy for controlling the number of polys you have to render in the viewport, without affecting the final render), but it will not smooth the polygons at all.

If you're looking for "nice" (smooth) results, make sure that your subsurf is BELOW the displace modifier. Just be aware that the subsurf will smooth things without regard to accuracy. Any high-frequency data (sharp peaks, deep troughs, saddles, cliffs, etc.) will be essentially lost (smoothed over).

Last caveat, as you've apparently discovered, if your mesh has enough polygons, then your polys will eventually be more dense than the pixels of your texture, in which case you're going to get a VERY accurate recreation of the texture... down to every aliased pixel.

I've done some of this kind of terrain work before and the unfortunate reality is that the most accurate results often don't look as pretty as we want.

Good luck!

$\endgroup$
1
  • $\begingroup$ Hi Matt, thanks for your answer, my subsurf is above the displace already. Problem are flat areas, they prevent the interpolation algorithm to work properly. On a line with height 1; 0.9; 0.8;...;0.1;0 interpolation will give 1;0.95;0.9;0.85;...;0.15;0.10;0.05;0. But if the bit depth is not precise enough, it will be stored in heightmap as 1; 1; 1;...;0;0;0 and then interpolated to 1;1;1;0,5;0;0;0 giving that aliasing. I tried to draw heightcurves for every level the bitdepth allow and then interpolate from there. But for many kms long areas with cm precision, it's just too much data. $\endgroup$
    – matali
    Dec 18, 2013 at 18:38
1
$\begingroup$

Smooth shading

For a smooth transition between faces you need to enable smooth shading:

Flat shading enter image description here

The easiest way is to set an entire object as smooth or faceted by selecting a mesh object, and in Object mode, click Smooth in the Tool Shelf. This button does not stay pressed; it forces the assignment of the “smoothing” attribute to each face in the mesh, including when you add or delete geometry.

Mesh smoothing

To smooth the mesh use the Smooth modifier:

This modifier smooths a mesh by flattening the angles between adjacent faces in it, just like Smooth in the Editing context. So it smooths without subdividing the mesh – the number of vertices remains the same.

$\endgroup$
7
  • $\begingroup$ Tried it with different parameters, factors superior to 2 gives a chaos of wires (bug ?), but even with factor at 2 and repeat at 40, I still have traces of aliasing/pixels. Can I attach a file for people to try and see the problem ? $\endgroup$
    – matali
    Jul 11, 2013 at 18:39
  • $\begingroup$ @matali yes, add it to the question but make it as small as possible. $\endgroup$
    – iKlsR
    Jul 11, 2013 at 19:44
  • $\begingroup$ Using the smooth modifier is a work-around and not solving the real problem, though It seems to me this question may be better as a bug report. $\endgroup$
    – ideasman42
    Jul 12, 2013 at 2:05
  • $\begingroup$ @ideasman42, your assuming the mesh is displaced by an image. This modifier also provides much more control than just the Image Sampling setting. $\endgroup$
    – Aldrik
    Jul 12, 2013 at 13:16
  • $\begingroup$ @Aldrik, right, however the questioner specifically asks about pixel interpolation. $\endgroup$
    – ideasman42
    Jul 12, 2013 at 15:03
0
$\begingroup$

In my experience, displacement accuracy is usually related to one of two things: mesh resolution, and the bit depth of the texture image.

Can you add a multires modifier before the displacement modifier to up the mesh resolution?

Can you bring in the texture with a higher bit depth (16/32) so there is a finer gradation between the height levels? A 32 exr file will obviously give you more height detail for displacement, but it all depends on your source file for the texture.

Barring that, it might be a bug as Campbell has suggested.

$\endgroup$
1
  • $\begingroup$ I tried with a 16 bit/channel texture, it doesn't help. The problem comes actually when the mesh resolution is near or superior to the texture resolution. $\endgroup$
    – matali
    Jul 13, 2013 at 15:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .