give is a try, you should get under 2 ms.
about 1.1 ms

Moderators: Sascha Willems, walaber
give is a try, you should get under 2 ms.
Bird wrote:The biggest problem I had in my LightWave plugin that used Flex and OpenVDB was to get realistic thin water meshes, like spilled water on a table top.
Bird wrote:BTW, the shader splat code that Flex uses in it's demos is opensource and I used it in my LightWave plugin for a "preview" mode like in this video.
void ndIsoSurface::ndImplementation::ProcessLowResCell(ndIsoCell& cell)
{
ndInt32 tableIndex = 0;
for (ndInt32 i = 0; i < 8; ++i)
{
tableIndex |= (cell.m_isoValues[i].m_w > m_isoValue) << i;
}
ndVector vertlist[12];
const ndInt32 start = m_edgeScan[tableIndex];
const ndInt32 edgeCount = m_edgeScan[tableIndex + 1] - start;
for (ndInt32 i = 0; i < edgeCount; ++i)
{
const ndEdge& edge = m_edges[start + i];
const ndInt32 midPoint = edge.m_midPoint;
const ndInt32 p0 = edge.m_p0;
const ndInt32 p1 = edge.m_p1;
vertlist[midPoint] = InterpolateLowResVertex(cell.m_isoValues[p0], cell.m_isoValues[p1]);
}
const ndInt32 index = m_triangles.GetCount();
const ndInt32 faceStart = m_facesScan[tableIndex];
const ndInt32 faceVertexCount = m_facesScan[tableIndex + 1] - faceStart;
m_triangles.SetCount(index + faceVertexCount * 3);
ndVector* const triangle = &m_triangles[index];
for (ndInt32 i = 0; i < faceVertexCount; ++i)
{
const ndInt32 j = i * 3;
const ndInt32 j0 = m_faces[faceStart + i][0];
const ndInt32 j1 = m_faces[faceStart + i][1];
const ndInt32 j2 = m_faces[faceStart + i][2];
triangle[j + 0] = vertlist[j0];
triangle[j + 1] = vertlist[j1];
triangle[j + 2] = vertlist[j2];
triangle[j + 0].m_w = ndFloat32(index + j + 0);
triangle[j + 1].m_w = ndFloat32(index + j + 1);
triangle[j + 2].m_w = ndFloat32(index + j + 2);
}
}
JoeJ wrote:Nice....
I wonder, it looks like the simulation is unbounded. The particles expand over all the place and i see no box limiting their simulation domain.
How large is your grid? And how many particles per cell do you have in this setup?
void AddPair(ndPairInfo& info, ndInt32 particle0, ndInt32 particle1)
{
ndVector p1p0(info.m_posit[particle0] - info.m_posit[particle1]);
ndFloat32 dist2(p1p0.DotProduct(p1p0).GetScalar());
if (dist2 < info.m_diameter2)
{
dAssert(dist2 >= ndFloat32(0.0f));
ndFloat32 dist = ndSqrt(dist2);
{
ndSpinLock lock(info.m_locks[particle0]);
ndInt8 count = info.m_pairCount[particle0];
if (count < 32)
{
info.m_pair[particle0].m_m1[count] = particle1;
info.m_distance[particle0].m_dist[count] = dist;
info.m_pairCount[particle0] = count + 1;
#ifdef D_DEBUG_SOLVER
dAssert(!info.m_pairfilter.Find(ndWorkingData::ndPair(particle0, particle1)));
info.m_pairfilter.Insert(ndWorkingData::ndPair(particle0, particle1));
#endif
}
}
{
ndSpinLock lock(info.m_locks[particle1]);
ndInt8 count = info.m_pairCount[particle1];
if (count < 32)
{
info.m_pair[particle1].m_m1[count] = particle0;
info.m_distance[particle1].m_dist[count] = dist;
info.m_pairCount[particle1] = count + 1;
#ifdef D_DEBUG_SOLVER
dAssert(!info.m_pairfilter.Find(ndWorkingData::ndPair(particle1, particle0)));
info.m_pairfilter.Insert(ndWorkingData::ndPair(particle1, particle0));
#endif
}
}
}
}
Julio Jerez wrote:Then the other parameter, is the size of the aabb of the entire set, that now I have set to a 14 bit in grids per dimensions.
That 2 ^14 * grid size.
So if a grid is say 0.01 of a meter, the about a 200 x 200 x 200 meter^3 volume.
Those spec are more than sufficient for simulation of small volume of fluids.
The reason of using 14 bit, is that it can pack the complete grid record in a 64 bit interger,
Using 20 bit for particle index. And one fir cell home grid indicator.
Using 20 bit for dim and 32 bit for cell, yield a 128 bit cell record which double the memory size, with huge bandwidth cost.
I have it set with a difine that specify large ir small grid.
Maybe if we move to hpu them large grid make sense but for now, to me 1 million particle max, in a 200 ^3 cube volume us good fir small effects.
Users browsing this forum: No registered users and 0 guests