Presentation is loading. Please wait.

Presentation is loading. Please wait.

Modelling Long Hair Using Spline-Based Cylinder Trees Stuart Golodetz.

Similar presentations

Presentation on theme: "Modelling Long Hair Using Spline-Based Cylinder Trees Stuart Golodetz."— Presentation transcript:

1 Modelling Long Hair Using Spline-Based Cylinder Trees Stuart Golodetz

2 What is hair modelling? Hair modelling is about physically modelling hair and seeing what happens when it is perturbed (by wind, for example). It’s distinct from both hair rendering and hair shape modelling. Our focus is on what the hair does, rather than how it looks. Looking nice is a plus, however!

3 Why do we want to model hair? Two separate questions! We want to model hair because without an appropriate underlying physical representation, rendered hair looks good but can’t do anything interesting. We want to model hair both because it’s inherently interesting and because it has similarities to strings, ropes and fibres.

4 State Of The Art Rendering (and indeed modelling) of short hair is getting better all the time (see right). RJ from Over the Hedge (courtesy of DreamWorks) Modelling of long hair remains a research problem.

5 Why is modelling hair difficult? The average human head has over 100,000 hairs on it. Modelling them all individually is a non-starter. Some approaches cluster the hairs into wisps to cut down the numbers. Even so, each wisp must be collision checked against the head, at a minimum, at each time-step. Inter-wisp collision checking would take quadratic time.

6 Aims Blue-skies research! The aim is to model as much hair as possible, as accurately and efficiently as possible. It would be nice to see what happens when the hair is perturbed by wind. It would be even nicer to see what happens when we run a comb through the hair, though that might be quite hard to achieve.

7 Things To Think About What underlying physical model do we want for our hairs? How will we represent them for rendering? For collision detection? How will we represent the head? How much collision detection can we afford? Inter-hair (or -wisp) collision checking is costly and fiddly: is it worth it?

8 Physical Modelling Hairs can be physically modelled by mass-spring systems, using chains of stiff springs. The simplest such systems use only linear springs, i.e. only the forces along the length of the spring are considered. Forces due to curvature are ignored.

9 Physical Modelling Linear springs aren’t really sufficient for hair modelling. If we don’t consider forces resulting from the curvature of the spring chain, the hair will be able to bend too much and look unrealistic. We thus augment our model with angular springs, which take account (albeit in a rather simplistic manner) of said curvature.

10 Physical Modelling Angular springs exert forces on points i-1 and i+1 which have a restoring effect on the angle at point i.

11 Physical Modelling The Details Hairs are modelled as chains of masses connected by springs. We make the hair on top of the head ‘stick up’ by suspending the first few masses from additional springs.

12 Rendering Hairs and cubic B-splines are both long, thin and curvy. Thus hairs can be represented quite well by such splines for rendering purposes. The human head is roughly ellipsoidal, so we can render it as an ellipsoid. It would be nice to texture-map it with a face in due course, but this isn’t a priority.

13 Rendering the head Rendering ellipsoids is easy! Given an ellipsoid’s orthogonal local coordinate system (centre, (i, j, k)), we set our transformation matrix to and render a unit sphere centred at the origin.

14 Rendering the hairs There are two basic approaches to rendering splines: render a fixed number of segments, or a render the spline adaptively. Rendering adaptively is clearly superior; rendering a fixed number of segments is quicker to code… …the current approach thus does the latter.

15 Collision Detection There are two basic problems: inter-hair collisions and hair-head collisions. We’ll consider how to do both, even though we may not bother with inter-hair collisions. Collision detection with splines would be costly and (most probably) hard. This mitigates for constructing bounding approximations to the splines that are more conducive to such tests.

16 Collision Detection Since hairs are long and thin, it makes sense to construct our approximations out of cylinders (see right).

17 Collision Detection We can test the chains (or trees) of cylinders against each other to perform inter-hair collision detection. We can once again model the head as an ellipsoid for collision detection, as we will see later that approximate checking of cylinders against ellipsoids can be done in a relatively simple manner.

18 Collision Detection: What do we need? 1)A way of fitting cylinders to a spline. 2)A way of checking whether two cylinders potentially intersect each other (our test will be very slightly conservative rather than 100% accurate). 3)A way of checking whether a cylinder potentially intersects an ellipsoid.

19 Fitting Cylinders to Splines There are many ways of doing this. Some are orders of magnitude better than others! The ‘natural’ way (i.e. the way I didn’t come up with myself…) is to use the Bézier (not De Boor) points defining the spline and the convex hull property of Bézier curves.

20 Fitting Cylinders to Splines Fit a cylinder to each spline segment (4 Bézier points) as shown. If the radius is too large, subdivide the spline segment and recurse.

21 Cylinder-Cylinder Intersection Two infinite cylinders intersect iff the minimum distance between their axes is less than the sum of their radii. This can be extended to work with cylinders whose height is finite. It’s not quite so easy with finite cylinders: we can only tell whether they potentially intersect using this test. (Consider two cylinders which almost touch at their ends.) This turns out to be enough, luckily.

22 Representing Ellipsoids Ellipsoids can be represented by an orthogonal Cartesian coordinate system, with its origin located at the ellipsoid’s centre and its basis vectors defining the extent of the ellipsoid.

23 Cylinder-Ellipsoid Intersection We use a configuration-space technique to test whether a cylinder potentially intersects an ellipsoid. Denoting the radius of the cylinder as r, we determine whether and where its axis intersects an ellipsoid expanded by r (in a sense we will shortly define.) The cylinder potentially intersects the original ellipsoid iff its axis intersects the expanded one.

24 Cylinder-Ellipsoid Intersection If the dimensions of the inner ellipsoid are (a,b,c), then the outer ellipsoid is (a,b,c) * (1 + r/k), s.t. k = min{a,b,c} and r is the radius of the cylinder.

25 Segment-Ellipsoid Intersection Testing a line segment against an ellipsoid is easiest in the ellipsoid’s own local coordinate system, when the test reduces to one of a line segment against a unit sphere.

26 Segment-Sphere Intersection We can find where an infinite line intersects a sphere by solving a quadratic. Extending this to line segments is time- consuming but straightforward. Dealing with all the special cases can be a pain!

27 Line-Sphere Intersection Use the cosine rule to derive: Then rearrange and solve for t 0 :

28 In Conclusion: The Current Situation Hair can be placed on top of the head and allowed to fall – it looks relatively realistic (see demo). Collision response is an outstanding issue.

29 In Conclusion: Further Work Collision response needs implementing (as just mentioned) – we want to apply forces to the hairs based on detected collisions. The ‘buzz’ phrase is kinematic chain dynamics. We want to see what happens when the hair is perturbed by wind or a comb. Wind, in particular, should be easy if we get the underlying model right.

Download ppt "Modelling Long Hair Using Spline-Based Cylinder Trees Stuart Golodetz."

Similar presentations

Ads by Google