Closed MartensCedric closed 1 year ago
When i generate a surface, I observe strange artitifacts
Code:
from perlin_noise import PerlinNoise def perlin_noise(noise, u, v, octaves=8): total = 0 p = [u, v] for i in range(octaves): total += (1 / (2 ** i)) * noise([(2 ** i) * x for x in p]) return total / (2 - 1 / (2 ** (octaves - 1))) class TerrainGen(ThreeDScene): def construct(self): axes = ThreeDAxes() noise = PerlinNoise() res = 64 surface = Surface( lambda u, v: axes.c2p(u, v, perlin_noise(noise, u, v)), u_range=[-1, 1], v_range=[-1, 1], resolution=(int(np.sqrt(res)), int(np.sqrt(res))) ) surface.set_style(fill_opacity=1) surface.set_fill_by_value(axes=axes, colorscale=[(RED, -0.5), (YELLOW, 0), (GREEN, 0.5)], axis=2) surface.scale(5, about_point=ORIGIN) three_d_stuff = VGroup(surface) self.set_camera_orientation(theta=70 * DEGREES, phi=75 * DEGREES) self.begin_ambient_camera_rotation(rate=PI / 20) # self.add(axes) self.play(Create(surface)) self.wait(5)
Wrong display or Error traceback:
Describe the bug
When i generate a surface, I observe strange artitifacts
Code:
Wrong display or Error traceback:
Additional context