-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
WebGPURenderer: Improve AO approach #28863
base: dev
Are you sure you want to change the base?
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
src/nodes/display/AfterImageNode.js
Outdated
@@ -2,14 +2,15 @@ | |||
import { nodeObject, addNodeElement, tslFn, float, vec4 } from '../shadernode/ShaderNode.js'; | |||
import { NodeUpdateType } from '../core/constants.js'; | |||
import { uv } from '../accessors/UVNode.js'; | |||
import { after } from '../utils/AfterNode.js' |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
I'm all in for improving quality but we have to make sure to make the examples not too complex. Or at least we should provide a good mix of simple and advanced demos. Hence, I suggest to keep Then we can add advanced examples ( A component like That said, it should still be easy to configure a basic pass chain on app level so I would like to not move away from this possibility. But it's a good idea to provide a component like |
@@ -20,7 +20,7 @@ | |||
<script type="module"> | |||
|
|||
import * as THREE from 'three'; | |||
import { pass, mrt, output, transformedNormalView } from 'three/tsl'; | |||
import { uniform, pass, standardPass } from 'three/tsl'; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
I was coming to this conclusion too, yesterday I made some related modifications and I'm updating the PR. I was thinking about just keeping What do you think about This should be the code necessary to obtain AO: postProcessing = new THREE.PostProcessing( renderer );
const scenePass = standardPass( scene, camera, { enableAO: true } );
// scenePass.aoIntensityNode = uniform( 1 ); // optional
postProcessing.outputNode = scenePass; I thought about the possibility of having an opaquePass that we could share but we would have problems with the AO not respecting the lighting model. |
Yes, it should be possible to enable/disable the effects. But tbh, I'm still unsure about the API at this point and would like to hear the opinion of @mrdoob. The thing is....if we have something like It reminds me a bit at the old material system from FX is in general a custom step and pass chains usually look different from app to app. I'm not familiar enough with something like That said, I would only use I would consider |
MRT also results in other overheads, I don't think this approach would have that much overhead considering the benefits. I can't see an ideal scenario for using AO when it's not compatible with transparent materials outside of our example bubble. About Maybe the ideal would be to have an |
I'll look for a way to remove |
Could we at least make the the opaque pass configurable so if not wanted it can be disabled? In this case the normal and depth buffer from the beauty pass should be used. Edit: I'm okay if opaque pass is used by default. But it would be great to have the option for an optimization.
Sounds good! |
|
||
let camera, scene, renderer, postProcessing, controls, clock, stats, mixer; | ||
|
||
let aoPass, denoisePass, blendPassAO, blendPassDenoise, scenePassColor, aoIntensity; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
|
||
let camera, scene, renderer, postProcessing, controls, clock, stats, mixer; | ||
|
||
let aoPass, denoisePass, blendPassAO, blendPassDenoise, scenePassColor, aoIntensity; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
|
||
let camera, scene, renderer, postProcessing, controls, clock, stats, mixer; | ||
|
||
let aoPass, denoisePass, blendPassAO, blendPassDenoise, scenePassColor, aoIntensity; |
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Related issue: #28844
Description
Introduce NodeHandler
You could manipulate materials individually, allowing direct customization of materials globally. This would be a step towards solving Add support for skinning >4 bones per vertex with a bone weight texture #26222 (comment)
Introduce renderer.transparent and renderer.opaque
I added new handlers to have different approaches in transparent and opaque materials, important for the pass() approach.
TSL: Introduce after and before
Allows you to control the sequence of node updates, important for
pass()
andnode.updateBefore()
add standardPass() and improve ao approach
The idea here is to have a simplified
pass()
making available the main and common resources of the renderer, such asao
,bloom
,3dlut
, which can be enabled or disabled, leaving the approach part to us, which would simplify mainly for the beginner to have a PP of good quality.I'll create separate PRs for
render.transparent/opaque
,NodeHandler
andafter/before
before merge this one.AO Approch
Live example
I will improve this example too 😅. It is possible to see a transparent object and an emissive one respecting the lighting model.