Kattle you are right about tris not have to be connected, so that won't be a problem.
The current zge-implementation is not so bad I think, but it does a number of things differently than the one you've found:
1. caching of return values of the implicit function, this is important because it can be a very costly function when you have several nested combines with zexpressions and blendning.
2. caching of vertices to avoid generating redundant geometry
3. it only computes the cubes of the area around the found surface instead of computing the whole rectangular area (which saves massively on computations and reduce the need for the user to manually bound the area)
4. it decompose every cube into tetrahedron before computing vertices, this avoids the large look-up table (and supposedly also improves polygonization quality).
These are the reasons there are quite a lot of code in there but I don't think they are unnecessary steps, instead they provide good runtime speed and less geometry
Nr 3 is also why only one surface is computed, but unless I'm mistaken I think that the algorithm can be changed so that this behavior can be controlled with a property. Switch between the current automatic single surface behavior, or a new "computeWholeArea" behavior where the user also needs to set bounds of the area to avoid cpu-overload.
Meta-balls from Implicit Sphears,. sorta' cool.
Moderator: Moderators
Just tried my theory and it looks promising!
Comment out these lines:
Important, set MeshImplicit Bounds to a small value such as 10 or 20. And TriangleSize to 0.1 to begin with.
If this works out I can add a "ComputeWholeArea"-property checkbox on the MeshImplicit.
Comment out these lines:
Code: Select all
implicitmeshes.pas line 620
//test if no surface crossing, cube out of bounds, or already visited: */
{ if ((Old.Corners[C2].Value>0)=Pos) and
((Old.Corners[C3].Value>0)=Pos) and
((Old.Corners[C4].Value>0)=Pos) then
Exit;}
If this works out I can add a "ComputeWholeArea"-property checkbox on the MeshImplicit.
- Attachments
-
- not touching
- zge_imp_two_balls.PNG (59.71 KiB) Viewed 23059 times
I would just keep the "Already visited" part of the if statement, I think it is still usefull.
I must admit: I had not thougth about commenting that if!!!
This way, we can just use a checkbox to determine if only one surface is needed or the whole scene should be calculated.
And if this occours, you should also disable the code in the lines 661->667
and replace it somehow:
The only part I am concerned is the way values from ZExpressions are calculated for every point of the grid. At this point, something that calculates everything could be fine and probably faster! But I have not understood so much well the whole code so I just don't know if it is worth trying or it is implemented yet! [/code]
I must admit: I had not thougth about commenting that if!!!
This way, we can just use a checkbox to determine if only one surface is needed or the whole scene should be calculated.
And if this occours, you should also disable the code in the lines 661->667
and replace it somehow:
Code: Select all
Find(TIn,True, x, y, z);
Find(TOut,False, x, y, z);
if (not TIn.Ok) or (not TOut.Ok) then
Exit; //ZHalt('can''t find starting point');
Converge(TIn.P, TOut.P, TIn.Value, Self.Start);
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
-=Hugo Rossi=-
I have tried this now and it works, but sadly it seems to be too slow for realtime use. This is most likely because the implicit function is called so many times. The metaball-demos use a very simple function, compared to ZGE where the solution is very generic and every point is transformed through a matrix to allow for translate/scale/rotate. I never did envision someone using this for realtime as I mainly thought about it as a modeling tool. I've added a new property for next release that controls this behavior anyway for you guys to try it out.
I'm curios about reached FPS for 2 spheres, I will wait for the new vers to come out!!!VilleK wrote:I have tried this now and it works, but sadly it seems to be too slow for realtime use. This is most likely because the implicit function is called so many times. The metaball-demos use a very simple function, compared to ZGE where the solution is very generic and every point is transformed through a matrix to allow for translate/scale/rotate.
Sadly, I will be away from home by tomorrow untill Monday .
Personally I don't think the matrix is the bad point, because I'm expecting you to not transform point if it is not needed I think that the worst thing is only the implicit function which is called lots of time, and I think that interpreting and calculating the results adds a _huge_ amount of overhead because it is interpreted. Not sure about what can be done to make things better. I will give it a try from July the 22nd onward
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
-=Hugo Rossi=-
- jph_wacheski
- Posts: 1005
- Joined: Sat Feb 16, 2008 8:10 pm
- Location: Canada
- Contact:
Neat open-source WebGL-based* Metaballs example.
http://webglsamples.googlecode.com/hg/blob/blob.html
*Requires a browser that supports WebGL
K