Hi, this is a simple demo I wrote for BGE. It’s about simulating water surfaces/rippling effect.
I couldn’t get to apply this to a mesh, since the vertex array isn’t ordered. If someone wants to try…
Attachments
ripples_sim.blend (520 KB)
Hi, this is a simple demo I wrote for BGE. It’s about simulating water surfaces/rippling effect.
I couldn’t get to apply this to a mesh, since the vertex array isn’t ordered. If someone wants to try…
ripples_sim.blend (520 KB)
what about using local x and y position to index them correctly?
Because sometimes the grid size in the script != the plane subdivisions. Also it’s not exactly 0, 1, 2… I scale the grid for beauty purposes…
I’m clueless about this
can you sort by x value, then all that have the same X sort by Y?
using python sorted?
thinking about how to code now**
vertexList = vertexList sorted by x
XList =[]
for vertex in vertexList:
if vertex.x not in XList:
vertexList.append(vertex.x)
(now we know how many columns there are)
master =[]
for entry in XList:
XL=[]
for vertex in VertexList:
if vertex.x = entry:
XL.append(vertex)
master.append([entry,XL])
#now master is lists of all objects sharing the same X value
#now where do we go from here ?
master=[[Xvalue,
[list of vertex in this column]],[Xvalue,
[list of vertex in this column]]]
edit:new thoughts
just get all vertex that share a xy cord?
move them as 1 entity
mathutils kdtree radius search?
I get extremely bad framerate for the regular bge with your ripples_sim.The framerate 5.0-5.2. What about upbge?
I guess i should not expect it to be optimized right?
On my notebook I get constant 60 fps. However the logic calculation time is very high (~10-12 ms) maybe it is to much for your cpu.
I don’t think upbge will give you improvements here.
@TwisterGE: Nice water simulation
I’m not sure how efficient it can be used in a complete scene (I always thought this kind of calculations a better on the gpu side) but for a demo it’s awesome and probably the caculations would be faster in a fast (pre compiled) language.
wow that is some advanced math there
I got the algorithm from a raytracing tutorial, so… yeah it isn’t optimized
As a heightfield sim, you can’t really optimise it much further, save for running it on the GPU (bypassing the bgl library, and running closer to hardware). However, if i recall LostScience, you have said you’re running on integrated graphics and a low end CPU… these sorts of calculations are intensive.
I believe most people have computers like ours.Am i right or wrong?