cellular automata for 3d morphing sudhanshu k semwal kaushal s chandrashekar department of computer...

61
CELLULAR AUTOMATA FOR 3D CELLULAR AUTOMATA FOR 3D MORPHING MORPHING Sudhanshu K Semwal Sudhanshu K Semwal Kaushal S Chandrashekar Kaushal S Chandrashekar Department of Computer Science Department of Computer Science University of Colorado at University of Colorado at Colorado Springs Colorado Springs

Post on 21-Dec-2015

219 views

Category:

Documents


3 download

TRANSCRIPT

CELLULAR AUTOMATA FOR 3D CELLULAR AUTOMATA FOR 3D MORPHINGMORPHING

Sudhanshu K SemwalSudhanshu K Semwal

Kaushal S ChandrashekarKaushal S Chandrashekar

Department of Computer ScienceDepartment of Computer Science

University of Colorado at Colorado SpringsUniversity of Colorado at Colorado Springs

OutlineOutline

Introduction to MorphingIntroduction to Morphing BackgroundBackground Design of volume morphing algorithmsDesign of volume morphing algorithms ImplementationImplementation ResultsResults Future workFuture work ConclusionsConclusions

Introduction to MorphingIntroduction to Morphing

MorphingMorphing Given a source model S and a target Given a source model S and a target

model T, morphing constructs a series model T, morphing constructs a series of transformations {Wof transformations {Wt t | t є | t є [0,1]} such [0,1]} such that Wthat W0 0 = S and W= S and W1 1 = T= T

Introduction to MorphingIntroduction to Morphing

Applications of morphingApplications of morphing MoviesMovies 3D games3D games Study of evolutionStudy of evolution Understanding fetal and plant growthUnderstanding fetal and plant growth

Introduction to MorphingIntroduction to Morphing

Types of morphingTypes of morphing 2 dimensional2 dimensional 3 dimensional3 dimensional

Benefits of 3 dimensional morphingBenefits of 3 dimensional morphing Free from lighting and environmental Free from lighting and environmental

considerationsconsiderations Real-time camera view changesReal-time camera view changes

BackgroundBackground Types of 3D morphingTypes of 3D morphing

Polygonal meshPolygonal mesh VolumetricVolumetric

Polygonal mesh morphingPolygonal mesh morphing Uses polygonal or polyhedral meshes as inputUses polygonal or polyhedral meshes as input MeshMesh

Linear surface composed of polygons described as Linear surface composed of polygons described as Vertex/Face/Edge/Graph or verticesVertex/Face/Edge/Graph or vertices

Describes topology of surfaceDescribes topology of surface

Background contdBackground contd BenefitsBenefits

Very popular format, supported by many Very popular format, supported by many modeling packages modeling packages

Most approaches are of this formMost approaches are of this form DrawbacksDrawbacks

Datasets from medical and geological fields Datasets from medical and geological fields do not support polygonal datado not support polygonal data

Complex topologies difficult to handle, esp. Complex topologies difficult to handle, esp. with user controlwith user control

Complex implementations reqd for Complex implementations reqd for processing and rendering processing and rendering

Background contd.Background contd.

Two parts of the morphing problemTwo parts of the morphing problem Correspondence problemCorrespondence problem Interpolation problemInterpolation problem

Background contdBackground contd

Volumetric morphingVolumetric morphing Uses 3 dimensional volumes as source and Uses 3 dimensional volumes as source and

targettarget Volumes composed of voxelsVolumes composed of voxels Voxels – atomic unit of volume, short for Voxels – atomic unit of volume, short for

volume pixelvolume pixel

Background contdBackground contd Volume defined as a collection of scattered Volume defined as a collection of scattered

voxels, with each voxel being associated with a voxels, with each voxel being associated with a set of values of size S, i.e, the volume V is given set of values of size S, i.e, the volume V is given by:by:

V = {(xV = {(xii, v, vii ) | x ) | xi i Є RЄ R33 , v, vi i Є RЄ RSS, i = 1 .. n } , i = 1 .. n } [[Chen1995]Chen1995]

Common representation is a 3 dimensional gridCommon representation is a 3 dimensional grid

