Skip to content

Commit 9b140fd

Browse files
authored
fix: caustics set FBO type to HalfFloatType when OES_texture_float_linear is not supported (#87)
1 parent fb07657 commit 9b140fd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/core/Caustics.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,12 @@ const NORMALPROPS = {
258258
type: THREE.UnsignedByteType,
259259
}
260260

261-
const CAUSTICPROPS = {
261+
const CAUSTICPROPS: {
262+
minFilter: THREE.MinificationTextureFilter
263+
magFilter: THREE.MagnificationTextureFilter
264+
type: THREE.TextureDataType
265+
generateMipmaps: boolean
266+
} = {
262267
minFilter: THREE.LinearMipmapLinearFilter,
263268
magFilter: THREE.LinearFilter,
264269
type: THREE.FloatType,
@@ -525,6 +530,12 @@ export const Caustics = (
525530
const res = params.resolution
526531
const normalTarget = useFBO(res, res, NORMALPROPS)
527532
const normalTargetB = useFBO(res, res, NORMALPROPS)
533+
534+
if (!renderer.extensions.get('OES_texture_float_linear')) {
535+
console.warn('Caustics: OES_texture_float_linear extension is not supported, using HalfFloatType instead.')
536+
CAUSTICPROPS.type = THREE.HalfFloatType
537+
}
538+
528539
const causticsTarget = useFBO(res, res, CAUSTICPROPS)
529540
const causticsTargetB = useFBO(res, res, CAUSTICPROPS)
530541

0 commit comments

Comments
 (0)