News Overview SceneEngine Downloads VideoTutorials Main Page SourceForge Get Involved Bookmark and Share

Rendering and Texture Baking

SceneEngine includes a Raytracer that supports camera and texture baking rendering.

The raytracer is accessed via Lua scripts:

-- Open SceneEngine libraries
require("gmt_lua")
require("sceng_lua")
 
-- Open Scene
sceng.OpenScene( "sample01.sceng" )
 
-- Set render parameters
rp = sceng.RenderParameters()
 
rp.output_file = "render.tga"
 
rp.width = 800
rp.height = 600
rp.samples = 2
 
-- Render scene
sceng.Render( rp )

To do raytracing instead, a few more render parameters have to be set:

-- Open SceneEngine libraries
require("gmt_lua")
require("sceng_lua")
 
-- XS 06 project
sceng.OpenScene( "xs06.sceng" )
target = sceng.GetNode( "Low Poly XS-06" )
source = nil
 
-- Set render parameters
rp = sceng.RenderParameters()
 
-- Set the channels to be output
rp.output_file = "texbake.tga"
rp.diffuse_file = "texbake_diffuse.tga"
rp.normals_file = "texbake_normals.tga"
rp.alpha_file = "texbake_alpha.tga"
rp.specular_file = "texbake_specular.tga"
 
rp.width = 1024
rp.height = 1024
rp.samples = 2
 
-- Set texture baking 
rp.do_texture_baking = true
rp.ray_offset = 2.0
rp.prefilter_size = 5.0
 
-- Set the target and source nodes
rp.target_nodes = {}
rp.target_nodes[1] = target
 
-- If no source nodes are set, all visible nodes are
-- rendered (except the target node)
rp.source_nodes = {}
rp.source_nodes[1] = source
 
-- Render... 
sceng.Render( rp )
Views