Jump to content

ScatterSky zOffset


Happenstance

Recommended Posts

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?

Link to comment
Share on other sites

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 @Azaezel who made the change, he must have run into something to change it?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...