feat(web): finish RE 5000PBR lesson video and fix non-ASCII GLB import
- Add 11:07 Chinese-narrated lesson video, VTT, poster and 13 chapter screenshots. - Regenerate 20-render WebGL2 matrix and 15 operation captures on RTX 4060. - Fix WASM staging for non-ASCII import filenames (猴头.glb); rebuild web_engine. - Harden lesson video recording pipeline; fix stale lesson-link E2E selector. - Add RE PBR derived libraries, lesson page, evidence and status report. Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -92,23 +92,19 @@ def add_wood_texture(material, principled):
|
||||
pixels[index + 3] = 1.0
|
||||
image = bpy.data.images.new("PBR Wood Grain", width=size, height=size, alpha=False)
|
||||
image.pixels = pixels
|
||||
image.filepath_raw = str(pathlib.Path(bpy.app.tempdir) / "pbr-wood-grain.png")
|
||||
image.file_format = "PNG"
|
||||
image.save()
|
||||
image.pack()
|
||||
pathlib.Path(image.filepath_raw).unlink(missing_ok=True)
|
||||
image.name = "PBR Wood Grain"
|
||||
|
||||
nodes = material.node_tree.nodes
|
||||
links = material.node_tree.links
|
||||
uv = nodes.new("ShaderNodeUVMap")
|
||||
uv.name = "PBR Wood UV"
|
||||
uv.uv_map = "UVMap"
|
||||
mapping = nodes.new("ShaderNodeMapping")
|
||||
mapping.name = "PBR Wood Mapping"
|
||||
mapping.inputs["Scale"].default_value = (2.0, 4.0, 1.0)
|
||||
texture = nodes.new("ShaderNodeTexImage")
|
||||
texture.name = "PBR Wood Image"
|
||||
texture.image = image
|
||||
texture.interpolation = "Linear"
|
||||
links.new(uv.outputs["UV"], mapping.inputs["Vector"])
|
||||
links.new(mapping.outputs["Vector"], texture.inputs["Vector"])
|
||||
links.new(texture.outputs["Color"], principled.inputs["Base Color"])
|
||||
set_input(principled, ["Roughness"], 0.52)
|
||||
set_input(principled, ["Metallic"], 0.0)
|
||||
@@ -145,8 +141,10 @@ def build_materials():
|
||||
materials.append((plastic_white, CATALOG_BY_PATH["Materials/Plastic"], "Matte white plastic", ("plastic", "white")))
|
||||
|
||||
wood, p = new_material("PBR Wood")
|
||||
add_wood_texture(wood, p)
|
||||
materials.append((wood, CATALOG_BY_PATH["Materials/Wood"], "Varnished wood with packed grain", ("wood", "texture")))
|
||||
set_input(p, ["Base Color"], (0.32, 0.16, 0.06, 1.0))
|
||||
set_input(p, ["Metallic"], 0.0)
|
||||
set_input(p, ["Roughness"], 0.52)
|
||||
materials.append((wood, CATALOG_BY_PATH["Materials/Wood"], "Warm matte wood colour", ("wood", "warm")))
|
||||
|
||||
glass, p = new_material("PBR Glass")
|
||||
set_input(p, ["Base Color"], (0.92, 0.96, 1.0, 1.0))
|
||||
@@ -230,6 +228,13 @@ def build_model(kind, name, material, catalog_path):
|
||||
obj.data.name = f"{name} Mesh"
|
||||
bpy.ops.object.transform_apply(location=False, rotation=True, scale=True)
|
||||
ensure_uv(obj)
|
||||
bpy.ops.object.select_all(action="DESELECT")
|
||||
obj.select_set(True)
|
||||
bpy.context.view_layer.objects.active = obj
|
||||
bpy.ops.object.mode_set(mode="EDIT")
|
||||
bpy.ops.mesh.select_all(action="SELECT")
|
||||
bpy.ops.mesh.normals_make_consistent(inside=False)
|
||||
bpy.ops.object.mode_set(mode="OBJECT")
|
||||
obj.data.materials.clear()
|
||||
obj.data.materials.append(material)
|
||||
obj.asset_mark()
|
||||
|
||||
Reference in New Issue
Block a user