Thanks, and what you say is very important for me too.

My beginners question: is there somewhere an OO class model  drawn to show

a)      How inheritance of such attributes like mater and through matter like color works OR

b)      which object types (classes) can have mater and through mater color.



Von: brlcad []
Gesendet: Donnerstag, 31. März 2011 20:53
An: BRL-CAD Users Mailing List
Betreff: Re: [brlcad-users] multiple region color sets


On Mar 31, 2011, at 01:10 PM, Jay Carlton <> wrote:



Is there an easy way to define multiple sets of colors & shaders for a single .g file? For example, I might have one color scheme for materials, another for major assemblies, and a third for density. I'm thinking about defining custom region properties to key into each color map to and writing a Tcl function to traverse the regions and call comb_color, but I wondered if someone has solved this problem already.




There is a way, but whether you consider it easy depends on how your geometry is already structured.  First off, you can define color tables that associate to ranges of region id numbers.  You can define multiple color tables, but you'd have to manually toggle which one is active by setting the "regionid_colortable" attribute on the _GLOBAL object.


That won't, however, let you specify different shaders or separate material properties.  So forget everything I just said about color tables.  In order to manage separate shaders, you have to define a separate assembly hierarchy (minimally just one combination object) for each set of attributes.


The way to do this is basically take your model, comprised of various groups, regions, and primitives.  Create a shallow copy of your top-level object (e.g. "cp gray_tank green_tank").  For each custom component above the region level, either create a copy or add an intermediate combination and set your properties on that object.  For example, I want my green_tank to be green but want the wheels to be black.  I already made a copy of green_tank, so I can set color on that object to green (mater green_tank).  Next, swap out the wheels (cp wheels green_wheels ; rm tank wheels ; mater green_wheels ; g tank green_wheels).  Now I have a gray_tank and a green_tank with separate shaders, separate colors, separate material properties, but with the same underlying geometry including region ids. 


Note that a technique similar to this is often done for reports or other visualizations where a copy of the top-level object is made and  a shader is only applied to that top-level copy.  You can set an override flag that will make that shader apply to all objects in the hierarchy underneath.  Simple way to turn a whole tank into glass or add a cutaway view.