I think the main problem I am having right now is I don't have a way of visually debugging, so I'm not really sure how close I am to having the ray-marching work. I'm just getting a lot of ill-formed shapes, so I've gone back and am now redoing the surface reconstruction in smaller easy-to-check parts. I'm also wary that this method is bound to be pretty slow, so I'm still looking into the other ways of reconstructing the implicit surface once I'm sure it's setup correctly. The original Witkin-Heckbert particle constraint idea is looking less appealing given it is quite a lot of code and still only generates points which must then be polygonized in real-time as well, so suffice it to say, I'm struggling a little with this part of the project right now.
On a side note, I have also been working on smaller things such as the user interaction forces now that I have a real camera setup (see last couple posts) and actually have access to such info as the view plane. Not quite finished with this either, but should be soon. My current plan/pseudo-code for the basic interaction forces:
1. Qt signals user click
2. Store the the location of the click at c.last
3. interactionClick <- TRUE
3. interactionClick <- TRUE
4. Shoot Ray out from camera eye position through the clicked position in world space
5. //This step takes O(n) time:
For each particle at position p do a ray-sphere intersection with the sphere centered at p with radius r.
d <- SphereIntersect(p,r);
//returns -1 if no hit otherwise the closest distance d from p to Ray
//Note that d <= r
if (d != -1) { //there was an intersection
tag this particle p and store its d
}
...................
//In next time steps - if interactionClick == TRUE
6. Qt signals user drag with mouse clicked at c.current
7. dDrag <- c.current - c.last //dDrag should be projected so that parallel to view plane
8. For each particle p that is tagged
Compute a force f as with magnitude a function of p.d and lengthOf(dDrag)
f points in direction of dDdrag
Store f with that particle to be applied in external forces step of simulation
Store f with that particle to be applied in external forces step of simulation
9. c.last <- c.current
....................
10. OnMouseRelease()
Remove tags from all particles
interactionClick <- FALSE
Remove tags from all particles
interactionClick <- FALSE
Anyway, that's it for now. Hopefully some more videos to come soon, but I'll save the "future plans" part of this post for the self-critique which I should be putting up shortly.
No comments:
Post a Comment