Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add camera property to ocean renderer #677

Merged
merged 5 commits into from
Nov 12, 2020
Merged

Conversation

daleeidd
Copy link
Collaborator

@daleeidd daleeidd commented Oct 26, 2020

Adds a camera property so that we have both viewpoint and camera.

Before we only had a viewpoint transform which could differ from the camera transform. There are times where we must use the camera like when populating the shadow data. This was a bug which @skaughtx0r reported on Discord.

We could use the main camera tag but using own property allows shadows to work with the scene camera correctly.

The viewpoint property should be kept as it still has use cases like camera zooming.

I've made ViewerHeightAboveWater sample the camera transform as I couldn't think of a reason to have that separate.

@huwb
Copy link
Contributor

huwb commented Oct 29, 2020

Looks good to me

@skaughtx0r
Copy link
Contributor

skaughtx0r commented Oct 29, 2020

Line 827 of OceanRenderer.cs should be:

Vector3 pos = Viewpoint.position;

Otherwise the ocean just follows the camera instead of the Viewpoint.

@daleeidd
Copy link
Collaborator Author

daleeidd commented Nov 2, 2020

Line 827 of OceanRenderer.cs should be:

Vector3 pos = Viewpoint.position;

Otherwise the ocean just follows the camera instead of the Viewpoint.

@skaughtx0r Sorry. I couldn't see the line you are referring to. Could you check again?

@skaughtx0r
Copy link
Contributor

@daleeidd Hmmm, I just checked the code in this branch and it looks fine.

I think I messed it up trying to merge this with my 2018 and PostProcessing branch.
Somehow in LateUpdatePosition() it was doing ViewCamera.transform.position.

PR looks good 👍

@daleeidd daleeidd requested a review from huwb November 11, 2020 19:44
Copy link
Contributor

@huwb huwb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great to me

@daleeidd daleeidd merged commit 42da938 into master Nov 12, 2020
@daleeidd
Copy link
Collaborator Author

Thank you both.

@daleeidd daleeidd added this to the Crest 4.7 milestone Nov 13, 2020
@daleeidd daleeidd deleted the feature/view-camera-property branch April 1, 2021 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants