solstice

Compute collected power and efficiencies of a solar plant
git clone git://git.meso-star.com/solstice.git
Log | Files | Refs | README | LICENSE

commit ba45aa5f7dd5aa1ec93e091f7f983df1821c5494
parent 04fc04a8f336416b5dfbe62239be7b67879c774f
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Thu,  6 Apr 2017 15:59:09 +0200

Fix the wrong tangent space in the matte normal mapping

Use the partial derivatives of the position in U and V to build the
tangent space to world space matrix.

Diffstat:
Msrc/solstice_material.c | 7++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/solstice_material.c b/src/solstice_material.c @@ -75,7 +75,12 @@ matte_get_normal SSOL(image_sample(param->normal_map, SSOL_FILTER_NEAREST, SSOL_ADDRESS_CLAMP, SSOL_ADDRESS_CLAMP, frag->uv, N)); - d33_basis(basis, frag->Ns); + d3_set(basis+0, frag->dPdu); + d3_set(basis+3, frag->dPdv); + d3_set(basis+6, frag->Ng); + d3_normalize(basis + 0, basis + 0); + d3_normalize(basis + 3, basis + 3); + d3_subd(N, d3_muld(N, N, 2), 1); d33_muld3(N, basis, N); d3_normalize(val, N);