-
-
Notifications
You must be signed in to change notification settings - Fork 36.1k
Renderer: Rename .getColorBufferType() -> .getOutputBufferType()
#32501
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
Conversation
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
| let bufferType = parameters.outputBufferType; | ||
|
|
||
| if ( bufferType === undefined ) { | ||
|
|
||
| bufferType = parameters.outputType; | ||
|
|
||
| } |
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.
Hm, I think we're going to create problems having outputBufferType override outputType. It must be possible to specify a higher-precision format for the frame buffer used before tone mapping, without necessarily having a higher-precision canvas format / drawing buffer.
I am a bit worried by how similar the "output" names are, too, but I'll put that comment in #32461.
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.
outputType would not be essential for defining the output buffer; if the user does not define outputBufferType, it will use the most appropriate one for output rendering. I think this is still consistent with the observation above.
Possible scenarios:
// canvas buffer 16bpc + 16bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.HalfFloatType,
outputBufferType: THREE.HalfFloatType
} );
// canvas buffer 16bpc + 8bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
outputBufferType: THREE.HalfFloatType
} );
// canvas buffer 8bpc + 16bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.HalfFloatType,
outputBufferType: THREE.UnsignedByteType
} );
// canvas buffer 8bpc + 8bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
outputBufferType: THREE.UnsignedByteType
} );
// reason for this conditional, most appropriate selection if not defined outputBufferType
// canvas buffer 16bpc + 16bpc output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.HalfFloatType
} );
// canvas buffer 8bpc + 8bpc output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
} );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 is the case I was thinking of:
// working buffer 16bpc + 8bpc screen output target
const renderer = new THREE.WebGPURenderer( {
outputType: THREE.UnsignedByteType,
outputBufferType: THREE.HalfFloatType
} );From a glance at the code it looks like outputType would be overridden by outputBufferType to HalfFloatType when configuring the WebGPU canvas context. I haven't tested this locally yet, though, and will try to do that.
EDIT: Tested and confirmed the issue.
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.
How about reverting the changes to getPreferredCanvasFormat() until there is an agreement on how to proceed?
I must also say the naming outputType and outputBufferType is a bit confusing to me. When outputType is mainly about the canvas, maybe canvasType is more clear?
|
@Mugen87 @sunag Please see the comment at #32501 (comment). The renaming part of the PR is OK with me, but overriding the canvas format to For example I've tested in |
|
I don't see anything different in that. As you can see, the canvas texture is 8bpc. Perhaps you are confusing it with? #27880
|
|
I'm setting a breakpoint here ... three.js/src/renderers/webgpu/WebGPUBackend.js Lines 262 to 270 in e49cd3f
... and seeing the canvas context configured to |
|
Apparently we have a related but different problem. The internals |
Cleanup after mrdoob#32501

Related issue: #32461 (comment)
Description
Rename
.getColorBufferType()->.getOutputBufferType().I also made the update related to canvas buffer setup #31893 (comment)