26 de noviembre de 2009

Hair tufts and hair clumps, easy road named "Styling Hair" - Part 1

This week we are going to talk one more time about hair...but this time we are going to study some techniques that will let us to design hair for our characters in a simple and really really under control way.
Esta semana vamos a hablar una vez más sobre pelo... pero esta vez vamos a analizar algunas técnicas que nos permitirán diseñar el pelo de nuestros personajes de una manera sencilla y controlable.

Usually, when I look for tutorials over the internet I found some that tells you to comb the hair using splines to achieve the shape you want, but they don't go too far, it is a bit difficult to me.
Normalmente, cuando busco tutoriales en Internet suelen enseñarte que tienes que peinar el pelo mediante splines para conseguir la forma que quieres, pero no van más allá, me resulta un poco difícil.

So I looked for some technique that give me all the control over the design of the hair but with the thing I can control most...geometry, and that is what we are going to view...how to create hair styles that are geometry based.
Así que busque alguna técnica que me diese todo el control sobre el diseño del pelo pero con lo que yo realmente controlo...geometría, y esto es lo que vamos a ver, como crear diseños de pelo que están basados en geometría.

As always you have a video where you can see the result/example and the scene with the process.
Como siempre tenéis un video donde podéis ver el resultado/ejemplo y la escena con el proceso.

Here you have the video and the scene link.
Aquí tenéis el video y el enlace a la escena.

http://www.bone-studio.com/blog/26_11_09/clumpspart1.rar




So...let's start.
Bien...empecemos.

We are going to divide our progress in phases, and there is the...
Vamos a dividir nuestro progreso en fases, y aquí esta la...

Phase 1:

In this phase we are going to define the geometry that will give the form of our hair, you can see that we have to different geometries, with the first one (left) we are going to take a general geometry form and get from it various tufts of hair, and the second one (right) will be and stand alone tuft.
The difference between working with only one geometry for multiple tufts or one geometry per tuft is that you will get different physic reaction with your hair using the internal physics simulator or cloth hair simulation, also you can get more control over the shape your tufts gets if you use alone geometry for every tuft because they will get the shape of your geometry, that's why I used two different geometries...to illustrate that.

To achieve this geometry I've used the Topology tool of the Graphite Freeform Tools, so you can draw the form that you want, even if you use your head as “grid” you can draw exactly the shape that you want for your hair.

Make sure that under the object properties you uncheck the “Rendeable” option, you need to do this so the hair is rendered but the base geometry is ignored.



Fase 1:

En esta fase vamos a definir la geometría que dará la forma a nuestro pelo. Podéis ver que tenemos dos geometrías diferentes, con la primera (izquierda) vamos a utilizar una geometría genérica y vamos a sacar varios mechones de pelo, con la segunda (derecha) sera un mechón independiente.
La diferencia entre trabajar con una sola geometría para múltiples mechones o una geometría por mechón, es que conseguirás distintas reacciones físicas con el pelo cuando uses el simulador interno o cuando uses simulación de telas para pelo, ademas conseguirás un mayor control sobre la forma que tienen los mechones de pelo si utilizas una geometría independiente para cada mechón, porque cogerán la forma de tu geometría, por eso he utilizado dos geometrías distintas, para ilustrar esto.

Para conseguir esta geometría he utilizado la herramienta “Topology” de las herramientas freeform del set de herramientas “Graphite”, de esta manera puedes dibujar fácilmente la forma que tu quieras, incluso si utilizas tu cabeza como “grid”, puedes dibujar exactamente la forma que quieres para tu pelo.

Asegurate que en las propiedades del objeto desactivas la opción “Rendeable”, necesitas hacer esto para que el pelo sea renderizado y que la geometría de base sea ignorada.




Phase 2:

Now we have our base geometry...but we have it plain and we we'll need volume for our hair, not a lot, only a bit so it is a bit dense.
To do that I use the “Shell” modifier, also I don't want the bottom polygons of the shape because I'll extract the comb splines from the edges of the model, so I don't want the edges looped, I need to break it at the end of my hair, so I remove it,  after that I apply a turbosmooth to get the amount of vertical edges I'll need for my comb splines, subdivide the model as much as you want.
And this is it :)




