Skip to content

Unrealistic images #6

Description

@Goatghosts

Hello. I use the plotly module to easily create 3d visualizations of the resulting images. And when using your code, I noticed such a feature that virtually every created landscape necessarily has very unrealistic maximum and minimum points.
You can check this for yourself by running the provided code snippet.

from hkb_diamondsquare import DiamondSquare
import numpy as np
import plotly.graph_objects as go

def show_terrain(terrain_array):
    fig = go.Figure(data=[go.Surface(z=terrain_array)])
    fig.update_layout(
        title="Terrain Visualization",
        autosize=True,
        scene=dict(
            zaxis=dict(range=[np.min(terrain_array), np.max(terrain_array)]), aspectratio=dict(x=1, y=1, z=0.5)
        ),
    )
    fig.show()

map = DiamondSquare.diamond_square(shape=(250, 250), min_height=0, max_height=5, roughness=0.35)
show_terrain(map)

It feels like there is some kind of flaw in the algorithm. I'm pretty sure this problem is not related to rendering issues. But this code in its current form is very poorly applicable for real use.
I understand that the repository is already quite old, but I poorly understand the operation (or rather the implementation) of the presented algorithm, so I cannot say what exactly the problem is.
I would be grateful for any comments.

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions