Planet sphere tessellation and displacmenet

Hello everyone - I have a question - it is necessary to make a sphere tessellation to generate a future planet in UPBGE v 2.0.5 and I do not know what to start from - as far as I know, all the main examples boil down to an endless landscape, which consists of sets of tiles that are substituted when the player reaches the edge of the current tile, but I did not find information about the generation of a subdivided sphere in the engine - my questions: 1. Is it possible to use the bpy module in conjunction with the python game engine for these purposes? if so, where can I find information about this API? tutorials? 2.Where can I find information about the division of the grid in the vicinity of the player’s camera - I am interested in the division of the grid according to the coordinates of the UV scan - for its further displacement 3. Is it possible to do this without GLSL shaders purely on python? I would appreciate any information, I know the information on how to get a list of the vertices of an object, their positions and movements
‘mesh = own.meshes[0]
for v in range(mesh.getVertexArrayLength(0)):
vert = mesh.getVertex(0, v)
pos = vert.getXYZ()’ - I need information on how to divide the grid into, say, 10 x 10 squares to have dimensions of 100 x 100 and further
or will I have to make a projection for these purposes? - by dragging the vertices from the back of the mesh and arranging the mesh with them closer to the camera to get a high-poly surface and only then produce surface offsets? - I will be grateful for any hints or ideas

Well, I looked through my question and looked for information about generating landscapes in bge/upbge 2.79 via python - you can do this by changing the position of the mesh vertexes and recalculating the mesh physics. I found a very interesting example that the user sdfgeoff did, the example works well and generates a landscape from height maps, but does it according to the world coordinate Z+ and it shifts the surfaces of the spheres in the same way - like a rag - and when it is shifted from the center of the coordinates of the scene, it projects elevation maps onto the object differently - I would like to know if it is possible to redo it to shift the surface of the sphere in order to be able to shift the vertexes according to the coordinates of the vertex normals, as is done by the script

``
from bge import logic as GL
import random

def init(cont):

own = cont.owner
redarw_land(cont)

def redarw_land(cont):

own = cont.owner

# get the 1st mesh
mesh = own.meshes[0]
for v in range(mesh.getVertexArrayLength(0)):
    vert = mesh.getVertex(0, v)
    pos = vert.getXYZ()
    norm = vert.normal * random.triangular(0.0, 0.015)
    
    vert.XYZ = (vert.x * norm.x, vert.y * norm.y, vert.z *norm.z)

``

Terrain.zip (126.2 KB)
this is an example of a tile generation file made by the sdfgeoff user

Well, again, I’ll rephrase the question since I found a solution for the sphere, I was able to shift it in the game engine - and the last question remains, I used the built-in math - noise textures data module, but maybe there is a way to use texture maps of heights instead of the maps available in the noise mathematics module? is it possible to somehow get pixel values and match them with UV to offset the surface?


my solution boils down to using the displacement of the sphere vertices and the data for the displacement is taken from norm= vert.XYZ * noise.hetero_terrain(pos, 1.0, 200.0, 8, 1.0)*0.05 which generates a procedural texture and makes an offset based on it, but I need to get and embed elevation maps - for example, textures of the heights of planets with craters or erosion mountains, I’m already thinking about how to try to extract data from a material id or image

I’m removing my question - I solved it using the example of Sdfgeoff from the blenderartist community - now you can use custom elevation maps for regions to generate a surface, the problem of the example was with setting the position of the UV map - I took a tenth of the texture size, subtracted the position of the vertex of the corresponding coordinate and divided it by one and the offset stood in the center of the map scan



I’ll just leave it here.