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

CameraFrame API in the engine #7129

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

mvaligursky
Copy link
Contributor

@mvaligursky mvaligursky commented Nov 21, 2024

Fixes #7129
(separate improvements / changes can be tracked separately)

This adds a new CameraFrame class as part of the engine, which is a public API for the currently exposed render pass based rendering.
The script which exposes this to the Editor now uses an instance of this CameraFrame, and simply passes attributes to it, without containing any logic. This allows it to not access any private engine functionality.

This is the new public API (too long to copy here)
https://github.com/playcanvas/engine/blob/mc-engine-camera-frame/src/extras/render-passes/camera-frame.js

  • also updated engine examples to use CameraFrame module directly, without using the script.
  • updated eslint config to ignore some custom tags we added to MJS scripts

* @typedef {Object} Bloom
* @property {number} intensity - The intensity of the bloom effect, 0-0.1 range. Defaults to 0,
* making it disabled.
* @property {number} lastMipLevel - The last mip level of the bloom effect, 0-12 range. Defaults to 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

I struggle to understand what this will do. Can we expose this in a more obvious/friendly way?

Comment on lines +36 to +42
* @property {string} type - The type of the SSAO determines how it is applied in the rendering
* process. Defaults to {@link SSAOTYPE_NONE}. Can be:
*
* - {@link SSAOTYPE_NONE}
* - {@link SSAOTYPE_LIGHTING}
* - {@link SSAOTYPE_COMBINE}
*
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally have trouble understanding/visualizing the 3 SSAO types. I would prefer an enabled flag and have it do the most common or nicest looking code path, but provide a further flag along the lines of 'ignoreLighting' or something.

*/

/**
* @typedef {Object} Bloom
Copy link
Contributor

Choose a reason for hiding this comment

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

I can't help but feel that an enabled property per effect would make for a more logical, guessable API.

* preference. Defaults to [{@link PIXELFORMAT_111110F}, {@link PIXELFORMAT_RGBA16F},
* {@link PIXELFORMAT_RGBA32F}].
* @property {boolean} stencil - Whether the render buffer has a stencil buffer. Defaults to false.
* @property {number} renderTargetScale - The scale of the frame buffer, 0.1-1 range. Defaults to 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not obvious what this does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: graphics Graphics related issue feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants