Is moving fourty thousands vertexes simultaneously into different configurations over and over again very expensive?What would be the framerate.
Moving one vertex in the bge causes permanent lag.Would this lag affect other scenes?
Lags appear because a frame took more time than it should take (e.g. 1s/60). It does not matter what the cause of the lag is. it will affect the whole game.
It is not the purpose of a script language to manipulate meshes at that level. The script language should care the game logic, rather than low level tasks (even when it could do it).
There are a few options that are designed to manipulate meshes:
- armature animation
- shapekey animation
- GLSL vertex shader
- GLSL geometry shader
This belongs to usages that apply changes to each or nearly each frame (e.g. waves on water).
When you have a scenario where a short lag (single frame) is acceptable, using the script engine might be sufficient (e.g. calculating terrain once).
When i switch from a scene of 100,000 joined cubes to a blank scene i get a framerate 60.
The low framerate did not affect the the blank scene.
It only matters what is active at the same time.
When you switch scenes the scene you saw before gets unloaded and does not has performance impacts anymore.
This is different when you use overlay and background scenes. These scenes add each other until they are removed.
You can suspend a scene. This reduces the logic and physics (maybe more). But it gets rendered. So it still eats from the processing time buffet.
Wait BGE supports geometry shadings?
@ kitebizelt: HG1 made several examples here for geometry shaders: https://blenderartists.org/forum/showthread.php?362582-Geometry-Shader-using-OpenGL-Wrapper-(bgl)-fix-for-Intel&highlight=geometry+shader
Panzergame just implemented it in upbge: https://github.com/UPBGE/blender/pull/164
If the material of the object is a custom GLSL shader, then use the vertex shader to move vertices is a good idea (gl_Vertex.x += 5.0 for example). If not shape keys or armature (threaded) are a better alternative I think.
If you want to avoid freezes you can perform the transformation on several frames with threading and queue modules.
I was wondering on upbge also if we could implement custom vertices lists (the user creates a vertex list at game engine start, convert it to c++ list via a function that we could implement, and then use functions that we would implement to set all normals in the list, set all positions… but we have to see if it could be doable/efficient)
Would all that apply to openworld videogames with destructable environments?
Ask the upbge team about custom vertex lists.Make the proposal on this websight.
Yes, every change to mesh requires the information to be sent back to the gpu.
Editing even a single vertex on a huge mesh, triggers a full resend.
You are basically, according to my illinformed oppinion, scene addObject-ing after each vertex update.
But, you don’t need to update that many vertices.
If you split up your world into chunks of lets say 1000 vertices then changing for example only one block would only cause that one chunk to be resent.
So you can generate your chunks over time, and after that there will be only minor changes to the chunks by the player.
The overall framerate benefits are a magnitude better than any of your previous cube object based attempts.
You can have a look at the demos I have posted on WIP
or look at the teasers
(generation speed is slowed for education purposes)
You can definitely build a usable game using vertex manipulation.
As I have the lowest amount of polys possible for a chunk and thus the editing is microscopic(mostly 15 polys) I am currently limited only on the sheer count of polygons in the pixel meshing approach.
If I could offload the maximum 27 polys i need to a vertex shader, this would be awesome.
Is it stable?
Does it support lighting and or shadow?
Uv and alpha textures?
You fixed the permanent lag problem when you moved one vertex?
If you mean:
Then that was fixed newer blender versions i think.
There work around hack was to use replace mesh as the finishing touch.
Otherwise, I have no idea what ‘permanent’ lag you mean?
After the editing everything goes back to normal.
Yes that was it.