Fase 2:


Ya tenemos nuestra geometría de base...pero la tenemos completamente plana y vamos a necesitar algo de volumen para nuestro pelo, no mucho, solo un poco para que sea un algo denso.
Para hacer esto utilizo el modificador “Shell”, ademas no quiero los polígonos del final de la geometría porque voy a extraer las splines, que utilizare para peinar, de las aristas del modelo, por tanto no quiero que estén en bucle (“looped”), necesito romperlos al final de mi pelo, así que elimino esas caras. Después aplicamos un “Turbosmooth” para conseguir la cantidad de aristas verticales que voy a necesitar para mis splines de peinado, subdivide el modelo tanto como quieras.
Listo.



Phase 3:

This phase is a one step only phase, you need to apply an Edit Poly over the stack, select the edges that will be your hair guides and extract it as a smoothed spline with the tool “Create Shape” inside the “Edit Edges” rollout.
In the picture you can see the splines as bone colored lines, but, obviously in max, if you don't activate the rendering in viewport/render you'll not see the splines as this.

As an important tip for this phase look at the picture carefully, you must get the edges until the last edge after it starts with the back part of the geometry, if you get more edges the splines will begin to cross, and we don't want it.



Fase 3:


Esta fase es de un paso único, tienes que aplicar un “Edit Poly” en el grupo de modificadores (“stack”), selecciona la aristas que harán de guías para tu pelo y extraelas como “smoothed spline” con la herramienta “Create Shape” dentro del desplegable “Edit Edges”.


Mira detenidamente la imagen relacionada con esta fase, debes coger las aristas hasta la ultima arista antes de que empiece con la parte de atrás de la geometría, si coges mas aristas empezaran a cruzarse, no queremos eso.



Phase 4:

This is another one step phase, but is as important as the prior phase.

We are going to “Make Planar” the faces that we are going to use for the grow of the hair, I do this because this way I can be sure that the direction of the hair is going to be the direction I want.




Fase 4:


Esta es otra fase de un solo paso, pero tan importante como la anterior.


Vamos a convertir en planas (con la herramienta “Make Planar” ) las caras que vamos a utilizar para el nacimiento del pelo, hago esto por que de esta manera me aseguro que la dirección del pelo va a ser la dirección que busco.



Phase 5:

Now we have our geometry base ready to go.
Let's apply the “Hair&Fur Modifier”, inside of it we go to the face subobject level, now we select the faces that we made planar...these faces will be the point of birth for our hair, we need to press “Update Selection” to reset the hair.
Now with the tool “Recomb From Splines” we give our hair the shape of our splines, at this point make sure that you configure the rest of settings of your hair as you want, but leave the multistrand parameter untouched, you can look inside the example file for my settings, but it's up to you.





Fase 5:


Ahora ya tenemos nuestra geometría de base lista para trabajar.


Aplicamos el modificador “Hair&Fur Modifier”.
Dentro de el vamos al subobjeto “faces” (caras), ahora seleccionamos las caras que queremos hacer planas, estas caras serán el punto de nacimiento de nuestro pelo, tenemos que apretar el botón “Update Selection” para reiniciar el pelo.


Ahora con la herramienta “Recomb From Splines” le damos a nuestro pelo la forma de nuestras splines, llegados a este punto asegurate de que configuras el resto de parámetros del pelo como quieras, pero deja el parámetro “Multistrand” sin tocar, puedes mirar en la escena de ejemplo para ver como lo he configurado yo, tu mismo.



Phase 6:

In this phase we are going to play a bit, in the first geometry (Left), with the styling tools.

The important thing here is the tools you use to give the hair a bit of shape, but there are two buttons that are really important.

If you select some guides and press the “Split Selected Hair Groups” you will get a bunch of guides that are independent from the rest, so you will get no interpolation between these guides and the others, here you have your first tuft, remember that you need to use the various styling tools to give shape to the hair, one more thing about the workflow, at first use the move tool to give the curve that you want, help yourself with the tool “Clump” but only a bit at a time, because it can collapse all your hairs, and when you are done use the tool “Puff Roots” to give volume to the hair.
When you are finished you are ready to go.




