OverviewFilesCommitsIssuesDocsReleasesPeers

blender-bridge commits / 902d253

Add VT lookup shader for virtual texture atlas sampling (v0.13.0)
Shader samples from the physical tile atlas via page table indirection. Falls back to uniform albedo_color when tiles are not yet resident. Page table format: R=atlas_x, G=atlas_y, B=valid, A=unused. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
902d2533ffbae35136333cc5278dba4819c3436e
by plankatron <fleeky@gmail.com> · 2026-03-03T20:25:34.000Z

Changed files (4) +40 -3

blender_addon/__init__.py +1 -1
……@@ -11,7 +11,7 @@ Usage:
1111
1212import bpy
1313
14ADDON_VERSION = "0.12.2"
14ADDON_VERSION = "0.13.0"
1515
1616# Support hot-reload (F3 > Reload Scripts)
1717if "shm_protocol" in locals():
blender_addon/blender_manifest.toml +1 -1
……@@ -2,7 +2,7 @@ schema_version = "1.0.0"
22id = "blender_godot_bridge"
33name = "Blender-Godot Bridge"
44tagline = "Real-time bidirectional scene sync with Godot"
5version = "0.12.2"
5version = "0.13.0"
66blender_version_min = "4.2.0"
77type = "add-on"
88maintainer = "blender-bridge <noreply@localhost>"
src/blender_bridge.cpp +1 -1
……@@ -163,7 +163,7 @@ Error BlenderBridge::start_server(const String &socket_path) {
163163 _known_instance_ids.clear();
164164 _next_object_id = 1;
165165
166 UtilityFunctions::print("BlenderBridge v0.12.2: Server started (shm=", _shm_name, ", sock=", socket_path, ", regions=2x", (int)_region_size, ")");
166 UtilityFunctions::print("BlenderBridge v0.13.0: Server started (shm=", _shm_name, ", sock=", socket_path, ", regions=2x", (int)_region_size, ")");
167167 return OK;
168168}
169169
src/vt_lookup.gdshader +37 -0
……@@ -0,0 +1,37 @@
1shader_type spatial;
2
3// ── Virtual Texture atlas and page table ────────────────────────────────────
4uniform sampler2D vt_atlas : source_color, filter_linear, repeat_disable;
5uniform sampler2D vt_page_table : filter_nearest, repeat_disable;
6
7// Cache geometry: 1.0 / cache_grid_size (e.g. 1/32 = 0.03125)
8uniform float tile_size_uv;
9// Virtual tiles per edge at mip 0 (e.g. 128)
10uniform float page_table_size;
11
12// ── Material fallbacks (used when tile not yet resident) ────────────────────
13uniform vec4 albedo_color : source_color = vec4(0.8, 0.8, 0.8, 1.0);
14uniform float roughness : hint_range(0,1) = 0.5;
15uniform float metallic : hint_range(0,1) = 0.0;
16
17void fragment() {
18 // Virtual tile address from UV
19 vec2 vt_coord = UV * page_table_size;
20 ivec2 tile_id = ivec2(floor(vt_coord));
21 vec2 in_tile_frac = fract(vt_coord);
22
23 // Page table texel: R=atlas_x, G=atlas_y, B=valid, A=0
24 vec4 page = texelFetch(vt_page_table, tile_id, 0);
25
26 if (page.b > 0.5) {
27 // Tile is resident — sample from atlas
28 vec2 atlas_uv = (vec2(page.r, page.g) * 255.0 + in_tile_frac) * tile_size_uv;
29 ALBEDO = texture(vt_atlas, atlas_uv).rgb;
30 } else {
31 // Tile not loaded — use fallback color
32 ALBEDO = albedo_color.rgb;
33 }
34
35 ROUGHNESS = roughness;
36 METALLIC = metallic;
37}