Each (i,j,k) either empty or containing one valueEach (i,j,k) either empty or containing one value

Background contdBackground contd BenefitsBenefits

FFree of restrictions of topology and geometries ree of restrictions of topology and geometries Can be easily be applied to meshes by Can be easily be applied to meshes by

converting them to volumetric data, while the converting them to volumetric data, while the reverse can result in topologies difficult to morph.reverse can result in topologies difficult to morph.

Data in the medical, geological and energy fields Data in the medical, geological and energy fields is generated in the volumetric format and needs is generated in the volumetric format and needs to be morphed directly.to be morphed directly.

Do not need a bijective mapping between Do not need a bijective mapping between vertices of the source and target formats.vertices of the source and target formats.

The simple format allows implementation ease.The simple format allows implementation ease.

Background contd.Background contd.

DrawbacksDrawbacksNot as popular as polygonal formats in the Not as popular as polygonal formats in the

entertainment industry, fewer test models entertainment industry, fewer test models available.available.

Computationally intensive to process and Computationally intensive to process and render.render.

Background contd.Background contd.

[Cohen-Or1998][Cohen-Or1998] Uses distance field Uses distance field transformation methodtransformation method

Uses user-defined control pointsUses user-defined control points Morphing done using warping and Morphing done using warping and

cross-dissolvingcross-dissolving Disadvantage – quality of morph Disadvantage – quality of morph

dependent on control pointsdependent on control points

Background contd.Background contd.

Problems with current 3D morphing Problems with current 3D morphing techniquestechniques CorrespondenceCorrespondence Require user-defined control pointsRequire user-defined control points

ExhibitExhibit

TO

Background contd.Background contd.

Our goalOur goal Less restrictive approachLess restrictive approach Minimal or no user controlMinimal or no user control Natural looking processNatural looking process

Background contdBackground contd Cellular AutomataCellular Automata

Dynamic system composed of discrete cells, Dynamic system composed of discrete cells, work in discrete steps of time and are work in discrete steps of time and are characterized by local interactionscharacterized by local interactions

Some of the characteristics of CA are Some of the characteristics of CA are [Wolfram1984]:[Wolfram1984]: They utilize a discrete lattice of sitesThey utilize a discrete lattice of sites Discrete time steps drive the simulation.Discrete time steps drive the simulation. Each site can only take a finite set of valuesEach site can only take a finite set of values Each site evolves according to same Each site evolves according to same

deterministic rulesdeterministic rules The evolution of a site only depends on the The evolution of a site only depends on the

neighborhood.neighborhood.

Design contdDesign contd

Characteristics of CA usedCharacteristics of CA used 3 dimensional lattice. 3 dimensional lattice. The dimension of the lattice is that of the The dimension of the lattice is that of the

volume. volume. Each cell can either be empty or contain one Each cell can either be empty or contain one

value.value. All cells are equalAll cells are equal The cellular automaton is non-circular.The cellular automaton is non-circular.

Design contdDesign contd

Core increment algorithmCore increment algorithm Source and target volumes overlaid within Source and target volumes overlaid within

same CAsame CA Uses intersection of 2 volumes as baseUses intersection of 2 volumes as base Intersection is called the Intersection is called the corecore Core incremented step-wise to fill both source Core incremented step-wise to fill both source

and target volumesand target volumes At each iteration, each voxel in the core At each iteration, each voxel in the core

checks its surroundings, if source or target checks its surroundings, if source or target voxel found, adds that voxel to the core.voxel found, adds that voxel to the core.

Design contdDesign contd Voxels required to start from core and fill both Voxels required to start from core and fill both

volumes recorded in add-array(target volume) and volumes recorded in add-array(target volume) and del-array (source volume) as separate sets.del-array (source volume) as separate sets.

Process continues until core cannot increment any Process continues until core cannot increment any moremore

Source model loaded into new volumeSource model loaded into new volume Add and del arrays scanned, former forward and Add and del arrays scanned, former forward and

latter in reverselatter in reverse At each iteration, voxels for that iteration in the del-At each iteration, voxels for that iteration in the del-

array are removed from the source volume and array are removed from the source volume and voxels for that iteration in the add-array are addedvoxels for that iteration in the add-array are added