Fase 6:


En esta fase vamos a jugar un poco, en la primera geometría (Izquierda), con las herramientas de estilismo (“Styling Tools”)


Lo importante aquí son las herramientas que usas para darle al pelo un poco de forma, pero hay dos botones que son realmente importantes.
Si seleccionas algunas guías y aprietas el botón de “Split Selected Hair Groups” tendrás un grupo de guías que son independientes del resto, así que no tendrás interpolación entre esas guías y las otras, aquí tienes tu primer mechón.
Recuerda que necesitas utilizar las distintas herramientas para darle forma al pelo.
Una cosa mas acerca del flujo de trabajo, al principio usa la herramienta “Move” para darle la curva que buscas, ayudate con la herramienta “Clump”, pero poco a poco, porque puede colapsar todo el pelo, y cuando lo tengas como quieres utiliza la herramienta “Puff Roots” para darle mas volumen al pelo.
Cuando hayas terminado ya estarás listo para continuar.



Phase 7:

In this phase we will review the parameters of the hair and now we can configure the “Multistrand” parameters so we get dense hair.
It's better to do this now so you can style/comb the hair viewing the 100% of the hairs with little performance impact.

And now our hair is ready!

It's easy.

We have just one phase more.




Fase 7:


En esta fase repasamos los parámetros del pelo, ahora podemos configurar los parámetros de “Multistrand”, así conseguiremos un pelo mas denso.
Es mejor hacer esto ahora para que puedas peinar y estilizar tu peinado viendo el 100% de los pelos, de esta manera tendrás muy poco impacto en el rendimiento.


Nuestro pelo esta listo!


Solo nos queda una fase mas.



Phase 8:

We are going to setup the internal physics, do that as we did in the feathers tutorial, configure like you want but think that if you use a low value in “Stiffness” you will loose your styling.

Simulate it in “Precomputed” mode and you are ready to render!




Fase 8:


Vamos a preparar las físicas internas, hazlo como hicimos en el tutorial de las plumas,
configúralo como mas te guste pero piensa que si utilizas un valor muy bajo en “Stiffness” perderás el estilo de tu pelo.


Simula en modo “Precomputed” y todo está listo para renderizar!



Ending:

In the next post I'll use this scene too, I'm going to explain how to setup the Cloth simulation to simulate the hair dynamics, you'll get a lot more control over the simulation and it is a lot more stable, at least in my experience.

If you need any clarification, don't hesitate, ask in the comments.

Happy styling to all!

Final:


En el siguiente post utilizaremos esta escena también. Explicare como configurar la simulación de telas para simular dinámicas de pelo, tendrás mucho mas control sobre la simulación y es mucho mas estable, al menos en mi experiencia.


Appendix A:

If you are using the p_HairTK shader (as in my scene) there are some parameters that I encountered problematic with the hair animation, these parameters are “Saturation Variation”, “Color Variation” and “Gain Variation”, make sure you leave this parameters to 0.0, if you don't do that you'll get some flicker on your render.


Apéndice A:


Si estas usando el shader p_HairTK (como en mi escena) hay algunos parámetros que he encontrado problemáticos con la animación del pelo, estos parámetros son “Saturation Variation”, “Color Variation” y “Gain Variation”, asegurate de dejar estos parámetros a 0.0, si no lo haces obtendrás parpadeos/flicker en el render.


Note:
The FurBall Scene is not in the example scene, if you want it just tell me and i'll post the link.


Nota:
La escena de la bola de pelo no esta en la escena de ejemplo, si la quereis, simplemente decidmelo y pondre el enlace.

16 de noviembre de 2009

Turkeys and Chickens...feather simulations with max hair system.

First of all, as always at the end of the post Spanish readers can find the translated version.
Lo primero de todo, como siempre al final del post se encuentra la versión traducida para lectores españoles.

