diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-09-22 23:37:30 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2008-09-22 23:37:30 +0400 |
commit | eef475ac7e34dd729dad12b8977c34015cf534a4 (patch) | |
tree | f770203658380dca64a1a9c0340766bfdd7e8bd9 /source/blender/render/intern | |
parent | 4e731c5ab5ba9e12748a5632329dcc0854def928 (diff) |
Fix for bug #11163: strand render without tangent shading didn't
give correct results.
Diffstat (limited to 'source/blender/render/intern')
-rw-r--r-- | source/blender/render/intern/source/shadeinput.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/source/blender/render/intern/source/shadeinput.c b/source/blender/render/intern/source/shadeinput.c index 7397d623264..8904999432a 100644 --- a/source/blender/render/intern/source/shadeinput.c +++ b/source/blender/render/intern/source/shadeinput.c @@ -343,10 +343,19 @@ void shade_input_set_strand(ShadeInput *shi, StrandRen *strand, StrandPoint *spo VECCOPY(shi->orignor, shi->facenor); /* shade_input_set_normals equivalent */ - if(shi->mat->mode & MA_TANGENT_STR) + if(shi->mat->mode & MA_TANGENT_STR) { VECCOPY(shi->vn, spoint->tan) - else - VECCOPY(shi->vn, spoint->nor) + } + else { + float cross[3]; + + Crossf(cross, spoint->co, spoint->tan); + Crossf(shi->vn, cross, spoint->tan); + Normalize(shi->vn); + + if(INPR(shi->vn, shi->view) < 0.0f) + VecMulf(shi->vn, -1.0f); + } VECCOPY(shi->vno, shi->vn); } |