Source voxels not intersecting with target are Source voxels not intersecting with target are gradually removed and target voxels are gradually gradually removed and target voxels are gradually addedadded

Generates a smooth organic qualityGenerates a smooth organic quality

Design contdDesign contd

Design contdDesign contd

Design contdDesign contd

Design contdDesign contd

Design contdDesign contd

Design contdDesign contd

BenefitsBenefits Rules defining behavior of cellular automata are Rules defining behavior of cellular automata are

simple, hence easy to upgrade or replace. simple, hence easy to upgrade or replace. Uses 3 dimensional arrays as volumes. Popular Uses 3 dimensional arrays as volumes. Popular

formats can be used directly. formats can be used directly. No correspondence required between source No correspondence required between source

and target models.and target models. The morph can be controlled because of the add The morph can be controlled because of the add

and delete arrays containing the information of and delete arrays containing the information of each iteration as separate sets. each iteration as separate sets.

Organic quality of morphOrganic quality of morph

Design contdDesign contd

DisadvantagesDisadvantages Requires intersection of volumesRequires intersection of volumes 4 volumes are reqd to be created, 4 volumes are reqd to be created,

Source, Target, Core, Source for morphing iterationSource, Target, Core, Source for morphing iteration Volumes containing source and target have to be Volumes containing source and target have to be

of same size, no restrictions on models of same size, no restrictions on models themselvesthemselves

No attempt to preserve massNo attempt to preserve mass Color handling not solved, no solution elsewhereColor handling not solved, no solution elsewhere

Design contdDesign contd

Bacterial growth modelBacterial growth model Based on papers using CA for bacterial Based on papers using CA for bacterial

simulationsimulation Bacteria modeled as individual agents Bacteria modeled as individual agents

in lattice and rules govern its reaction in lattice and rules govern its reaction to environment and other bacteriato environment and other bacteria

Each non-empty voxel in source Each non-empty voxel in source volume is considered as a bacteriumvolume is considered as a bacterium

Design contdDesign contd Rules for bacteriaRules for bacteria

Non-motile.Non-motile. HomogenousHomogenous Have 2 needs, food and the need to reproduce, the Have 2 needs, food and the need to reproduce, the

latter being dependent on the former. latter being dependent on the former. Will reproduce if it finds food and has space to place Will reproduce if it finds food and has space to place

its offspring by making a copy of itself.its offspring by making a copy of itself. Creates only one offspring per iteration.Creates only one offspring per iteration. Will live and reproduce infinitely given enough space.Will live and reproduce infinitely given enough space. Will die if food is not present in its current position.Will die if food is not present in its current position. Cooperate to keep each other aliveCooperate to keep each other alive. .

Design contdDesign contd

Bacterial Growth ModelBacterial Growth Model Each voxel in target considered inexhaustible Each voxel in target considered inexhaustible

source of foodsource of food Target volume overlaid in 3 dimensions over Target volume overlaid in 3 dimensions over

sourcesource Effectively, food is provided to bacteria in sourceEffectively, food is provided to bacteria in source For each position (i,j,k) in source, if (i,j,k) in target For each position (i,j,k) in source, if (i,j,k) in target

is non-empty, then (i,j,k) in source has foodis non-empty, then (i,j,k) in source has food Each bacterium in source checks to see if food Each bacterium in source checks to see if food

present in current positionpresent in current position

Design contdDesign contd If food found, and space available, If food found, and space available,

reproduces with certain probability p1reproduces with certain probability p1 If food not found in current position, and If food not found in current position, and

not surrounded, dies with certain not surrounded, dies with certain probability p2probability p2

Bacteria in features that do not intersect Bacteria in features that do not intersect with target starve and die, thus removing with target starve and die, thus removing those featuresthose features

Bacteria are encouraged to grow into Bacteria are encouraged to grow into features of the target volume, thus features of the target volume, thus morphing into that shapemorphing into that shape

Design contdDesign contdProbability of bacteria dying = 0.5Probability of bacteria reproducing = 1.0

Design contdDesign contd

Design contdDesign contd

Design contd

BenefitsBenefits Extremely simple algorithm, easy to Extremely simple algorithm, easy to

