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

Camera support opaque texture #1989

Merged
merged 46 commits into from
Mar 5, 2024

Conversation

GuoLei1990
Copy link
Member

@GuoLei1990 GuoLei1990 commented Jan 31, 2024

Please check if the PR fulfills these requirements

  • The commit message follows our guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behavior? (You can also link to an open issue here)

What is the new behavior (if this is a feature change)?

Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)

Major changes:

  • Camera support opaque texture with opaqueTextureEnabled and opaqueTextureDownsampling
  • Camera support enable independent Canvas by independentCanvasEnabled, enable this can on/off MSAA per camera by msaaSamples (opaqueTextureEnabled force turn on this mode)
  • Add BasicResources class to store internal resource
  • Remove internal function _setRenderTargetInfo to simplify the logic

TODO:

  • Support camera viewport
  • Opt API
  • camera viewport
  • MSAA
  • Remove render pass
  • RenderTarget Test
  • recreateRenderTargetIfNeeded depthTexture waste
  • framebuffer 重复绑定
  • PerCamera MSAA with no OpaqueTexture

Future:

  • support blit scaleOffset
  • Refactor Basic Resource
  • ClearFlag(No Color) with invalidateFramebuffer
  • SetActiveTarget viewport 可能存在重复设置浪费
  • Blit 优化(Triangle 模式等)

@GuoLei1990 GuoLei1990 marked this pull request as draft January 31, 2024 02:02
@GuoLei1990 GuoLei1990 added enhancement New feature or request shader Shader related functions camera labels Feb 1, 2024
* dev/1.2: (29 commits)
  Add `Preprocessor` in `ShaderLab` (galacean#2009)
  "v1.2.0-alpha.11"
  Add ShaderLab package umd entry (galacean#2006)
  Fix primitive e2e error (galacean#2007)
  "v1.2.0-alpha.10"
  "v1.1.0-beta.49"
  "v1.1.0-beta.48"
  Physics raycast hitResult add shape (galacean#2004)
  Fix output glsl error when `function overload` exists in shaderlab source code (galacean#2001)
  refactor: adapter shadowFadeBorder exported from editor (galacean#1999)
  refactor(render-sort-compare): opt compare code (galacean#2002)
  feat: modify the method of generating the path (galacean#2000)
  "v1.1.0-beta.47"
  Fix`gl.MIN` and `gl.MAX` doesn't exist in `webgl1` (galacean#1990)
  Fix glb/gltf use extension parse (galacean#1992)
  "v1.1.0-beta.46"
  Fix query path error (galacean#1986)
  "v1.1.0-beta.45"
  "v1.1.0-beta.44"
  Fix the problem of resetting `HtmlCanvas.ClientXXX` when call `canvas.resizeByClientSize()` (galacean#1984)
  ...
* dev/1.2:
  Fix animation error (galacean#2014)
  Fix camera renderTarget flip error (galacean#1997)
// Check if need to create internal color texture
const independentCanvasEnabled = camera.independentCanvasEnabled;
if (independentCanvasEnabled && Vector4.equals(camera.viewport, PipelineUtils.defaultViewport)) {
console.warn(
Copy link
Member

Choose a reason for hiding this comment

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

use "Logger." in loop

Copy link
Member Author

@GuoLei1990 GuoLei1990 Mar 4, 2024

Choose a reason for hiding this comment

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

Done,but...

} else {
const internalColorTarget = this._internalColorTarget;
if (internalColorTarget) {
internalColorTarget.destroy();
Copy link
Member

Choose a reason for hiding this comment

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

will gc crash when switch renderTarget and open opaqueTextureEnabled

@zhuxudong
Copy link
Member

zhuxudong commented Feb 28, 2024

do we should flip viewport when context.flipProjection is true ?
image

Has BUG

@GuoLei1990
Copy link
Member Author

GuoLei1990 commented Mar 4, 2024

do we should flip viewport when context.flipProjection is true ? image

Yes,has BUG!!!

Fixed!!!

@GuoLei1990
Copy link
Member Author

GuoLei1990 commented Mar 4, 2024

image
I check TextureCube is inverse too!!! @zhuxudong

@GuoLei1990 GuoLei1990 merged commit eeb5a59 into galacean:dev/1.2 Mar 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
camera enhancement New feature or request shader Shader related functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants