Tuesday 19 March 2013

Vertex-Color Backed Morph-Target




This research was made  for a  game who was happening inside the human body. Veins, heart, red cells, white cells, everything is alive and needs  to have animation.

I decide to try with a morphing base animation system. It will use one morph target and bake each new vertex position in the vertex color with the help of a Max Script


This is my first result: A beveled  cube morphing to a sphere. 
I used the original cube to do the sphere. I Applied a Spherify Modifier to it.










One problem: The normal are not changing..
Which is understandable, I did not morph the Normal.

So let  pack the normals and the morph-target together in the vertex color to have a better result. The unpack will be done in the Shader. A vertex Color is 8 bit resolution, 256 values.With the packing, I will have half resolution, only 4 bit so values. It will give me less precise result but its enough for organic shapes.


This is my second test  : Packed Morph-Target and normals together











As you can see , the position is not perfect when you look at the sphere but with a normal texture, the result is acceptable as you can see in the next video:

\

conclusion:
This Technic is not precise but enough for organic animation.

other example:

Friday 8 March 2013

Real-Time, Seamless Box Projection Mapping



I sample 3 times the same texture and The UV are created with the world position.


Code sample:
.......
float2 uvX = pos.yz;
float2 uvY = pos.zx;
float2 uvZ = pos.xy;
float4 textureX = tex2D(texSampler, uvX);
float4 textureY = tex2D(texSampler, uvY);
float4 textureZ = tex2D(texSampler, uvZ);
......
The  normals are used to lerp the textures.
......
float maskY = smoothstep(0.5f, 0.8f, abs(normal.y));
float maskZ = smoothstep(0.5f, 0.8f, abs(normal.z));
float4 finalLerp = lerp(textureX, textureY, maskY);
finalLerp = lerp(final, textureZ, maskZ);
......
This technique is more suitable for organic materials.

Video of the hlsl shader in 3dsmax



Monday 25 February 2013

Viscous Blurred Material with Parallax Offset



In this personal research, I was searching a way to make a multi layered viscous parallax effect Material.To achieve this effect I needed a way to blur a texture. If you blur by  using a filter, it could become very expensive performance wise. Finally what I found is simply offset the mimap from the texture to have a blurred result.

1 - I used the vertex color for the parallax intensity


2 - result with a parallax offset uvs



3- Adding the MipMap offset using the same Vertex Color


4 - Finally adding the lighting to it


Video of the effect running in 3DSMAX