implement.implement. The source and target volumes need to The source and target volumes need to

be loaded only once and morphing can be loaded only once and morphing can proceed.proceed.

No costly pre-processing steps required. No costly pre-processing steps required. Ideal as a quick and dirty method of Ideal as a quick and dirty method of

morphing, works well with models of morphing, works well with models of similar sizessimilar sizes

Design contdDesign contd

DisadvantagesDisadvantages Requires that input volumes be of same dimensions. Requires that input volumes be of same dimensions.

No restriction on the sizes of the models themselves.No restriction on the sizes of the models themselves. Computationally intensive because each voxel has Computationally intensive because each voxel has

to be considered. Can be alleviated to a certain to be considered. Can be alleviated to a certain extent by use of iso-surfaces of the source volumeextent by use of iso-surfaces of the source volume

Needs intersection of volumes to work.Needs intersection of volumes to work. No way to control the morphing process. No way to control the morphing process. No support for handling color No support for handling color

ImplementationImplementation

C++ used as implementation languageC++ used as implementation language Visualization ToolKit used for renderingVisualization ToolKit used for rendering

ResultsResults Test cases:Test cases:

a)a) Input.bin to Fuel.bin Input.bin to Fuel.bin• 64 X 64 X 64 volume size64 X 64 X 64 volume size• 17,000 non-empty voxels17,000 non-empty voxels• Large extent of intersectionLarge extent of intersection

b)b) Cube256x256x256.bin to aneurism.binCube256x256x256.bin to aneurism.bin::• 256 x 256 x 256 sized datasets256 x 256 x 256 sized datasets• 1.1 million non-empty voxels 1.1 million non-empty voxels • Target dissipated through volume, branch likeTarget dissipated through volume, branch like• Small amount of overlapSmall amount of overlap

Results contdResults contdc)c) Cube256x256x256.bin to MRI-head.bin:Cube256x256x256.bin to MRI-head.bin:

• 256 x 256 x 256 sized datasets.256 x 256 x 256 sized datasets.• 7.1 million non-empty voxels7.1 million non-empty voxels• Source model overlaps and is smaller than Source model overlaps and is smaller than

targettarget• Large number of voxel additionsLarge number of voxel additions

d) MRI-head.bin to bonsai.bind) MRI-head.bin to bonsai.bin• 256 x 256 x 256 sized datasets.256 x 256 x 256 sized datasets.• 7.3 million non-empty voxels7.3 million non-empty voxels• Source model overlaps and is larger than targetSource model overlaps and is larger than target• Large number of voxel deletionsLarge number of voxel deletions

Bacterial growth modelBacterial growth modelVolume

Dimensions:Source

non-emptyVoxelCount

Targetnon-empty

VoxelCount

No ofiterations

AvgMorphing Time periteration

(secs)

Total Timetaken formorphing

(secs)

AvgRendering

Time(secs)

a64 X 64 X 64

4096 13731 32 0.02 0.64 0.76

b256X256X256 1000000 168948

387 1.16 448.92 3.16

c 256X256X256 10000006198649

132 3.38 446.16 2.14

d 256X256X256 6176412 1298598 195 1.33 259.35 2.71

Results contdResults contd

ObservationsObservations

Complexity is nComplexity is n33 where n is the size of one where n is the size of one dimension of the source or target volume.dimension of the source or target volume.

In normal cases, the amount of time taken In normal cases, the amount of time taken for each iteration as well as the number of for each iteration as well as the number of iterations depend on the size of the volume iterations depend on the size of the volume and the number of non-empty voxels within and the number of non-empty voxels within it.it.

Results contdResults contd

In case of test (b), the small amount of overlap In case of test (b), the small amount of overlap leads to a large amount of additions and leads to a large amount of additions and deletions. deletions.

The performance of this algorithm is better than The performance of this algorithm is better than the core increment method due to iso-surfacingthe core increment method due to iso-surfacing

This algorithm seems to do well in cases where This algorithm seems to do well in cases where therethere is a large percentage of overlap is a large percentage of overlap betweenbetween volumesvolumes

The quality of the morphs is in general worse The quality of the morphs is in general worse than the core-increment algorithmthan the core-increment algorithm

Core increment modelCore increment modelVolume

