# HG changeset patch # User Robert McIntyre # Date 1396038875 14400 # Node ID ae10f35022ba7548f49fe02390053f64bcb27149 # Parent 258078f78b33cf3e747d4a5a1b7c8add974384c6 completed first draft of body section. diff -r 258078f78b33 -r ae10f35022ba thesis/cortex.org --- a/thesis/cortex.org Fri Mar 28 16:25:31 2014 -0400 +++ b/thesis/cortex.org Fri Mar 28 16:34:35 2014 -0400 @@ -23,8 +23,6 @@ #+ATTR_LaTeX: :width 10cm [[./images/aurellem-gray.png]] - - * COMMENT Empathy and Embodiment as problem solving strategies By the end of this thesis, you will have seen a novel approach to @@ -445,7 +443,7 @@ simulations of very simple creatures in =CORTEX= generally run at 40x on my machine! -** What is a sense? +** COMMENT What is a sense? If =CORTEX= is to support a wide variety of senses, it would help to have a better understanding of what a ``sense'' actually is! @@ -523,7 +521,6 @@ #+ATTR_LaTeX: :width 10cm [[./images/finger-1.png]] - ** COMMENT Video game engines are a great starting point I did not need to write my own physics simulation code or shader to @@ -590,7 +587,7 @@ write my code in clojure, an implementation of =LISP= that runs on the JVM. -** =CORTEX= uses Blender to create creature models +** COMMENT =CORTEX= uses Blender to create creature models For the simple worm-like creatures I will use later on in this thesis, I could define a simple API in =CORTEX= that would allow @@ -627,8 +624,7 @@ #+ATTR_LaTeX: :width 10cm [[./images/empty-sense-nodes.png]] - -** Bodies are composed of segments connected by joints +** COMMENT Bodies are composed of segments connected by joints Blender is a general purpose animation tool, which has been used in the past to create high quality movies such as Sintel @@ -690,19 +686,11 @@ to simulate retractable claws or =EVE='s hands, which are able to coalesce into one object in the movie. -*** Solidifying/Connecting the body +*** Solidifying/Connecting a body - #+caption: View of the hand model in Blender showing the main ``joints'' - #+caption: node (highlighted in yellow) and its children which each - #+caption: represent a joint in the hand. Each joint node has metadata - #+caption: specifying what sort of joint it is. - #+name: blender-hand - #+ATTR_LaTeX: :width 10cm - [[./images/hand-screenshot1.png]] - - =CORTEX= creates a creature in two steps: first, it traverses the - nodes in the blender file and creates physical representations for - any of them that have mass defined. + =CORTEX= creates a creature in two steps: first, it traverses the + nodes in the blender file and creates physical representations for + any of them that have mass defined in their blender meta-data. #+caption: Program for iterating through the nodes in a blender file #+caption: and generating physical jMonkeyEngine3 objects with mass @@ -729,20 +717,35 @@ #+end_src #+end_listing - The next step to making a proper body is to connect those pieces - together with joints. jMonkeyEngine has a large array of joints - available via =bullet=, such as Point2Point, Cone, Hinge, and a - generic Six Degree of Freedom joint, with or without spring - restitution. =CORTEX='s procedure for binding the creature together - with joints is as follows: + The next step to making a proper body is to connect those pieces + together with joints. jMonkeyEngine has a large array of joints + available via =bullet=, such as Point2Point, Cone, Hinge, and a + generic Six Degree of Freedom joint, with or without spring + restitution. - - Find the children of the "joints" node. - - Determine the two spatials the joint is meant to connect. - - Create the joint based on the meta-data of the empty node. + Joints are treated a lot like proper senses, in that there is a + top-level empty node named ``joints'' whose children each + represent a joint. - The higher order function =sense-nodes= from =cortex.sense= - simplifies finding the joints based on their parent ``joints'' - node. + #+caption: View of the hand model in Blender showing the main ``joints'' + #+caption: node (highlighted in yellow) and its children which each + #+caption: represent a joint in the hand. Each joint node has metadata + #+caption: specifying what sort of joint it is. + #+name: blender-hand + #+ATTR_LaTeX: :width 10cm + [[./images/hand-screenshot1.png]] + + + =CORTEX='s procedure for binding the creature together with joints + is as follows: + + - Find the children of the ``joints'' node. + - Determine the two spatials the joint is meant to connect. + - Create the joint based on the meta-data of the empty node. + + The higher order function =sense-nodes= from =cortex.sense= + simplifies finding the joints based on their parent ``joints'' + node. #+caption: Retrieving the children empty nodes from a single #+caption: named empty node is a common pattern in =CORTEX= @@ -769,20 +772,20 @@ #+end_src #+end_listing - To find a joint's targets targets, =CORTEX= creates a small cube, - centered around the empty-node, and grows the cube exponentially - until it intersects two /physical/ objects. The objects are ordered - according to the joint's rotation, with the first one being the - object that has more negative coordinates in the joint's reference - frame. Since the objects must be physical, the empty-node itself - escapes detection. Because the objects must be physical, - =joint-targets= must be called /after/ =physical!= is called. + To find a joint's targets, =CORTEX= creates a small cube, centered + around the empty-node, and grows the cube exponentially until it + intersects two physical objects. The objects are ordered according + to the joint's rotation, with the first one being the object that + has more negative coordinates in the joint's reference frame. + Since the objects must be physical, the empty-node itself escapes + detection. Because the objects must be physical, =joint-targets= + must be called /after/ =physical!= is called. - #+caption: Program to find the targets of a joint node by - #+caption: exponentiallly growth of a search cube. - #+name: joint-targets - #+begin_listing clojure - #+begin_src clojure + #+caption: Program to find the targets of a joint node by + #+caption: exponentiallly growth of a search cube. + #+name: joint-targets + #+begin_listing clojure + #+begin_src clojure (defn joint-targets "Return the two closest two objects to the joint object, ordered from bottom to top according to the joint's rotation." @@ -807,17 +810,17 @@ (.dot (Vector3f. 1 1 1) joint-ref-frame-position)) (take 2 targets)) (recur (float (* radius 2)))))))) - #+end_src - #+end_listing + #+end_src + #+end_listing - Once =CORTEX= finds all joints and targets, it creates them using a - simple dispatch on the metadata of the joint node. + Once =CORTEX= finds all joints and targets, it creates them using + a dispatch on the metadata of each joint node. - #+caption: Program to dispatch on blender metadata and create joints - #+caption: sutiable for physical simulation. - #+name: joint-dispatch - #+begin_listing clojure - #+begin_src clojure + #+caption: Program to dispatch on blender metadata and create joints + #+caption: sutiable for physical simulation. + #+name: joint-dispatch + #+begin_listing clojure + #+begin_src clojure (defmulti joint-dispatch "Translate blender pseudo-joints into real JME joints." (fn [constraints & _] @@ -847,17 +850,17 @@ rotation rotation) (.setLimit (float limit-xz) (float limit-xy) (float twist))))) - #+end_src - #+end_listing + #+end_src + #+end_listing - All that is left for joints it to combine the above pieces into a - something that can operate on the collection of nodes that a - blender file represents. + All that is left for joints it to combine the above pieces into a + something that can operate on the collection of nodes that a + blender file represents. - #+caption: Program to completely create a joint given information - #+caption: from a blender file. - #+name: connect - #+begin_listing clojure + #+caption: Program to completely create a joint given information + #+caption: from a blender file. + #+name: connect + #+begin_listing clojure #+begin_src clojure (defn connect "Create a joint between 'obj-a and 'obj-b at the location of @@ -888,20 +891,20 @@ control-a control-b pivot-a pivot-b joint-rotation)))) - #+end_src - #+end_listing + #+end_src + #+end_listing - In general, whenever =CORTEX= exposes a sense (or in this case - physicality), it provides a function of the type =sense!=, which - takes in a collection of nodes and augments it to support that - sense. The function returns any controlls necessary to use that - sense. In this case =body!= cerates a physical body and returns no - control functions. + In general, whenever =CORTEX= exposes a sense (or in this case + physicality), it provides a function of the type =sense!=, which + takes in a collection of nodes and augments it to support that + sense. The function returns any controlls necessary to use that + sense. In this case =body!= cerates a physical body and returns no + control functions. - #+caption: Program to give joints to a creature. - #+name: name - #+begin_listing clojure - #+begin_src clojure + #+caption: Program to give joints to a creature. + #+name: name + #+begin_listing clojure + #+begin_src clojure (defn joints! "Connect the solid parts of the creature with physical joints. The joints are taken from the \"joints\" node in the creature." @@ -919,25 +922,23 @@ [#^Node creature] (physical! creature) (joints! creature)) - #+end_src - #+end_listing + #+end_src + #+end_listing - All of the code you have just seen amounts to only 130 lines, yet - because it builds on top of Blender and jMonkeyEngine3, those few - lines pack quite a punch! + All of the code you have just seen amounts to only 130 lines, yet + because it builds on top of Blender and jMonkeyEngine3, those few + lines pack quite a punch! - The hand from figure \ref{blender-hand}, which was modeled after my - own right hand, can now be given joints and simulated as a - creature. + The hand from figure \ref{blender-hand}, which was modeled after + my own right hand, can now be given joints and simulated as a + creature. - #+caption: With the ability to create physical creatures from blender, - #+caption: =CORTEX= gets one step closer to a full creature simulation - #+caption: environment. - #+name: name - #+ATTR_LaTeX: :width 15cm - [[./images/physical-hand.png]] - - + #+caption: With the ability to create physical creatures from blender, + #+caption: =CORTEX= gets one step closer to becomming a full creature + #+caption: simulation environment. + #+name: name + #+ATTR_LaTeX: :width 15cm + [[./images/physical-hand.png]] ** Eyes reuse standard video game components