So basically I already have ideas on how to make quick terrain in realtime BGE.
But I wanna do it in blender on how to make heightmap or terrain map in blender.
So far as I know the Heightmap does work well in BGE but I wanna to know on how in some blender addons like Ant landscape do the magic work to generate terrain, which is using noise coordinate like an image.
If I can access the noise Image or even better the bpy function to works in real time game engine this will be the best than using external image, because its seamless into infinity (depend on ram of course ).
If you need access to noise textures, use the mathematics module and the generated noise texture provided in the documentation - how do I get the offset? you need to select vertices and, depending on the type of your object, offset either only along the Z axis if you have a plane, or use the normal of each vertex if you have a sphere, control over the scale of the noise texture is carried out through its position variable, the strength or height depends on the additional variable by which you multiply the noise texture
for index in range(mesh.getVertexArrayLength(0)):
vertex = mesh.getVertex(0, index)
pos = own.worldTransform * vertex.XYZ
vertex.z = noise.hetero_terrain(pos//0,50, 1.0, 200.0, 8, 1.0) * 0.05
Thanks I will try this later because I’ve done the Heightmap works perfectly better in eevee but sadly not entirely added in BGE, I will add in the comment reply soon
Ok - I will be waiting for your results.
So…its been a while because of health issues…
Btw I put on a wrong threads, should be in :
After I’ve tested to my project…
There is another something big is missing specially on the script.
It’s the most basic shaders that is missing called opengl lighting, so the terrain don’t receive shadows after the scene is modified/morphed.
This particular issues was classic into another concept of design in rigging, for example the deformation of an object with armature as well, will not re-calculate its shadows from “sun” lamp.
So most classic games use star pose in the character rigging, with all limbs slightly lean to the side and for the arms mesh to be properly set is 45 degrees angle either horizontal/vertical.
Any motion/action or the modified mesh is slightly has its shadow on default pose, where ever move/rotate on the mesh.
Now back to terrain, the issues is the same on the “Terrain.blend” files which is the mesh transform by script compared with armatured object action is the same, that the opengl light and shadows not calculated after 1st default shape.
The only thing that terrain can apply its shadow is using shape/keyed animation, so the library is kept on mesh deform as keys, but another limitation on shape key is the default/basic mesh has to be rendered within the cameras specially in standalone player.
So now I tried to find the solution on the script like import gl/gpu which is the most probable attempt, even though the sample mostly static and not chaged.
Some old post has this issues like mine, but Im not sure the normal is the problems though because the script has normal re-draw.
You need to recalculate all the normals of the vertices of the object that you have changed - otherwise it will be excluded from the shadow buffer trace since shadows are calculated tangentially to the normal of each vertex of the object then you will have the correct shading, in addition, keep in mind that the cone of the lamp shadow is not too large in the game engine, so you need to trick - for example, force a solar lamp keep an eye on the player. When I recalculated the normals and heights for the landscape of the planets, I had no problems with shading