Repository navigation
iOS: volumes draw with 16-bit float transfer-function tables - #1213
Merged
Merged
Conversation
transfix
enabled auto-merge (squash)
November 13, 2026 02:16
transfix
force-pushed
the
fix/vtk-float-tables-ios
branch
from
November 14, 2026 08:27
03e7448 to
b321c43
Compare
VTK's GPU ray caster keeps a volume's transfer functions as float textures (RGB32F colour, R32F scalar and gradient opacity, RGBA32F 2-D tables), filtered with the volume's interpolation. WebGL2 filters 32F linearly only with OES_texture_float_linear, which iOS Safari lacks: a linearly filtered 32F texture there samples as zero, so a volume got no colour and no opacity. VolumeNode's vtkVolume is now a small subclass that, while it draws and only on a context without the extension, switches the context's default float texture formats to R16F/RG16F/RGB16F/RGBA16F and puts them back after. vtkTextureObject keeps the format a texture was first made with, so the volume's tables stay 16F and the rest of the scene's float textures (texture buffer vertex data above all) stay 32F. VolumeNode::setHalfFloatTextures forces it on or off for that node (a member of its vtkVolume, no process-wide state). New test cvcgl_volume_half_float (native, forced on): the volume renders the same as with 32F tables (worst pixel difference 1), its tables are 16F textures, and the defaults are 32F again after the draw. The demo page's ?hideext=A,B hides any WebGL extensions by name, as ?nofloatlinear hides OES_texture_float_linear (EXT_float_blend, say).
transfix
force-pushed
the
fix/vtk-float-tables-ios
branch
from
November 15, 2026 08:00
b321c43 to
f3cecaf
Compare
transfix
added a commit
that referenced
this pull request
Nov 16, 2026
…#1253, #1255, #1256, #1264, #1268, #1271, #1273, #1277) - ci.yml: the sanitizer list keeps this branch's tests (stream_test, net_ws_client_test, ariadne_host_test) and master's segmentation_intrinsics_test. - STATE_EXEC_THREADED.md: the room-call verbs (room-run is #1273's) and #1252's segment.seeded provider in the provider table, both registered without a kind. room-call's async functions stay on the app's host: a reply settles on the relay client's reader thread through host.finish, so moving them to *ictx.host needs a finisher first.
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #1166 (Joe: "fix the VTK float lookup tables too").
Cause. VTK's GPU ray caster keeps a volume's transfer functions as float textures (RGB32F colour, R32F scalar and gradient opacity, RGBA32F 2-D tables), filtered with the volume's interpolation (
vtkOpenGLVolumeRGBTable/vtkOpenGLVolumeOpacityTable→Create2DFromRaw(..., VTK_FLOAT, ...), format fromvtkOpenGLState's defaults). WebGL2 filters 32F linearly only withOES_texture_float_linear, which iOS Safari lacks: there a linearly filtered 32F texture samples as zero, so a volume gets no colour and no opacity. #1166 moved the cloud and sea voxels to bytes; this fixes the tables.Fix. VolumeNode's
vtkVolumeis now a small subclass. While it draws, and only on a context without the extension (anEM_JScheck ofGLctx.getExtension; desktop GL never), it switches the context's default float texture formats to R16F/RG16F/RGB16F/RGBA16F, then puts them back.vtkTextureObjectkeeps the format a texture was first made with, so the volume's tables stay 16F. The rest of the scene's float textures stay 32F, above all the texture-buffer vertex data: that's why a global switch was rejected.VolumeNode::setHalfFloatTextures(int)forces it on or off. VTK's protected format table is reached through a member pointer named in a derived class; no VTK patch is needed.Test. New
cvcgl_volume_half_float(native, forced on). The volume renders the same as with 32F tables: 6661 lit px each, mean |diff| 0.008, worst 1. With the switch on, two 16F textures exist (colour and opacity tables); with it off, none. The defaults read R32F/RGB32F again after the draw. Also passing locally:cvcgl_ariadne_realize,cvcgl_shadow_*,cvcgl_city_sun_shadows,cvcgl_volume_range,cvcgl_camera*,ariadne_runtime_test(14/14).Demo page.
?hideext=A,Bhides any WebGL extensions by name, as?nofloatlinearhidesOES_texture_float_linear. For example?hideext=EXT_float_blendtests whether missing float blending explains the iPhone's black clouds.Not checked: the wasm build in a browser, or a real iPhone. After deploy,
?nofloatlinearon the live terrain lab should show the near clouds again (before this, they vanished).