A few days ago there was an entry in the news of “maxunderground.com”  speaking about a feather simulator for XSI, it was curious to me that was necessary to develop a simulator for feathers specifically, it was a curios thing until I began to do some feather in max, a feather simulator can be very useful, specially if the main character of our production is going to be a chicken full of feathers, but we can achieve similar results using the tools that we have within max.

To show you the result I did a video.



Aand here you have the link to download the scene of this video.

What we need to do is not very complicated, as a good friend of me says...let's go through the parts...
 
Before we start you must know that i configured the hair base geometry as non rendeable, so you will see the feathers in the render but not the geometry that contains the feathers.
Also you will need the feather texture, it is based in a reference photo I found in http://www.cgtextures.com, but I modified it to create an alpha channel.

Here you have, click on it to get the full sized PNG.


1.- The first thing that we need to do is to decide how is going to be our feather, we are going to use it as an instance for the hair so we want it as low poly as we can, also we want it to be rigid, so the less polygons thing will help us here.
In the scene you have three feathers, the first and the second are very similar, the only thing that change between them is that one of them is bended and it have the mapping modified to use the transparency, the second is a slim box, you can use a plane, I did not used it because I prefer to work with the double side for myself.












2.- The second step is to assign the feather as an instance element, you need to know that the pivot orientation is important, and also the object orientation in the world, you wont get the same result with the object oriented in one way or another.












3.- Third step, adjust the hair modifier configuration, here I had a few options, I could use interpolations or not, if I had not used interpolation the feathers would have been much more orderly, too much orderly, also if you don't use this option you will get a feather for every normal of every triangle, so the quantity of feathers will be defined with the number of polygons in our base geometry (the “Hair Count” parameter will work more like a limit than the actual number of hairs/feathers).
I don't want the hair(the feathers) too much flexible so I used only one segment, but I'm not sure that this means any difference when we work with geometry instances.
I gave some randomness in the scale to have feathers of different sizes from the start, also after that, when you stylize the feathers, you can modify the scale specifically.
We work with geometry instances, so the most important parameter is “Root Thick”, normally we use it to define the thick of the root of our hair, for the tip we use “Tip Thick” (This is obvious, but I specify it for Spanish readers), but in this case this one has no effect over our feathers.
With “Root Thick” we define the thickness of the geometry instances.
With the rest of the variation parameters we put all at 0, the “Frizz”, the “Kink” and the “Multistrand”.

At last, in the effect configuration I used “mr prim” with a voxel resolution of 3.
In the rollout “mr parameters” in the modifier I put an Arch&Design material, it was the material I had applied to the original geometry.
The hair modifier instances the material automatically but the result using “geometry” or “mr prim” is not the same, also mental ray gave me some errors in some buckets if I didn't use this system.












4.- The fourth step is the stylize our hair, you need to know that the hair physics in max are not very complex, it is to define how rigid must be the hair and what objects are used to collide, also the physics sometimes are very erratic, you need to try to get a logic orientation between the feathers and the character, in the scene case I did not used more feathers near the neck because they get an strange orientation, to fix this we have two solutions, the first of these solutions is to treat the neck feathers with an additional geometry  that can gave me more control over the orientation of the feathers, the second solutions is to work more the style of the hair so you can fix every guide to get the feathers as you want.
I'm not using feathers near the neck to avoid the mess it can be for this post, it is an example.

To stylize the hair what I did with this simple character is to be in a top view and use the tool “Recomb”, with this I comb all the hairs downwards with only a move, later I raise the roots and the tips with the tools “Puff Roots” and “Stand” to avoid intersection between feathers.
Remember that his is a hair simulator so it is not too serious if the hairs are entangled, but we are doing feathers so wee need to avoid it as much as we can, so what we do is to try the best styling and when we do the simulation we will gave the feathers some stiffness to achieve the sensation that the feathers are anchored to the skin, and they move with the wind, but they are not entangled like the hairs.












5.- This is the shortest step at all, you need to do some animation to test the physics results later, so we can see how the feathers are going to react with the movement, also I used a wind to see how are going to react the feathers with it.

