- Added "anisotropic" rendering for static particle hair strands.
This means the diffuse and specular shaders don't use the normal for hair (which is actually undefined, a hair is micro cylinder) but it uses the tangent vector (vector in direction of hair). For Diffuse, it computes a fake normal now, representing the optimal hair normal pointing towards the light. All current builtin shaders work with this, including ramps. For Specular, it uses another formula to remap dot products for all lines that now use the tangent vector instead of the normal: dot = vector * tangent dot = sqrt(1.0 - dot*dot) Gives better results than using the 'fake' normal for diffuse. Officially (according the papers) this could be used for diffuse too, but then hair becomes very flat. Now you can control the flatness easily with ramps or using Oren-Nayer for example. Example image (disappears in some weeks) http://www.blender.org/bf/rt9.jpg - Added new texture channel "Strand" to apply textures on hairs over the length of hair (1 dimensional). Orco now gives 1 fixed coordinate for the entire hair, based on where it starts. Note; UV doesn't work yet. Nor vertexcolor. http://www.blender.org/bf/rt10.jpg
This commit is contained in:
@@ -795,6 +795,9 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
|
||||
if(mat->texco & TEXCO_UV) {
|
||||
VECCOPY(shi->uv, shi->lo);
|
||||
}
|
||||
if(mat->texco & TEXCO_STRAND) {
|
||||
shi->strand= shi->lo[0];
|
||||
}
|
||||
if(mat->texco & TEXCO_OBJECT) {
|
||||
VECCOPY(shi->co, shi->lo);
|
||||
}
|
||||
@@ -883,15 +886,15 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
|
||||
float specfac;
|
||||
|
||||
if(mat->spec_shader==MA_SPEC_PHONG)
|
||||
specfac= Phong_Spec(shi->vn, lv, shi->view, shi->har);
|
||||
specfac= Phong_Spec(shi->vn, lv, shi->view, shi->har, 0);
|
||||
else if(mat->spec_shader==MA_SPEC_COOKTORR)
|
||||
specfac= CookTorr_Spec(shi->vn, lv, shi->view, shi->har);
|
||||
specfac= CookTorr_Spec(shi->vn, lv, shi->view, shi->har, 0);
|
||||
else if(mat->spec_shader==MA_SPEC_BLINN)
|
||||
specfac= Blinn_Spec(shi->vn, lv, shi->view, mat->refrac, (float)shi->har);
|
||||
specfac= Blinn_Spec(shi->vn, lv, shi->view, mat->refrac, (float)shi->har, 0);
|
||||
else if(mat->spec_shader==MA_SPEC_WARDISO)
|
||||
specfac= WardIso_Spec(shi->vn, lv, shi->view, mat->rms);
|
||||
specfac= WardIso_Spec(shi->vn, lv, shi->view, mat->rms, 0);
|
||||
else
|
||||
specfac= Toon_Spec(shi->vn, lv, shi->view, mat->param[2], mat->param[3]);
|
||||
specfac= Toon_Spec(shi->vn, lv, shi->view, mat->param[2], mat->param[3], 0);
|
||||
|
||||
inprspec= specfac*shi->spec;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user