Realtime morphing

Project diary for a realtime morphing demonstration. We are two skilled students at gsCept university creating an advanced real time morphing simulation. This is our diary about it.

Wednesday, December 14, 2005

Shades of Divinity

Well, the project has been finished for a long time now.. Kinda just forgot to blog that we're finished... =)

We dubbed it "Shades of Divinity", and the final product + more info can be found at

Thursday, March 10, 2005

It's all coming together

One day left on the project and one week until the final presentation :)
Overall It feels pretty good, I feel like I have reached my goals with this project.
There is always more stuff to do but a "final" version of the code that will be used for the presentation is done. Later i might pack the textures and HLSL files into the .exe for easer distribution
(if someone on this planet wanna download it for some reason:).

Short summary on what's seen in the demo.

Alot of the lightning/shading data is sampled from textures to give the artist as much control of the shading as possible.

- Diffuse color
- Specular color
- Shininess
- Normal
- Reflectivity
- Height
- Light
- Attenuation

The Ground
- Normalmapped per pixel diffuse and specular lightning (Phong model)
- Parallax mapping for greater 3D feel.
- Receives soft shadows.

The Angel(s)
- Normalmapped per pixel diffuse and specular lightning (Phong model)
- Environment reflections
- Renormalised tangent space basis each pixel for accurate lightning
- Morphs between all textures (diffuse, specular, normal, shininess, reflectivity)
- Receives and generates soft shadows
- Smooth skinning
- Kochanek Bartels Hermite spline interpolation for translation track
- Spherical Linear Interpolation using Quaternions for rotation track

The spotligh
- Projected texture instead of the original spotlight model
- Attenuation map to control the fallof.

Ambient lightning
- Ambient lightning ala "half life 2" so detail from the normalmap is visible even when shadowed,
traditional ambient lightning just makes everything completely flat.
- Works by specifying an ambient cube representing the color of the light flowing from that direction in space
- Eaxh pixel rendered samples and blends between 3 of the ambient cube sided depending on It's worldspace normal

The sky
- Ordinary skybox

- 1024x1024 shadow map
- 2x2 PCF sampled 5 times to give "soft" shadow edges.

Volumetric light/fog
- Lit depending on the lights projected texture
- Shadows from blocking objects
- Fog is generated using 3 octaves of perlin noise from a 16x16x16 texture
- Rendered at a small resolution and via "smart" filtering rescaled to fit the screen while minimizing aliasing artefacts

- Transitionless slider based morph affecting the whole model
- Plane morph dividing the model in 2
- Lightbased morph where the morphvalue is sampled from the projected lights alpha channel.

The demo engine is coded using C++ and D3D9 in VC.2003.
All shaders is written is HLSL and some makes use of vs/ps 3.0 because of their length and branching requirements.

Maya exporter plugin
- Exports one mesh with the bound skeleton if any
- Triangulates polygons
- Splits vertices depending on hard/soft edges and texture seams
- Calculates tangents and binormals taking into account artist modified vertex normals
- Complete skeleton hierarchy with rotation and translation track exported including bindpose
- Unlimited amount of skinweights per vertex

The exporter is coded in C++ in VC.2003 using the Maya C++ API.

Wednesday, March 09, 2005

Getting wrapped up

Well, animation is almost done. I have successfully completed the animation, but it needs some minor fixing until it feels more professional. This workflow - sketching up the whole animation first, and then finalize and perfect it - is the best. Only drawback is that people in the classroom looks over my shoulder and thinks "uh, that's not good", and when some people does this, it's kind of irritation.

Anyway. Right now the follow things needs some attention - then we're ready to go gold.

- animation
The animation needs more attention. This is actually a never-ending task, so I will most likely finish up the other things first, then work the animation until no time is left.

- model
Needs to be tesselated in some areas for better deformations. This must be done in consideration of the normalmaps, which are already generated. Perhaps I could generate new normal-maps, as my workflow allows for it... .Hmm... I placed all manual changes in layers in a .psd file, so I could change the original by just changing the background layers.... (Must be thought over.)

- skin weights
If I add more polygons, I must also paint how they are weighted.

- gui
Fix the gui so it's more personalized

- icon
I'm not happy with the icon I made. I have very fuzzy ideas about new ones, so until I can think of something more concrete, the old one will have to do.

Monday, February 14, 2005

Animation Started

Have started to animate the character now. So far, about 6 seconds or so is completed. I've noticed quite some problems with my rigging and skin-painting, but I'm correcting them along the way. Hopefully, the number of seconds/day will increase as my rig gets more final, skinpainting gets done and most important - I get used to animating this specific rig.

Perlin noise

Switched from creating the fogvolumes from 2 scrolling textures to a 3d perlin noise. This gives much more "realistically" looking fogvolumes and it's easier to control/predict the result.
The fogvolume in itself is made by a 16x16x16 texture (only 4k memory) stretched over an area of 64x64x64 and using 3 octaves of noise to give enough detail.
Also wrote the shaders för lightbased morphing and plane morphing in ps 3.0.
Optimized the volumetric lightning a little futher (because it's so fillrate heavy every cycle counts :) and now It's running pretty smooth.

Friday, February 11, 2005

Textures done

Well, I'm pretty sure I posted a post that got lost somewhere along the way... So sorry for the slow update on the graphics part.

Anyway, this is current status:
Textures are almost done! .. Everything except the reflection map and some tweaking. The problem is that I can't see the reflection map on my current card / pixel shader implementation. In order to see it, either Fredrik would have to write a specific pixel shader in 2.0 just for me to test the result - which would not only add more work but also a pitfall if the implementations would differ. The other solution - which also solves a future problem with not being able to test animation - is to aquire a gfx card with ps3.0, i.e. a gf6800.

After some serious problems with getting our school to even respond, we finally got rejected. And then another teacher ordered the card anyway. So, textures will be 100% done pretty soon after the gfx card has been installed.

Wednesday, February 09, 2005

Half life 2 shading implemented :)

Just added support for a skybox and it really lifts the overall feeling compared to a black background :)
Also implement "indirect lightning" ala Half Life 2 so i get rid of the ugliness that comes with normal ambient lightning.
The reason for this is when using normal ambient lightning the details from the normalmap won't show and the model just looks flat, i tried adding very faint pointligts that only affected the diffuse component but the indirect lightning implemented in half life 2 gives equally good result and it's cheaper.
It works by setting up an "ambient cube" which is 6 colors that measures the color of the light "flowing" from that direction, then depending on the surface worldspace normal i sample from 3 of the ambient cube sides and blend between them depending on the normals direction.
This gives pretty good results and the surface detail from the normalmap is visible even when shadowed.

Wednesday, January 26, 2005

What's new

Been busy the last week because I finally got a new computer to put the 6800 in.
The card is fast, VERY fast and with SM 3.0, Ultrashadow, floating point blending etc I've been able to increase the visual quality and get a nice speedbost.
Also implemented the volumetric lightning a little different and now its very fast.
Got rid of aliasing problems regarding the volumetric light and right now I'm in the process of adding volumetric fog.
Overall it's starting to look really good when everything starts coming together :)