ScatterSky zOffset

Expanding and utilizing the engine via C++.
5 posts Page 1 of 1
Happenstance
Posts: 54
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Fri Jul 06, 2018 7:13 pm
So zOffset for ScatterSky has been broken for a while. I looked through the git history and the relevant change was going from this in 3.8:
   Point3F camPos2 = state->getCameraPosition();
   MatrixF xfm(true);
   xfm.setPosition(camPos2 - Point3F( 0, 0, mZOffset));
   GFX->multWorld(xfm);
   MatrixF xform(proj);//GFX->getProjectionMatrix());
   xform *= GFX->getViewMatrix();
   xform *=  GFX->getWorldMatrix();
to this as part of rextimmy's D3D11 commit (41e5caf):
   Point3F camPos2 = state->getCameraPosition();
   MatrixF xfm(true);
   
   GFX->multWorld(xfm);
   MatrixF xform(proj);//GFX->getProjectionMatrix());
   xform *= GFX->getViewMatrix();
   xform *=  GFX->getWorldMatrix();

   if(state->isReflectPass())
   {
      static MatrixF rotMat(EulerF(0.0, 0.0, M_PI_F));
      xform.mul(rotMat);
      rotMat.set(EulerF(M_PI_F, 0.0, 0.0));
      xform.mul(rotMat);
   }
   xform.setPosition(xform.getPosition() - Point3F(0, 0, mZOffset));
I can get zOffset working again by removing:
xform.setPosition(xform.getPosition() - Point3F(0, 0, mZoffset));
and replacing it with:
xfm.setPosition(camPos2 - Point3F(0, 0, mZoffset));
but matrices are not my strong suit so I feel like I'm overlooking something (probably breaking reflections somehow?).

Anyone see anything wrong this?
Timmy
Posts: 363
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Sat Jul 07, 2018 1:20 am
That change was from the commit before d3d11 but anyways your changes look fine, that is what it was originally, i am not sure why it was changed. Might have to check with @
User avatar
Azaezel
who made the change, he must have run into something to change it?
Azaezel
Posts: 413
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Sat Jul 07, 2018 1:21 am
Probably just an oversight. Apologies there.
Timmy
Posts: 363
Joined: Thu Feb 05, 2015 3:20 am
by Timmy » Sat Jul 07, 2018 6:01 am
@
User avatar
Happenstance
feel free to send a PR with that fix through, that way you get the credit for finding and fixing it.
Happenstance
Posts: 54
Joined: Sat Apr 11, 2015 9:08 pm
by Happenstance » Sat Jul 07, 2018 7:19 pm
Done! Thanks guys. :)
5 posts Page 1 of 1

Who is online

Users browsing this forum: No registered users and 5 guests