Original glTF Helmet Analogue with Studio IBL

Contents Previous Next

Install

npm install -g @lmctl-ai/lmctl

lmvideo 0.1.38 is released. Source examples are pinned to public commit aab2677.

Download lmvideo 0.1.38

Original dome, visor, rim and ear helmet analogue is exported to and re-imported from GLB with authored albedo, ORM and normal inputs under a generated studio environment.

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-06-helmet-ibl.lms

Source

# B06 original helmet analogue with authored PBR maps and GLB round trip.
mkdir("build");program=_lmcode_ cli="lmvideo" install="github:lmctl-ai/lmvideo@v0.1.38";
let albedo=texture_checker("#33495f","#617a8e",9).mix(texture_noise("perlin",1717,7),0.16).bake(128,128,"srgb").wrap("repeat","repeat").filter("trilinear");
let orm=texture_from_image(image_pattern(128,128,"1","0.28+0.28*x/128","0.65+0.25*y/128","1"),"linear"); let normal=texture_from_image(image_pattern(128,128,"0.5+0.04*sin(x/4)","0.5+0.04*cos(y/5)","1","1"),"linear");
let sky="";for(j in range(0,16)){for(i in range(0,32)){let x=float(i)/31.0;let y=float(j)/15.0;let key=12.0*pow(2.718281828459045,-120.0*(x-0.28)*(x-0.28)-30.0*(y-0.4)*(y-0.4));if(sky!=""){sky=sky+",";}sky=sky+str(0.15+key)+","+str(0.20+key*0.92)+","+str(0.30+key*0.78);}}
let studio=environment_linear(32,16,sky);let emissive=texture_from_image(image_pattern(128,128,"0.02","0.03+0.02*sin(x*16)","0.06+0.04*cos(y*12)","1"),"srgb");
let scene=scene3d().threads(4).background("#dce5ed").ambient(0.05).environment(studio,0.65,18.0,true).tonemap("aces",1.0);scene.camera(camera3d().look_at(3.8,2.3,6.5,0.0,0.3,0.0).perspective(38.0,0.1,50.0));scene.directional_light(2.0,4.0,5.0,"#fff0da",2.6).directional_light(-4.0,2.0,1.0,"#9fc7ef",1.2);
let helmet=scene.group();let pbr=material("#ffffff",0.72,0.25).albedo(albedo).orm(orm).normal(normal).emissive("#4477cc",0.22).emission(emissive);scene.add(mesh_sphere(0.95,24,40),pbr).scale(1.0,0.88,0.82).position(0.0,0.42,0.0).parent(helmet);scene.add(mesh_box(1.24,0.28,0.16),pbr).position(0.0,0.35,0.73).parent(helmet);scene.add(mesh_box(0.58,0.18,0.22),pbr).position(0.0,-0.04,0.74).parent(helmet);scene.add(mesh_torus(0.76,0.09,16,32),pbr).position(0.0,-0.35,0.0).rotation(90.0,0.0,0.0).parent(helmet);scene.add(mesh_cylinder(0.22,0.18,24),pbr).position(-0.82,0.2,0.0).rotation(0.0,0.0,90.0).parent(helmet);scene.add(mesh_cylinder(0.22,0.18,24),pbr).position(0.82,0.2,0.0).rotation(0.0,0.0,90.0).parent(helmet);
scene.clear_environment();scene.export_gltf("build/original-helmet-analogue.glb",true);let loaded=scene3d().threads(4).background("#dce5ed").ambient(0.05).environment(studio,0.65,18.0,true).tonemap("aces",1.0);loaded.camera(camera3d().look_at(3.8,2.3,6.5,0.0,0.3,0.0).perspective(38.0,0.1,50.0));loaded.import_gltf("build/original-helmet-analogue.glb",1.0);let image=loaded.render_image(900,560,2);image.save("build/bench-06-helmet-ibl.png");image_assert_true(image.stddev(0)>0.05);out.print("original helmet dome visor rim ears; GLB with albedo ORM normal emissive; generated studio environment");
end _lmcode_
r=run_lmcode(program);assert(r.ok,(r.ok ? "" : r.message));println(json_stringify(r.result));

Raw LMScript source

A helmet-shaped object with a visor, side pieces and reflective rim.
Inspect the textured surfaces and their studio reflections.