Showing posts with label Shader. Show all posts
Showing posts with label Shader. Show all posts

Dynamic normalmaps for faces

Monday, October 19, 2009 | | 4 comment(s)

[update: included a short demo video]



Normal maps are standard. It's a great and simple technique to simulate three-dimensional surface structure and details on low polygon object.

Often it's enough to have a static texture for that, but sometimes the surface changes in a way that can't be represented by joint moments or blendshapes, for example fine creases in cloth, wrinkles in skin and so on. For these things it would be nice, to have different normal maps which could be blended together at runtime. But how to do that?


Alpha blending for realtime hair

Saturday, October 17, 2009 | | 2 comment(s)

With my project progressing, I finally have to take care about the hair.
All the rendering is based on polygons. But polygon edges are hard lines and hair is highly detailed and irregular. To get nice borders, some kind of transparency is needed. And here I ran into a problem, which I realized is well known, but has no real solution...


skin shading - stretch correction

Wednesday, September 30, 2009 | | 0 comment(s)

Ok, a little update on the skin shading, especially the calculation of the stretch correction map.

OPENGL & DERIVATION INSTRUCTIONS

I encountered a problem with the implementation of the stretch-map rendering. I use the ddx() function to get the derivative of the world position in UV space, i.e. how much the world position changes from one pixel to the next. This way you get a nice approximation of the texture coordinate distortion. For more information about the whole process have a look at my previous post here.


skin shading - texture space diffusion - part 2

Wednesday, September 9, 2009 | | 2 comment(s)

Interactive demo of my skin shader:

(requires the Unity Web Player plugin)


If you see only a black head, then probably your graphics card does not support ShaderModel 3 (only Nvidia GeForce-6, Ati Radeon-X1000 or newer).

For older graphics cards I captured a video of the demo:



skin shading - texture space diffusion - part 1

Tuesday, August 25, 2009 | | 0 comment(s)

I tried to improve the build-in shaders, to see if it would be enough for a decent skin shading. Often the specularity of virtual skin does not look right, so I decided to take care of that first. The standard shaders had only one fixed value for "shininess" per material and the specular intensity was not angular-dependent. So I extended the Bumped Specular shader to take an additional specular-texture, where the roughness is stored in the alpha channel and an fresnel term, that increases the intensity at very low angles.



shader development in unity

Saturday, August 22, 2009 | | 0 comment(s)

In the last weeks I concentrated on shader development, especially the skin shading.

I hadn't used ShaderLab, the shader language of Unity, before and the syntax was... well, a little bit tricky in the beginning. But after studying the build-in shaders a little bit, I quickly became familiar with it. The basic concepts of vertex- and pixelshaders I already knew from the time I wrote shaders in HLSL for a small testgame with Microsofts XNA Framework.

The first thing I implemented was a replacement for the ambient light. Ambient light is in most cases doesn't look very pretty, because it's the same color and brightness just everywhere. Instead of that I used a cubemap, to look up the color for each direction with something like this: