# Reducing artificial rings in mean curvature of mesh

Computer Graphics Asked on August 27, 2021

I have an isosurface/mesh (generated via marching cubes) of a micro-CT scan. Originally the surface looks very noisy, which becomes prevalent when the mean curvature is visualized: To reduce the noise I’ve applied Gaussian smoothing to the imagedata and regenerated the mesh. This time, artificial looking rings appear: I would like to reduce these circles/rings/terracing artifacts to obtain a more smooth distribution of the curvature values.

I was wondering if anybody would know the name of this problem since I’m struggling to find anything similar online. All help is appreciated!

This is just an educated guess, but the artifacts in your visualization of the curvature values reminded me of Moiré patterns. The images in the Wikipedia article don't show circle patterns like the ones you are observing, but I have seen similar patterns before when I tried to visualize highly oscillating functions. (Edit: The function you are visualizing, i.e. the curvature, is likely not oscillating quickly. However, the following example still illustrates that it may not only be the discretization or mesh generation algorithm that is problematic, but also the computation of the curvature.)

For example, if you try to visualize the function $$f(x,y) = |cos((x^2+y^2)^2)|$$ for $$x$$ and $$y$$ ranging from $$-3.3$$ to $$3.3$$ on a grid of $$256times 256$$ pixels, what you get is the following image: The Moiré patterns appear in this image since the function $$f$$ is only evaluated at a single point (x,y) for every pixel, although each pixel covers not just a single point but an area. A better visualization of the function $$f$$ would involve integrating over the corresponding area for each pixel, which would result in a uniform gray color near the image boundaries reduces the Moiré patterns.

My guess is that there is something similar happening in your situation. As for solving your problem, this essentially means that the curvature is computed in an erroneous way if the discretization is too coarse. So you could either try to improve the algorithm that is used for the computation of the curvature or simply use a finer discretization. Unless, of course, if the rings really are a feature of your surface, in which case they will not disappear as lightxbulb pointed out.

In case you are interested, I have attached the C++ code that I used to generate the above image. Note that if you increase X and Y while keeping lX and lY constant, the discretization is refined and the Moiré patterns will disappear.

#include <fstream>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

void WriteGrayscalePPM(const std::string& file, const std::vector<unsigned char>& values, const unsigned int X) {
const unsigned int Y = values.size ( ) / X;

std::ofstream image(file.c_str(), ios::out | ios::binary);
image << "P6n" << X << ' ' << Y << "n255n";
for (unsigned int i=0; i<X*Y; i++) {
unsigned char color = {values[i], values[i], values[i]};
image.write((const char*)color, 3*sizeof(char));
}
}

int main(int argc, char **argv) {
const int X = 256;
const int Y = 256;
const double lX = 3.3;
const double lY = 3.3;

std::vector<unsigned char> values(X*Y, 0);

for (int y=0; y<Y; y++) for (int x=0; x<X; x++) {
double xd = lX / (X/2) * (x - X/2);
double yd = lY / (Y/2) * (y - Y/2);
double d = sqrt(xd*xd + yd*yd);

values[x + y*X] = 255*abs(cos(d*d*d*d));
}

WriteGrayscalePPM("moire.ppm", values, X);

return 0;
}


Answered by user9485 on August 27, 2021

## Related Questions

### Why does opengl use 4d matrices for everything?

3  Asked on August 27, 2021 by yoris

### How can i wrap the earth image around a 3D Sphere using OpenGL, GLFW, GLAD, GLM?

2  Asked on August 27, 2021 by b_cass_

### Defining “inside” and “outside” of a 3D space

2  Asked on August 27, 2021 by avatrin

### Using Bresenham’s circle algorithm (or another alternative algorithm) to draw an arc

1  Asked on August 27, 2021 by gusman

### Performance of Compute Shaders vs. Fragment Shaders for Deferred Rendering

1  Asked on August 27, 2021 by imallett

### Which perspective projection matrix to use

1  Asked on August 27, 2021 by nixcc

### Perspective correct interpolation z-buffer

1  Asked on August 27, 2021 by lightxbulb

### How is orthographic projection used in computer graphics technically classified as a projection?

1  Asked on August 27, 2021

### Why negate z when constructing projection matrix OpenGL

2  Asked on August 27, 2021

### UV partial derivatives of a cylinder shape primitive

1  Asked on August 27, 2021 by wdc

### OpenGL Framebuffer with multiple Depthbuffers inside

1  Asked on August 27, 2021

### Efficiently generating mesh for self-generated voxel grid

1  Asked on August 27, 2021 by andygeers

### How do you apply a normal map to a 3d mesh?

1  Asked on August 27, 2021 by calvin-godfrey

### What’s a good research topic in Computer Graphics?

0  Asked on August 27, 2021

### When unsetting a VAO, should you also unbind the associated VBOs?

1  Asked on August 27, 2021 by natew

### Reading from buffer versus calculating on the fly performance

1  Asked on August 27, 2021 by wduk

### How are textures projected onto 3d models in texture painting applications

1  Asked on August 27, 2021 by lenny-white

### Conditionals and branching in shaders

0  Asked on August 27, 2021

### Does atomic functions on same memory location cause an performance issue?

1  Asked on August 27, 2021

### Phong model: why no multiplication by N dot L in specular term?

1  Asked on August 27, 2021 by kuba

### Ask a Question

Get help from others!