Dimensions:Source

non-emptyVoxelCount

Targetnon-empty

VoxelCount

No ofiterations

Avg.Morphing

TimePer Iteration

(secs)

Total TimeTaken for Morphing

(secs)

Avg. Rendering

Time(secs)

a. 64 X 64 X 64 4096 13731 32 .0334 1.07 1.27

b. 256X256X256 1000000 168948 248 2.5027 620.67 4.46

c. 256X256X256 1000000 6198649 120 8.7642 1051.71 3.32

d. 256X256X256 6176412 1298598 175 11.24 1966.24 3.33

Results contdResults contd ObservationsObservations

The complexity of this algorithm is of the order of nThe complexity of this algorithm is of the order of n33. .

The time taken to morph increases linearly with the The time taken to morph increases linearly with the

dimension of the volume.dimension of the volume. There is no performance hit even when the overlap There is no performance hit even when the overlap

in test (b) is significantly lower than the others. in test (b) is significantly lower than the others.

Tests suggest that the core increment algorithm is Tests suggest that the core increment algorithm is

more stable with a varied type of source and target more stable with a varied type of source and target

models than the bacterial growth models.models than the bacterial growth models.

Results contdResults contd

Movies of ResultsMovies of Results

Future Work

Handling non-intersecting volumes Multi-value volume support Parallelization Color handling Scripting language support

ConclusionConclusion Two algorithms for morphing Two algorithms for morphing

volumetric data developedvolumetric data developed Do not require any correspondence Do not require any correspondence

informationinformation Do not require any user control.Do not require any user control. Disparate models can be morphedDisparate models can be morphed ApplicationsApplications

EntertainmentEntertainment MedicineMedicine Evolution, geology, education etcEvolution, geology, education etc

Thank youThank you

Any Questions?Any Questions?

Introduction to MorphingIntroduction to Morphing

Desirable features of 3D morphing are:Desirable features of 3D morphing are: Intermediate transitions should undergo Intermediate transitions should undergo

continuous 3D transformationscontinuous 3D transformations SShould apply to a variety of shapes and hould apply to a variety of shapes and

topologiestopologies Should be able to use user input, but work Should be able to use user input, but work

well without it alsowell without it also

Background contd.Background contd.

Current researchCurrent research [Lee1999] simplify source and target [Lee1999] simplify source and target

meshes to form coarse base domainsmeshes to form coarse base domains Since base domains are simple meshes, Since base domains are simple meshes,

easy to find correspondenceeasy to find correspondence Allows user defined featuresAllows user defined features

Background contd.Background contd.

Current ResearchCurrent Research [He1994] use Direct interpolation[He1994] use Direct interpolation For a function s(x,y,z) representing the source For a function s(x,y,z) representing the source

volume in 3D space and a function t(x,y,z) volume in 3D space and a function t(x,y,z) representing the target volumerepresenting the target volume

IIgg(x,y,z) = (1 – g) s(x,y,z) + g t(x,y,z) , 0 <= g <= 1(x,y,z) = (1 – g) s(x,y,z) + g t(x,y,z) , 0 <= g <= 1

where Iwhere Ig g is a function that represents the is a function that represents the intermediate volumes.intermediate volumes.

Problems with high frequency componentsProblems with high frequency components

Background contdBackground contd

Volumetric morphing usedVolumetric morphing used Reason for using volumetric morphingReason for using volumetric morphing

FFertile area of research, allowing more room for ertile area of research, allowing more room for innovation.innovation.

Simple and unrestricted nature allow Simple and unrestricted nature allow unconventional approaches to be implemented unconventional approaches to be implemented with ease.with ease.

The cellular automata based algorithm fits the The cellular automata based algorithm fits the volumetric approach in comparison to other 3D volumetric approach in comparison to other 3D techniques such as polygonal morphingtechniques such as polygonal morphing

Background contd.Background contd.

ApplicationsApplications VLSI design [Sarkar2000]VLSI design [Sarkar2000] Fault tolerant computing [Sarkar2000]Fault tolerant computing [Sarkar2000] Ecological simulations[Bezzi2000]Ecological simulations[Bezzi2000] Medical simulations [Sloot2002]Medical simulations [Sloot2002] Crowd behavior and social interaction Crowd behavior and social interaction

