-
-
Notifications
You must be signed in to change notification settings - Fork 287
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
Support camera depth texture #1658
Conversation
pipelineStage: PipelineStage.ShadowCaster | ||
}; | ||
}); | ||
const basePasses = [depthOnlyPass, shadowCasterPass]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use [shadowCasterPass, depthOnlyPass] to be compatible with previous usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
#include <blendShape_vert> | ||
#include <skinning_vert> | ||
|
||
gl_Position = renderer_MVPMat * position; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use #include <position_vert>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,3 @@ | |||
void main() { | |||
gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete this line is better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* @internal | ||
* Culling results. | ||
*/ | ||
export class CullingResults { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not called RendererQueueManager
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The design is just save the cull info to save cull performance
*/ | ||
static recreateTextureIfNeeded( | ||
engine: Engine, | ||
currentTexture: Texture2D, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentTexture: Texture2D | void
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done with currentTexture: Texture2D | null
*/ | ||
static recreateRenderTargetIfNeeded( | ||
engine: Engine, | ||
currentRenderTarget: RenderTarget, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
currentRenderTarget: RenderTarget | void
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -0,0 +1,21 @@ | |||
import { Engine } from "../Engine"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this file should migrate to core/src/RenderPipeline
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
export abstract class PipelinePass { | ||
protected _engine: Engine; | ||
|
||
constructor(engine: Engine) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think based on Camera
is better, DepthOnlyPass
and CascadedShadowCasterPass
will be more suitable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Different camera use the same Pipeline pass instance, should not bind camera in constrouctor
* @param context - Rendering context | ||
* @param cullingResults - Culling results | ||
*/ | ||
abstract onRender(context: RenderContext, cullingResults: CullingResults): void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if based on camera
, context
and cullingResults
can be ignored from camera.engine._renderContext
and camera.renderPipeline._cullingResults
packages/core/src/Camera.ts
Outdated
@@ -32,9 +33,11 @@ class MathTemp { | |||
@dependentComponents(Transform, DependentMode.CheckOnly) | |||
export class Camera extends Component { | |||
/** @internal */ | |||
static _cameraTextureProperty = ShaderProperty.getByName("camera_DepthTexture"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_cameraDepthTextureProperty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -179,7 +173,8 @@ export class BasicRenderPipeline { | |||
cubeFace?: TextureCubeFace, | |||
mipLevel?: number | |||
) { | |||
pass.preRender(camera, this._opaqueQueue, this._alphaTestQueue, this._transparentQueue); | |||
const cullingResults = this._cullingResults; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const {opaqueQueue, alphaTestQueue, transparentQueue} = cullingResults;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
* dev/1.1: (48 commits) fix: skin mesh error (galacean#1675) fix: test error (galacean#1674) test: fix github test (galacean#1669) test: fix ci not work (galacean#1670) glTF support basisu (galacean#1662) fix: `EventDispatcher` static pool bug fix: eventdispatcher bug (galacean#1671) fix: animation event bug (galacean#1666) Shader pass support blend (galacean#1668) Fix model mesh advanced data write bug (galacean#1663) Cherry pick glTF conflict (galacean#1660) Fix worker status set error and can't throw error bug (galacean#1652) Fix parse glTF texture wrap & filterMode bug (galacean#1659) Add shader lab package and support shader framework (galacean#1610) Fix text wrap bug (galacean#1644) chore: use strict error msg and type (galacean#1647) Fix text error for set text to "" and set enableWrapping to true (galacean#1634) "v1.0.0-beta.17" Process GLTFBufferParser and GLTFTextureParser pipelines in parallel (galacean#1638) Fix animation clip loader, clip change promise to assetPromise, controller json parse (galacean#1506) ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
* dev/1.1: `SkinnedMeshRenderer` support immediate initialization of `rootBone` and `bones` (galacean#1672) Support camera depth texture (galacean#1658)
* dev/1.1: (66 commits) build: fix pnpm lock file build: fix pnpm-lock file build: fix pnpm-lock file build: fix build error `ResourceManager` support `findResourcesByType` (galacean#1700) fix: memory leak of Transform (galacean#1701) fix: file name error "v1.1.0-alpha.1" test(RenderTarget): fix `getColorTexture` error Fix ktx2 loader can't throw error (galacean#1699) Enhance type for `LoadItem` & `Entity.getComponent` (galacean#1696) types: opt getComponent return type types: fix lint Fix ci test (galacean#1677) Shader Lab support `RenderState` (galacean#1664) feat: enhance type for `LoadItem` & `Entity.getComponent` fix: variable error (galacean#1693) `SkinnedMeshRenderer` support immediate initialization of `rootBone` and `bones` (galacean#1672) Support camera depth texture (galacean#1658) "v1.0.0-beta.18" ... # Conflicts: # packages/loader/src/gltf/parser/GLTFSceneParser.ts # packages/loader/src/gltf/parser/GLTFSkinParser.ts # tests/src/loader/GLTFLoader.test.ts
Please check if the PR fulfills these requirements
Feat:
depthTextureMode
pixelViewport
Playground:galacean/galacean.github.io#764