I'm trying to render images of a dome lit from multiple angles in GRASS using the m.nviz.image render plugin.

Whilst the DEM displays nicely in the map display, I'm getting weird fractal patterns present on the rendered image (see shot)

artefacts in rendered image

They seem to be a function of: 1. the rounding of the elevation values of the dome 2. the region resolution at the time of running m.nviz.image 3. the actual resolution of the dome raster map when produced

I've had varied success but would like to know what is causing them and the optimum combination for the cleanest output. I attach my python script for generating a dome DEM and nviz image below

import math

size = 200
res = 0.1
gridres = 10

grass.run_command('g.region',n=size, s=0, e=size, w=0, res=res)

# make centre point vector
grass.write_command('v.in.ascii', input='-', output='centre', \
                  stdin=str(size/2)+'|'+str(size/2), overwrite=True)

# rasterise point file
grass.run_command('v.to.rast', overwrite=True, input='centre', \
                  output='centre_rast', use='cat')

# max no. of buffers
numdiv = float(100)
numdist = float(100)
# no. of buffers required
iterations = float(numdist / numdiv)

# raster buffer distance list creation
buffdistlist = []
currentdist = 0
for dist in range(1, int(numdiv) + 1):
    currentdist = dist * iterations

# generate buffers
bufferedpoint = 'centre_rast_elev_buff'
grass.run_command('r.buffer', overwrite=True, input='centre_rast', \
              output=bufferedpoint, distances=buffdistlist)
# make dome
formula = 'dome = if(isnull({0}),null(),{1} - ({2} - sqrt(({3}*{4}) - ({5}*{6}))))' \
grass.raster.mapcalc(formula, overwrite=True)

grass.run_command('m.nviz.image',elevation_map='dome', color='black',\
                  position='0.5,0.5',height='1200',twist='90', perspective='90', \
                  light_ambient='0', output='test', format = 'tif',\
                  size='4840,4840',resolution_fine='1', mode='fine',\

They’re called Moiré patterns.

They reason they’re happening is the almost equal weighting given to the black rings and the white gaps between them. (I think the technical term is Nyquist limit... this is related to the problem on old TVs where pinstripe suits "moved")

As the white space between rings increases, these patterns should gradually disappear. (Conversely, you could make the white bands thinner than the black)

You may be able to change the resolution, or the spacing of the rings, to avoid these artifacts.

  • Thank you for the info - can suggest a specific solution in terms of the code I posted too? i.e. what would I change the resolution to? – Beeman Oct 6 '17 at 14:25
  • try changing numdiv to something like 50 or 25, that looks as if it should work (running the code in my head, at least), by spacing the rings out – Steven Kay Oct 6 '17 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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