models [Hamagami2003]models [Hamagami2003] Physics modeling in games [Forsyth2002]Physics modeling in games [Forsyth2002]

Background contd.Background contd.

Current ResearchCurrent Research [Droun2003] [Droun2003] simulate highly deformable simulate highly deformable

substancessubstances Concept of virtual clayConcept of virtual clay 3D CA used with integer in each cell 3D CA used with integer in each cell

representing amount of clayrepresenting amount of clay Based on input, amount of clay is Based on input, amount of clay is

redistributed as model is manipulatedredistributed as model is manipulated

Background contd.Background contd.

[Claudia2001] use CA to simulate [Claudia2001] use CA to simulate landslideslandslides

Use the Cellular Automata Network model Use the Cellular Automata Network model Each component of system represented by Each component of system represented by

a CA and interactions between a CA and interactions between components form network.components form network.

Dependency graph generated to satisfy Dependency graph generated to satisfy dependencies of one component on dependencies of one component on anotheranother

Implementation contdImplementation contd

Input File FormatInput File Format Count of rows: unsigned charCount of rows: unsigned char Count of columns: unsigned charCount of columns: unsigned char Count of depth: unsigned charCount of depth: unsigned char Raw data in horizontal slice fashion, with Raw data in horizontal slice fashion, with

(0,0,0) at the top front part of the volume (0,0,0) at the top front part of the volume and (row-max, col-max, depth-max) at the and (row-max, col-max, depth-max) at the bottom back part : unsigned char bottom back part : unsigned char

Dimensions have to be lesser than 1024Dimensions have to be lesser than 1024

DesignDesign

Basis of designBasis of design Search for simplicity – Occam's RazorSearch for simplicity – Occam's Razor Analyzed problem at most basic level, ignoring Analyzed problem at most basic level, ignoring

correspondence and interpolation problemscorrespondence and interpolation problems Looked at volumetric morphing as a collection of Looked at volumetric morphing as a collection of

voxels comprising the source model trying to voxels comprising the source model trying to achieve similarity with the voxels in the target achieve similarity with the voxels in the target modelmodel

Realized global control mechanisms not reqd.Realized global control mechanisms not reqd. Cellular automata was perfect answerCellular automata was perfect answer

Implementation contdImplementation contd Supporting ProgramsSupporting Programs

raw2nativeformat raw2nativeformat raw2nativeformat rows columns depth inputfilename raw2nativeformat rows columns depth inputfilename

outputfilenameoutputfilename resizevolumeresizevolume

resizevolume inputfilename rows colums depth resizevolume inputfilename rows colums depth outputfilenameoutputfilename

createtestcubecreatetestcube createtestcube volumerows volumecols volumedepth createtestcube volumerows volumecols volumedepth

cubeStartx cubeStarty cubeStartz width height depth cubeStartx cubeStarty cubeStartz width height depth valueToFill outputfilenamevalueToFill outputfilename

volviewervolviewer volviewer filenamevolviewer filename

Implementation contdImplementation contd VTK classes used in thesisVTK classes used in thesis

VtkRendererVtkRenderer VtkRenderWindowVtkRenderWindow VtkPiecewiseFunctionVtkPiecewiseFunction VtkVolumePropertyVtkVolumeProperty VtkVolumeRayCastCompositeFunctionVtkVolumeRayCastCompositeFunction VtkVolumeVtkVolume VtkColorTransferFunctionVtkColorTransferFunction VtkVolumeRayCastMapperVtkVolumeRayCastMapper VtkStructuredPointsVtkStructuredPoints VtkRenderWindowInteractorVtkRenderWindowInteractor vtkUnsignedCharArrayvtkUnsignedCharArray

VTK PipelineVTK Pipeline

Class StructureClass Structure

Implementation contdImplementation contd

Classes implementedClasses implemented CAVolumeCAVolume CAVDataCAVData CAFileReaderCAFileReader CADisplayEngineCADisplayEngine CABaseMorphCABaseMorph CACoreIncrementMorphCACoreIncrementMorph CABacterialGrowthMorphCABacterialGrowthMorph