# 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));