I’ve been working on a procedural ‘Tile’ based landscape generator. And it’s going rather well.
I do, however, have one problem…
Here’s what my terrain looks like in wire-frame after generation via Perlin Noise
Here’s what it looks like when it is solid with GLSL
As you can see, for some reason the shader doesn’t want to change the object from being rendered as a plane. It just wants to render it the same way as before, only respecting the borders of the mesh.
As for the way I am doing it, I am iterating over every vertex in the mesh and applying the perlin noise function, using a VertexProxy object. After the generation, I am reinstancing the physics mesh.
Here’s the code in question:
#Imports import random import landscapeMaterial #I'll have to somehow include this with the binary from noise import snoise2 #This script generates a landscape using perlin terrain_octaves = 8 terrain_scale = 32 terrain_intensity = 16 def generate(planar): for mesh in planar.meshes: for mat_index in range(len(mesh.materials)): for vert_index in range(mesh.getVertexArrayLength(mat_index)): vertex = mesh.getVertex(mat_index, vert_index) vertX = planar.worldPosition.x + vertex.x vertY = planar.worldPosition.y + vertex.y vertex.z = snoise2(vertX / terrain_scale, vertY / terrain_scale, terrain_octaves)*terrain_intensity planar.reinstancePhysicsMesh() def main(obj): generate(obj)
What am I doing wrong? Is there a recalculate shaders function I am not aware of? Is it simply that the normals are still facing the wrong direction? Any help would be appreciated
Thanks in advance.