6.- The sixth and last step is to configure the simulation, for this we are going to use the world's oldest system, test/error.
Personally, the hair physics simulations is a bit weird to me, normally to simulate long hairs I'm used to use some geometry as a hair base and cloth simulation to calculate it's movement, in this case we cannot do this, so what we have to do is what follows.
In the rollout “Dynamics” activate the option “Live”, now if you hit play in max you will see how the feathers are reacting with the simulation in real time and you can play with the simulation settings and test your own settings.
I modified only the “Stiffness” value, I used 0,78, but you can need a different value, it depends on your scene units, feathers size, etc...
As I said...test/error.
In the end put the dynamics type in “Precomputed” and define a folder for the simulation files, now you can simulate the frames that you need in your animation, this will avoid strange results in render time, also one thing more, I did not use any kind of render time motion blur with this because I found that some feathers get some strange rotation between frames, in the ticks, as I said the hair simulation it's a bit weird.












After the 325 frames of my test, here you have the result, I really like the way the feathers react with the wind, in the end of the video.



I hope you like this post.

Thanks for reading and commenting.

Cheers!

Juan Gea.

--------------VERSION EN ESPAÑOL-------------SPANISH VERSION--------------

Pollos y pollastres...plumas en max con simulación de pelo.


Hace poco salio una noticia en “maxunderground.com” hablando de un simulador de plumas para XSI, me resulto curioso que fuera necesario desarrollar un simulador específicamente de plumas, me resulto curioso hasta que me puse a crear plumas en max, realmente un simulador de plumas puede ser algo muy útil, sobre todo si vamos basar toda una producción en un pollo lleno de plumas, pero podemos llegar a resultados muy parecidos, utilizando las herramientas que tenemos directamente en max.

Para mostraros el resultado he realizado un video de muestra.

Pongo la escena de este video para que la descargueis.



Lo que hay que hacer no es muy complicado, como dice un buen amigo mio, vamos por partes...

Antes de empezar debéis saber que he configurado la geometría base del pelo como no rendeable, así que veréis las plumas en el render pero no la geometría que contiene las plumas.
Tambien necesitareis la textura de la pluma, esta basada en una foto de referencia que encontré en http://www.cgtextures.com, la modifique para añadirle el canal alfa.

Aqui teneis la imagen, haced click en ella para descargar el png a tamaño completo.



1.- Lo primero que tenemos que hacer es decidir como va a ser nuestra pluma, la vamos a utilizar como instancia del pelo, por tanto querremos que tenga pocos polígonos, ademas queremos que sea un tanto rígida, así que lo de los pocos polígonos nos puede ayudar bastante.
En la escena tenéis tres plumas, la primera y la segunda son muy parecidas, lo único que cambia es que una de ellas esta curvada y tiene el mapping corregido para utilizar también la transparencia, la segunda es una caja muy fina, podéis utilizar un plano, yo no lo he usado por que prefiero trabajar yo con la doble cara antes de que lo haga el max por si mismo, soy un poco maniático.













2.- El segundo paso es asignar la pluma como elemento de instancia, tener en cuenta que la orientación del pivote importa, y también importa la orientación del objecto en el mundo, no conseguirás el mismo resultado con el objecto orientado de una manera que de otra.













3.- Tercer paso, ajustar la configuración del pelo, tenia varias opciones, podía utilizar interpolación o no utilizarla, si no hubiese utilizado la interpolación las plumas habrían quedado muchísimo mas ordenadas, demasiado ordenadas, ademas si no utilizas esta opción se coloca una pluma por cada normal de cada triangulo, por lo que la cantidad de plumas dependerá de la cantidad de polígonos que tenga la geometría de base(el parámetro “Hair Count” actuara mas como un límite que como el numero de pelos/plumas).
Como no quería que fuera muy flexible el pelo (las plumas) le puse solamente un segmento, aunque no estoy seguro de que esto signifique alguna diferencia cuando trabajamos con instancias de geometría.
Le di algo de aleatoriedad en la escala para tener plumas de distintos tamaños de partida, ademas de esto posteriormente al peinar las plumas se pueden modificar los tamaños.
Trabajamos con instancias de geometría, así que el parámetro mas importante es “Root Thick”, normalmente lo utilizamos para definir el grosor de la raíz del pelo, para la punta utilizamos “Tip Thick”, pero en este caso este ultimo no tiene ningún efecto.
Con “Root Thick” definimos el grosor de las instancias de la geometría.
En cuanto al resto de parámetros de variaciones los deje todos a 0, tanto el “Frizz”, como el “Kink” y el “Mutistrand”.
Por ultimo, en la configuración del efecto utilice “mr prim” con una resolución de voxel de 3.
Y en desplegable “mr parameters” del modificador le puse un material arch&design que era el que tenia aplicada la geometría original.
Aunque el lo instancia automáticamente el resultado utilizando “geometría” y “mr prim” no es el mismo, ademas de que mental ray daba algunos errores en algunos buckets si no utilizaba este sistema.












