Skip to content

Commit e5bb1cc

Browse files
committed
3D-RandomLocal mapping: Fix inconsistencies with 3D-Local mapping
1 parent 3007d54 commit e5bb1cc

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/slg/textures/mapping/mapping.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,6 @@ LocalRandomMapping3D::LocalRandomMapping3D(const luxrays::Transform &w2l, const
316316
Point LocalRandomMapping3D::Map(const HitPoint &hitPoint, Normal *shadeN) const {
317317
Transform w2t = worldToLocal / hitPoint.localToWorld;
318318

319-
if (shadeN)
320-
*shadeN = Normalize(w2t * hitPoint.shadeN);
321-
322319
// Select random parameters
323320
u_int seed;
324321
switch (seedType) {
@@ -350,11 +347,14 @@ Point LocalRandomMapping3D::Map(const HitPoint &hitPoint, Normal *shadeN) const
350347
const float zTranslate = Lerp(rndGen.floatValue(), zTranslateMin, zTranslateMax);
351348

352349
w2t =
353-
Scale(xScale, yScale, zScale) *
354-
RotateX(xRotation) * RotateY(yRotation) * RotateZ(zRotation) *
355350
Translate(Vector(xTranslate, yTranslate, zTranslate)) *
351+
RotateX(xRotation) * RotateY(yRotation) * RotateZ(zRotation) *
352+
Scale(xScale, yScale, zScale) *
356353
w2t;
357354

355+
if (shadeN)
356+
*shadeN = Normalize(w2t * hitPoint.shadeN);
357+
358358
return w2t * hitPoint.p;
359359
}
360360

0 commit comments

Comments
 (0)