Tangent-Space Normal & Bump Mapped Relief
Install
npm install -g @lmctl-ai/lmctl
lmvideo 0.1.38 is released. Source examples are pinned to public commit aab2677.
Exact 900x560 relief medallion whose procedural height field is converted through the available CPU height-relief path and lit by a grazing directional key; a flat-vs-relief witness is asserted.
Verified acceptance capture, reproducible with the lmvideo 0.1.38 prerelease runtime.
Run this example
lmctl autorun https://raw.githubusercontent.com/lmctl-ai/lmvideo/aab2677a4b6264ae6afae8ad64a1d7c1dcd3a052/examples/showcase/bench-05-tangent-relief-medallion.lms
Source
# B05: analytic UV relief under a moving/grazing key; compare flat and height-normal paths.
mkdir("build");program=_lmcode_ cli="lmvideo" install="github:lmctl-ai/lmvideo@v0.1.38";
let height=image_pattern(256,256,"0.5+0.16*sin(x*26)*cos(y*23)+0.08*cos(x*51+y*17)","0.5+0.16*sin(x*26)*cos(y*23)+0.08*cos(x*51+y*17)","0.5+0.16*sin(x*26)*cos(y*23)+0.08*cos(x*51+y*17)","1");let quad=mesh_cylinder(1.45,0.12,96);let scene=scene3d().threads(4).background("#eaf0f6").ambient(0.025);scene.camera(camera3d().look_at(0.0,0.0,4.8,0.0,0.0,0.0).perspective(38.0,0.1,20.0));let mat=material("#bd7a3f",0.25,0.48);let node=scene.add(quad,mat).rotation(90.0,0.0,0.0);scene.point_light(3.0,0.35,1.0,"#fff4d6",35.0,20.0);let flat=scene.render_image(900,560,2);node.material(mat.copy().height(height,0.24,true));let relief=scene.render_image(900,560,2);image_assert_true(flat.rgba()!=relief.rgba()&&relief.width()==900&&relief.height()==560&&relief.stddev(0)>0.04);relief.save("build/bench-05-tangent-relief-medallion.png");
let moved=scene3d().threads(4).background("#eaf0f6").ambient(0.025);moved.camera(camera3d().look_at(0.0,0.0,4.8,0.0,0.0,0.0).perspective(38.0,0.1,20.0));moved.add(quad,mat.copy().height(height,0.24,true)).rotation(90.0,0.0,0.0);moved.point_light(-3.0,0.35,1.0,"#fff4d6",35.0,20.0);image_assert_true(moved.render_image(900,560,2).rgba()!=relief.rgba());out.print("Moving the grazing point light changes relief while flat/perturbed normals differ.");
end _lmcode_
r=run_lmcode(program);assert(r.ok,(r.ok ? "" : r.message));println(json_stringify(r.result));