Skatter Help
HomeForumsDownloadTransmutr Help
  • Welcome to Skatter
  • Getting started
  • Tutorials
    • Creating Landscapes (Webinar)
    • Skatter for interiors
    • What's new in Skatter v2
  • FAQ
    • I have lost or didn't receive my license key
    • How can I reset my license activations?
    • On how many computers can I use my license?
    • What are the software and hardware requirements to run Skatter?
    • Where can I find plant models to use with Skatter?
    • Why is my grass upside-down?
    • Why are my scattered objects off-center?
    • I cannot activate my license due to a restrictive internet connection
    • I'm a Render Engine developer, how can I support Skatter?
  • Manual
    • Things to know
    • Generating instances
    • Hosts
    • Scattered objects
    • Distribution
    • Masks
    • Filters
    • Transformations
    • Materials
    • Camera
    • Composition Manager
    • 3D Bazaar (Library)
  • Release notes
Powered by GitBook
On this page

Was this helpful?

  1. FAQ

I'm a Render Engine developer, how can I support Skatter?

PreviousI cannot activate my license due to a restrictive internet connectionNextThings to know

Last updated 3 years ago

Was this helpful?

Scattered instances are stored in an hash/array structure which can be read by render engines (or anyone for that matter). This is very similar to parsing the model and reading the transformation of regular Component Instances. This allows users to render hundreds of thousands of instances without overloading Sketchup.

The hash is in a shared namespace called Common, and its name is render_instances.

It is structured like so:

{ 
	Sketchup.active_model.definitions.entityID => { 
		plugin_name => {
			comp_def => [
				{:transformation => trans1, :material => mat1},
				{:transformation => trans2, :material => mat2},
				...
			]
		}
	}
}
  • Sketchup.active_model.definitions.entityID is used to differentiate models on OSX, as we can have multiple models opened in one Sketchup instance

    • plugin_name is the plugin's name, in this case "skatter". This level is necessary so we don't overwrite each other's data

    • comp_def is the of the scattered object. Each item of this array is an individual instance generated by Skatter.

      • :transformation is a that represents the instance's transform

      • :material is a assigned to the instance. If this is not defined or nil, simply consider this instance as having the default material applied to it, just like a regular Component Instance.

Reading this in Ruby is pretty simple:

modelID = Sketchup.active_model.definitions.entityID

if defined?(Common.render_instances) && Common.render_instances[modelID]
	for plugin_name, definitions in Common.render_instances[modelID]
		for definition, instances in definitions 
			for instance in instances
				
				transform = instance [:transformation]
				material = instance [:material]
				
				# Then do your stuff using definition, transform and material...
			
			end#for
		end#for
	end#for
end#if

Additionally, you can add an observer to the Common module, and Skatter will call it every time it updates. It is useful if you are doing Real Time rendering.

class MyObserver
	def on_render_instances_updated(model_id, plugin_name, definition)
	
		puts model_id.to_s + " -> " + plugin_name + " -> " + definition.name
		
		data = Common.render_instances[model_id][plugin_name][definition]
	
	  # Then do your stuff...
	
	end
end

Common.add_observer(MyObserver.new)

This is an open protocol, so if other plugins use it, you will automatically support them as well.

If you have any question or need a NFR license to test your implementation with Skatter, contact us at .

Sketchup::ComponentDefinition
Geom::Transformation
Sketchup::Material
skatter@lindale.io