wgt01: wire MAT_wgt01_* materials into blend
This commit is contained in:
BIN
Binary file not shown.
@@ -0,0 +1,31 @@
|
|||||||
|
"""Create/refresh MAT_wgt01_* materials in wgt01.blend (run headless)."""
|
||||||
|
import bpy, os
|
||||||
|
SLOTS = ["cobble", "worn", "plaza", "sidewlk", "wall", "bridge", "gutter", "water"]
|
||||||
|
BASE = os.path.dirname(bpy.data.filepath)
|
||||||
|
|
||||||
|
for slot in SLOTS:
|
||||||
|
name = f"MAT_wgt01_{slot}"
|
||||||
|
mat = bpy.data.materials.get(name) or bpy.data.materials.new(name)
|
||||||
|
mat.use_nodes = True
|
||||||
|
nt = mat.node_tree; nt.nodes.clear()
|
||||||
|
out = nt.nodes.new("ShaderNodeOutputMaterial")
|
||||||
|
bsdf = nt.nodes.new("ShaderNodeBsdfPrincipled")
|
||||||
|
nt.links.new(bsdf.outputs["BSDF"], out.inputs["Surface"])
|
||||||
|
d = os.path.join(BASE, "textures", f"wgt01_{slot}_d.tga")
|
||||||
|
img = bpy.data.images.load(d, check_existing=True)
|
||||||
|
img.filepath = f"//textures/wgt01_{slot}_d.tga"
|
||||||
|
tex = nt.nodes.new("ShaderNodeTexImage"); tex.image = img
|
||||||
|
nt.links.new(tex.outputs["Color"], bsdf.inputs["Base Color"])
|
||||||
|
n = os.path.join(BASE, "textures", f"wgt01_{slot}_n.tga")
|
||||||
|
if os.path.exists(n):
|
||||||
|
nimg = bpy.data.images.load(n, check_existing=True)
|
||||||
|
nimg.filepath = f"//textures/wgt01_{slot}_n.tga"; nimg.colorspace_settings.name = "Non-Color"
|
||||||
|
ntex = nt.nodes.new("ShaderNodeTexImage"); ntex.image = nimg
|
||||||
|
nmap = nt.nodes.new("ShaderNodeNormalMap")
|
||||||
|
nt.links.new(ntex.outputs["Color"], nmap.inputs["Color"])
|
||||||
|
nt.links.new(nmap.outputs["Normal"], bsdf.inputs["Normal"])
|
||||||
|
# wet look: low roughness on ground slots
|
||||||
|
bsdf.inputs["Roughness"].default_value = 0.35 if slot in ("cobble", "gutter", "water") else 0.6
|
||||||
|
|
||||||
|
bpy.ops.wm.save_mainfile()
|
||||||
|
print("WIRED:", ", ".join(f"MAT_wgt01_{s}" for s in SLOTS))
|
||||||
Reference in New Issue
Block a user