Monday, June 1, 2009

stretching skin with bones...yet another attempt

I'm looking at this problem in more of a physically based manner, where there's only 1 timestep (boneBefore and boneAfter) to deform the skin. So basically what I'm doing is seeing where the vector ( defined by a vertice on the bone before and after deformation ) intersects a face on the skin. When it finds this face, it adds it to all other vectors that have intersected the face, eventually coming up with an average directional vector. Because vertices of several parts of the bone will intersect the skin, not just the one that would theoretically push it out first (given the single timestep) it is necessary to set the magnitude of this average directional vector to the magnitude of the bone vertex that is the least distance from the skin face. There still appear to be some kinks in setting this magnitude, as can be seen in the circled area in the image below.

This method will be done before the standard method for moving the rest of the skin, allowing skin areas that do not come into contact with the bone to deform as well. However, this will ensure that the bone does not interpenetrate the skin after this operation has been performed. On the down side, checking every bone vertex against every skin face is computationally expensive and adds quite a bit of time to the deformation process.

Wednesday, May 27, 2009

Fixing Bone Interpenetration With Skin

This is probably the last major problem with my thesis and I'd really like to get it solved. I started out thinking that I could solve it with sculpt deformers, but after playing around with them once again, I realized their limitations and decided it wasn't worth pursuing. After that, I thought I would find the closest distance from each vector to a face on the bone along its normal and maintain that as a minimum distance. After getting this function to work with a simple plane and locator, I realized that this wouldn't work because most vertex normals don't intersect with the bone at all. If there were muscle filling out the rest of the mass, this technique would probably work, but then, I dropped the due to a whole other range of problems. Now I'm trying a technique where I find the closest distance from each vertex to a point on the bone and maintain that as a minimum distance. To do this, I measure the distance to that point before and after deformation, if the distance has decreased, I push the vertex out along its normal by an amount determined with the sine rule, such that the distance between the two points becomes correct. Unfortunately, while this all sounds like it should work, I'm getting poor results (see below). I think it might help if I find the shortest distance to a face on the bone (although computationally, much more expensive) so I'm working on a function to do that.

Wednesday, April 29, 2009

Icons!

I made some Maya icons for my scripts. Here they are:

Well here's a problem with the Vertebra Skin Deformations

It always happens that I'll get something working with the test case and then find a broken case shortly thereafter. A problem I'm coming across with the vertebra based skin deformations is that I'm running into problems when the 'spine curve' starts out closer to the skin in the out part than in the in part. As a result, the extruded skin doesn't match up with the in part skin as well as it should and edges match up offset by 1. Additionally, the curve of the skin has a big bump at the connection. I've thought of 2 solutions to this, I'm not sure which to pursue.

1) Move the border verts to be the average of the immediate vertex neighbors on the in and out parts. This would smooth out the transition and would probably help correct mismatched edges if, as in this case, they are only offset by 1. However, since the border is ideally situated where it should be based on the in part, I fear that, while this would work, it wouldn't exactly be correct.

2) Find the point on the curve that is closest to the center point of the border vertices on both the in and out parts and then get the vectors between these points. Offset the movement of each of the edges by interpolating between the two as you traverse the curve adding edgeloops. This one's a little more complicated and I'm sure there's some problem that I'm not thinking of, but it seems like it might yield more "correct" results.

Monday, April 27, 2009

Vertebra Type Skin Deformations Working Quite Nicely

In trying to fix my skin deformations, I noticed a couple problems in my script when dealing with vertebra connections. Namely, their attribute files were pointing to specifically numbered vertebra and it needed to look at them to determine which number they were. This worked great when I had parts of the same animal and the entirety of the animal was in the scene. This didn't work so great when I was just working with say, a torso and an abdomen, and it needed to look at the neck. Anyhow, I changed the vertebrate naming convention and the way the script worked to fix this problem. In the process, I broke my script, so that took me a couple days to fix. Not fun at all.

On the up side, I got the border extrusion stuff working much quicker than expected. As I thought, Maya's default border extrusion caused me problems. Borders were flipping, edges were rotating, and worst of all, it didn't maintain the edge numbering at the border (which basically would have broken any future connection attempts). So I made my own extrusion that basically evenly spaces out the curve along its length and then moves the border along this spacing, inserting a new edge loop between it and its immediate neighbor with each move. By doing this first and then running the standard skin deformer I use for all bones, I managed to get really nice results.

Wednesday, April 22, 2009

Ok, Maybe Skin Deformations Aren't Entirely Almost Done

I realized that my skin deformations would have problems with parts that involve vertebra connections, because the connections work by adding vertebra, instead of the usual deforming existing bones. Right now, the border connects, but doesn't do so properly, because it connects based on original positions, rather than its position after first being deformed by the underlying bone, and thus the vertex matching is wrong (getting the twist-like topology shown below). I plan on tackling this by using the curve that is created to place the new vertebra in the bone connection as a guide for extruding the border edge before it connects. I'm hoping I can make use of maya's ability to do this, however, if that doesn't give me good results, I'll have to write my own 'extrude along curve' procedure, which should be a simple task.

Monday, April 20, 2009

Skin Deformation, Almost There

I tried positioning the Right Thigh up high and away from the rest of the dog. I then connected it to the Right Lower and then the Abdomen. It worked out mostly alright, however the geometry is a bit bumpy and wonky (see picture below) after being stretched and then compressed. This will probably require some smoothing to repair. I guess since the smoothing issue is coming up frequently now, I'll have to figure out how best to approach that.

*EDIT* It occurred to me that this was created with each vertex's change in position smoothed only by its immediate neighbors movement. It may help to add an extra level of 'neighbor awareness', looking at immediate neighbors and the neighbors of those neighbors as well. I'll have to give that a try and see what happens.

Saturday, April 18, 2009

Skin Deformation Working!...Almost

I fixed the problem where the border would get stretched while trying to connect due to some of the border edges being closest to vertices on the bone that don't move and also fixed several other problems that came up along the way. Now I've got the skin connecting quite nicely on one end.

First, I've just noticed that I'll need to be maintaining all border edges, not just the connecting one. The connecting border was the only one getting malformed in my original test case, but in further tests I notice that the problem I was experiencing affects non-connecting borders as well. There is also a problem of interpenetration of the bone with the skin due to the smoothing built into the deformation. Not entirely sure how to tackle that problem, I'll have to think on that. Finally, the transition between the outSkin and inSkin is too sharp and will need some sort of smoothing after connection.

Wednesday, April 15, 2009

Skin Deformations

With my wrap deformer-like process I'm deforming the skin based on what the bone is doing (specifically each vertex on the skin does what the closest corresponding vertex on the bone is doing). Unfortunately, this process broke down at the border edge, where some parts of the border were trying to deform based on parts of the bone that didn't move, while others were deforming based on parts that did. So I now have the borders all moving by the same amount to preserve them. This works fine in simple cases, but breaks down in cases where more transformations (i.e. rotations) have been performed to the connecting part. As such, I am now having the border snap directly to the connecting part (which it needs to do eventually anyhow) and working from there.

Here's how it looks right now, in a situation where it works. Note the features seem to remain relatively intact.