SphereObjects are created in SceneEngine Lua calling the sceng.SphereObject factory.
Contents |
SphereObjects are created by calling the SphereObject Lua factory:
sphere_object = sceng.SphereObject( { radius=20.0, subdivs_axis=32, subdivs_height=32, material=ref_uv_material } )
This factory accets a table with named attributes and returns a node with the SphereObject as a dependency.
The following script creates a SphereObject with a material applied:
-- Open SceneEngine libraries require("sceng_lua") -- Create the Bitmap Texture ref_uv_texture = sceng.BitmapTexture( { file_path="maps/ref_uv.png" } ) -- Create the ShaderMaterial ref_uv_material = sceng.ShaderMaterial( { diffuse_color=sceng.Color(1,1,0), diffuse_texture=ref_uv_texture } ) -- Create the BoxObject sphere_object = sceng.SphereObject( { radius=20.0, subdivs_axis=32, subdivs_height=32, material=ref_uv_material } ) rp = sceng.RenderParameters() rp.output_file = "output/image.png" rp.width = 512 rp.height = 512 rp.samples = 2 -- Render the scene sceng.Render( rp )
This is the rendered image:
Note : This script doesn't create lights nor cameras, these are created by default by the renderer, so your rendered result might vary slightly from the image shown above.