4.- El cuarto paso es peinar nuestro pelo, tened en cuenta que las físicas del pelo de max no son demasiado complejas, vienen a decirnos lo rígido o poco rígido que tiene que ser el pelo y con que objetos colisionan, no siempre funcionan bien ademas, así que procurar peinar las plumas de manera que queden con una orientación lógica con respecto al personaje, en el caso del personaje de la escena no le puse mas plumas cerca del cuello por que cogían una orientación extraña, para corregir eso habríamos tenido dos soluciones, la primera de ellas es tratar las plumas mas cercanas al cuellos con una geometría de base distinta, en la que controláramos por separado los polígonos y ademas en la que nos resultase mas sencillo peinar las plumas del cuello, la otra solución habría sido trabajar mas el peinado del cuello peinando y orientando cada una de las guiás que no tuviera la orientación que buscábamos.
Para no liar demasiado este post me decante simplemente por simplificar el ejemplo.

Para peinar el pelo lo que yo he hecho, al tratarse de un personaje sencillo, es colocarme en una vista superior y después utilizar la herramienta “Recomb”, con esto peino todos los pelos hacia abajo de un solo golpe, después con las herramientas de “Puff Roots” y “Stand” levanto tanto las raíces como las puntas del pelo para que las plumas no se atraviesen.
Recordad siempre que esto es un simulador de pelo, por lo que no es demasiado grave que los pelos se “enreden”, pero al estar haciendo plumas eso tenemos que intentar evitarlo, así que lo que hacemos es peinar para que quede lo mejor posible y al simular darle algo de rigidez a las plumas para que de la sensación de que están ancladas a la carne, oscilan y se mueven con el viento pero no se atraviesan ni se lían como los pelos.











5.- Este es el paso mas cortito, simplemente haced una animación para que después podamos comprobar como reaccionan nuestras plumas al movimiento, yo ademas he colocado un viento para así poder ver también como reaccionan las plumas ante el.

6.- El sexto y ultimo paso es configurar la simulación, para esto utilizamos el sistema mas antiguo del mundo, prueba error.
Personalmente la simulación de físicas del pelo me parece bastante mala, normalmente para simular melenas suelo utilizar geometría como base para el pelo y simulación de telas para calcular su movimiento, en este caso no podemos hacer eso, así que se trata de poner, en la pestaña “Dynamics”, la simulación en modo “Live”, darle a play en el max y ver como reaccionan las plumas con la configuración que tenemos ahora.
Al final yo me decante por modificar solo el “Stiffness” y ponerlo a 0.78, pero cada uno de vosotros puede necesitar un valor distinto.
Como ya he dicho...prueba y error.
Por último en lo relativo a la simulación colocad el tipo de dinámicas en “Precomputed”, definid un directorio y simulad los frames que necesitéis para vuestra animación, esto evitara resultados extraños e inesperados en el momento del render, por cierto os desaconsejo encarecidamente la utilización del motion blur en render, a mi me han salido algunas plumas con rotaciones extrañas en los ticks, como ya he dicho la simulación del pelo no es demasiado buena.














Y por fin, después del render de los 325 frames de mi prueba aquí tenéis el resultado, me gusta especialmente como reaccionan las plumas con el viento, al final del video.




Espero que os guste y os sea util.



Gracias por leer y comentar!


Juan Gea.