Хрупкие объекты

Материал из CryWiki Russia

(Различия между версиями)
Перейти к: навигация, поиск
Строка 3: Строка 3:
== Хрупкие объекты ==
== Хрупкие объекты ==
-
Хрупкие объекты содержат отдельные части соединённые в одной модели сочленениями.<br/>Каждая часть может быть отделена физической силой (пулями, взаимодействием с игроком, взрывами) превосходящей ограничения сочленения.<br/>In general, Breakable objects are placed in Sandbox as brushes<br/>A perfect example for a breakable objects would be a road sign, a wooden fence, or a wooden shag.
+
Хрупкие объекты содержат отдельные части соединённые в одной модели сочленениями.<br/>Каждая часть может быть отделена физической силой (пулями, взаимодействием с игроком, взрывами) превосходящей ограничения сочленения.<br/>В основном, хрупкие объекты размещаются в Sandbox как браши (кисти).<br/>Наилучшим примером хрупких объектов являются дорожные знаки или деревянные заборы.
-
=== Sample File ===
+
=== Файл-пример<br/> ===
-
Sample File: [http://wiki.crymod.com/images/5/5b/Breakable_example.max Breakable-Example]
+
Файл-пример: [http://wiki.crymod.com/images/5/5b/Breakable_example.max Breakable-Example]
-
=== General Setup in 3d applications ===
+
=== Основные настройки в 3D-приложении<br/> ===
-
*The objects must have several nodes in max, each with its own physics.
+
*Объекты должны иметь несколько узлов и каждый должен иметь свою собственную физику.
-
*Nodes are held together with joints (each joint can connect only 2 parts).
+
*Узлы соединены сочленениями (каждое сочленение может быть соединено с 2 частями).
-
*Naming convention for Joints: $joint01, $joint02,...
+
*Порядок наименования сочленений: '''$joint01''', '''$joint02''', и т.д.
-
*Joints are represented in the 3d application with helper objects (dummies, Nulls..). They need to intersect with the physics proxy of 1 or max. two geometry objects.
+
*Сочленения в 3D-приложении представляют собой вспомогательные объекты (дамми, пустышки). Они должны пересекать физическую прокси одного или максимум двух геометрических объектов.
-
*The Z-orientation of the joint pivot should normally point upward (see Debug section)
+
*Z-ориентация точки опоры сочленения должна быть направлена наверха (см. раздел «Отладка»).
-
*Alternatively, one can explicitly specify part names in the joint name using this format: $joint1_part1_part2. This can be useful at complicated junctions where geometrical intersections can find more than 2 parts
+
*Помимо этого, можно явно указать название части в названии сочленения используя такой формат: '''$joint1_part1_part2'''. <span id="result_box" lang="ru"><span class="hps">Это полезно</span> <span class="hps">в</span> <span class="hps">сложных</span> <span class="hps">узлах, где</span> <span class="hps">геометрия</span> <span class="hps">перескает</span><span class="hps"></span> <span class="hps">более чем</span> две <span class="hps">части.</span></span>
-
*When a joint object intersects only with one node, a joint between the object and the world is created.
+
*Когда сочленение объекта пересекает только один узел, создаёт сочленение между объектом и миром.
-
*The size of the dummy object does _not_ have any effect on the strength.
+
*Размер дамми-объекта '''никак не влияет''' на силу воздействия.
-
*It is, however, used to re-attach joints to broken parts if some geometries also have procedural breaking on (namely: when a part breaks procedurally, all joints that are attached to it are checked for intersections with the newly formed pieces, and are re-attached to them if needed)
+
*Это, однако, используется при повторном приклеплении сочленений к хрупким частями, если некая геометрия также имеет процедурные разрушения (а именно: когда часть процедурно разрушена, все сочленения, которые прикреплены к ней, проверяются на пересечение с вновь образованными частями, и повторно прикрепляет к ним, если это необходимо).
-
*The strength of the joints and the mass of the separate are defined in the node properties (different name in every 3d application; in 3ds: objects Properties)
+
*Сила и масса сочленения отдельно определяются в свойствах узла (в каждом 3D-приложении называются по-разному; в 3ds Max: '''Objects Properties''' '''[''Свойства объекта'']''').
-
*Specific joint limits are relative to the joint’s normal, represented by the helper node’s *z* axis. For joints that specify part names explicitly, care must be taken that the normal points into the 1st parts (otherwise push and pull limits will switch meanings)
+
*Определённые ограничения сочленения относятся к нормалям сочленения, представленным вспомогательным узлов оси Z. For joints that specify part names explicitly, care must be taken that the normal points into the 1st parts (otherwise push and pull limits will switch meanings)
*Turn OFF «Merge All Nodes» on export
*Turn OFF «Merge All Nodes» on export
*Objects can be placed as brush or geom. Entity
*Objects can be placed as brush or geom. Entity
Строка 27: Строка 27:
*example for dummy placement
*example for dummy placement
-
 
+
<br/>[[File:PrebrokenObject dummyplacement.jpg|RTENOTITLE]]
-
[[File:PrebrokenObject dummyplacement.jpg|RTENOTITLE]]  
+
*Example for joint properties
*Example for joint properties
-
 
+
<br/>[[File:PrebrokenObject objectproperties.jpg|RTENOTITLE]]
-
[[File:PrebrokenObject objectproperties.jpg|RTENOTITLE]]  
+
Each time an external force (from collisions with other objects, or bullet hits) is applied to the object, the system calculates internal forces needed to hold the object parts together, and if some forces breach the threshold, the corresponding joints are removed. Then part connectivities via remaining joints are recomputed and isolated islands are moved to new entities.
Each time an external force (from collisions with other objects, or bullet hits) is applied to the object, the system calculates internal forces needed to hold the object parts together, and if some forces breach the threshold, the corresponding joints are removed. Then part connectivities via remaining joints are recomputed and isolated islands are moved to new entities.
Строка 43: Строка 41:
*entity (render geometry property)
*entity (render geometry property)
-
If the render geometry properties include «entity», the object will not fade out after being disconnected from the main object.  
+
If the render geometry properties include «entity», the object will not fade out after being disconnected from the main object.
*box (render geometry property)
*box (render geometry property)
-
If the render geometry properties include «box», the engine will use a simple box (based on the bounding box of the object’s physics proxy) as the collision geometry. This helps speeding up physics calculation.  
+
If the render geometry properties include «box», the engine will use a simple box (based on the bounding box of the object’s physics proxy) as the collision geometry. This helps speeding up physics calculation.
*mass=VALUE (render geometry property)
*mass=VALUE (render geometry property)
Строка 63: Строка 61:
limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values below. CAUTION This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100—500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.
limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values below. CAUTION This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100—500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.
-
The following values are optional and are used to fine tune the «limit» settings.  
+
The following values are optional and are used to fine tune the «limit» settings.
*bend=VALUE (Joint object property)
*bend=VALUE (Joint object property)
Строка 85: Строка 83:
maximum force in the direction perpendicular to normal
maximum force in the direction perpendicular to normal
-
Addition: joints also support non-fully-rigid (non-6dof) constraints. A full rigid constraint will become a dynamic constraint if its either bend and twist limit gets broken and the joint has a non-0 «constrant_limit» property.  
+
Addition: joints also support non-fully-rigid (non-6dof) constraints. A full rigid constraint will become a dynamic constraint if its either bend and twist limit gets broken and the joint has a non-0 «constrant_limit» property.
-
Broken «bends» will become «socket» constraints, and «twists» will become hinges. The newly created dynamic constraint will inherit pull and shift limits from the joint. The constraint’s frame will be that of the joint’s helper in max. In order to preserve the meaning of «twisting», however, the axes will be swapped (z of the joint’s helper will become the constraint’s x&nbsp;— since both represent the «twising» axis, x will become y, and y wil become z). Thus, for hinges, z asis of the helper should be directed along the desired hinge direction. For socket’s, z axis should be the axis the attached part «bends around».  
+
Broken «bends» will become «socket» constraints, and «twists» will become hinges. The newly created dynamic constraint will inherit pull and shift limits from the joint. The constraint’s frame will be that of the joint’s helper in max. In order to preserve the meaning of «twisting», however, the axes will be swapped (z of the joint’s helper will become the constraint’s x&nbsp;— since both represent the «twising» axis, x will become y, and y wil become z). Thus, for hinges, z asis of the helper should be directed along the desired hinge direction. For socket’s, z axis should be the axis the attached part «bends around».
-
Here is the list of related properties:  
+
Here is the list of related properties:
*constraint_limit=VALUE (Joint object property)
*constraint_limit=VALUE (Joint object property)
Строка 95: Строка 93:
Force limit for the newly created constraint, is checked when the constraint hits a rotation limit and is being pushed further
Force limit for the newly created constraint, is checked when the constraint hits a rotation limit and is being pushed further
-
*constraint_minang=VALUE (Joint object property)  
+
*constraint_minang=VALUE (Joint object property)
*constraint_maxang=VALUE (Joint object property)
*constraint_maxang=VALUE (Joint object property)
Строка 116: Строка 114:
WARNING Be aware that the search function in the code also returns nodes with only partially matching strings. If you have problems with pieces spawning out of nowhere or existing nodes being cloned for no reason, look into the name strings and change them to avoid this issue.
WARNING Be aware that the search function in the code also returns nodes with only partially matching strings. If you have problems with pieces spawning out of nowhere or existing nodes being cloned for no reason, look into the name strings and change them to avoid this issue.
-
If you don’t specify anything in the piece properties, they will be spawned as particles, which means they will have no collision and will disappear after a few seconds. If you want the pieces to behave like actual physicalized objects, you have to add «entity» into their properties box.  
+
If you don’t specify anything in the piece properties, they will be spawned as particles, which means they will have no collision and will disappear after a few seconds. If you want the pieces to behave like actual physicalized objects, you have to add «entity» into their properties box.
*Sample setup
*Sample setup
-
 
+
<br/>[[File:PrebrokenObject pieces.jpg|RTENOTITLE]]
-
[[File:PrebrokenObject pieces.jpg|RTENOTITLE]]  
+
Practical examples of how pieces can be used:
Practical examples of how pieces can be used:
Строка 131: Строка 128:
— Adding static detail: You can also spawn small debris pieces, that, instead of falling down, stay where they appear (for example steel cables sticking out of a concrete wall). To do this, you have to add the following lines to the properties of the piece:
— Adding static detail: You can also spawn small debris pieces, that, instead of falling down, stay where they appear (for example steel cables sticking out of a concrete wall). To do this, you have to add the following lines to the properties of the piece:
-
entity mass=0 density=0  
+
entity mass=0 density=0
Entity because you want the object to stay where it is once it is spawned, and because you want it to be physicalized. The object needs to be physicalized (i.e. contain polygons with a physicalized material) in order for this to work. Mass and density need to be 0 to assign the objects infinite mass, which results in the object staying where it spawns and not reacting to force. If it wasn’t 0, it would fall down upon spawning.
Entity because you want the object to stay where it is once it is spawned, and because you want it to be physicalized. The object needs to be physicalized (i.e. contain polygons with a physicalized material) in order for this to work. Mass and density need to be 0 to assign the objects infinite mass, which results in the object staying where it spawns and not reacting to force. If it wasn’t 0, it would fall down upon spawning.
Строка 149: Строка 146:
==== Linking Objects to simplify export ====
==== Linking Objects to simplify export ====
-
Linked objects don’t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.  
+
Linked objects don’t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.
*Example of linking objects and joints for simpler export
*Example of linking objects and joints for simpler export
-
 
+
<br/>[[File:PrebrokenObject NamingAndHierarchy.jpg|RTENOTITLE]]
-
[[File:PrebrokenObject NamingAndHierarchy.jpg|RTENOTITLE]]  
+
=== Setup in Sandbox ===
=== Setup in Sandbox ===
Строка 172: Строка 168:
*Example of debug display
*Example of debug display
 +
<br/>[[File:PrebrokenObject sign example.jpg|RTENOTITLE]]<br/><br/>
-
[[File:PrebrokenObject sign example.jpg|RTENOTITLE]] <br/>[[Category:Official:Asset Creation:Basics|Official:Asset_Creation:Basics]] <br/> <br/>
+
[[Category:Official:Asset Creation:Basics|Official:Asset_Creation:Basics]] <br/>

Версия 20:23, 6 декабря 2011

Эта страница страница помечена как находящиеся в процессе перевода.


Содержание

Хрупкие объекты

Хрупкие объекты содержат отдельные части соединённые в одной модели сочленениями.
Каждая часть может быть отделена физической силой (пулями, взаимодействием с игроком, взрывами) превосходящей ограничения сочленения.
В основном, хрупкие объекты размещаются в Sandbox как браши (кисти).
Наилучшим примером хрупких объектов являются дорожные знаки или деревянные заборы.

Файл-пример

Файл-пример: Breakable-Example

Основные настройки в 3D-приложении

  • Объекты должны иметь несколько узлов и каждый должен иметь свою собственную физику.
  • Узлы соединены сочленениями (каждое сочленение может быть соединено с 2 частями).
  • Порядок наименования сочленений: $joint01, $joint02, и т.д.
  • Сочленения в 3D-приложении представляют собой вспомогательные объекты (дамми, пустышки). Они должны пересекать физическую прокси одного или максимум двух геометрических объектов.
  • Z-ориентация точки опоры сочленения должна быть направлена наверха (см. раздел «Отладка»).
  • Помимо этого, можно явно указать название части в названии сочленения используя такой формат: $joint1_part1_part2. Это полезно в сложных узлах, где геометрия перескает более чем две части.
  • Когда сочленение объекта пересекает только один узел, создаёт сочленение между объектом и миром.
  • Размер дамми-объекта никак не влияет на силу воздействия.
  • Это, однако, используется при повторном приклеплении сочленений к хрупким частями, если некая геометрия также имеет процедурные разрушения (а именно: когда часть процедурно разрушена, все сочленения, которые прикреплены к ней, проверяются на пересечение с вновь образованными частями, и повторно прикрепляет к ним, если это необходимо).
  • Сила и масса сочленения отдельно определяются в свойствах узла (в каждом 3D-приложении называются по-разному; в 3ds Max: Objects Properties [Свойства объекта]).
  • Определённые ограничения сочленения относятся к нормалям сочленения, представленным вспомогательным узлов оси Z. For joints that specify part names explicitly, care must be taken that the normal points into the 1st parts (otherwise push and pull limits will switch meanings)
  • Turn OFF «Merge All Nodes» on export
  • Objects can be placed as brush or geom. Entity
  • example for dummy placement


RTENOTITLE

  • Example for joint properties


RTENOTITLE

Each time an external force (from collisions with other objects, or bullet hits) is applied to the object, the system calculates internal forces needed to hold the object parts together, and if some forces breach the threshold, the corresponding joints are removed. Then part connectivities via remaining joints are recomputed and isolated islands are moved to new entities.

Node Properties

The nodes need properties attached (depending on software) to work correctly in the engine.

  • entity (render geometry property)

If the render geometry properties include «entity», the object will not fade out after being disconnected from the main object.

  • box (render geometry property)

If the render geometry properties include «box», the engine will use a simple box (based on the bounding box of the object’s physics proxy) as the collision geometry. This helps speeding up physics calculation.

  • mass=VALUE (render geometry property)

Mass defines the weight of an object based on real world physics mass=0 sets the object to «unmovable». This is used on the basement of a house for example or the sign pole which should not be movable and always stay in the original position. When used in brushes and Geom Entities, this is the final part’s mass. When used in regular Entities, all parts masses are scaled so that their total mass gives the mass specified in the entity properties.

  • CAUTION* You must either define this value or density to ensure the simulation is working correctly.
  • density=VALUE

The engine automatically calculates the mass for an object based on the density and the bounding box of an object. Can be used alternatively to mass.

  • limit=VALUE (Joint object property)

limit is a general value for several different kind of forces applied to the joint. It contains a combination of the values below. CAUTION This value needs to be defined, otherwise the simulation will not work correctly. Crysis Example values: 100—500 can be broken by a bullet; 10000 can be broken by the impact of a driving vehicle or a big explosion.

The following values are optional and are used to fine tune the «limit» settings.

  • bend=VALUE (Joint object property)

maximum torque around an axis perpendicular to the normal.

  • twist=VALUE (Joint object property)

maximum torque around the normal

  • pull=VALUE (Joint object property)

maximum force applied to the joint’s 1st object against the joint normal (the parts are «pulled together» as a reaction to external forces pulling them apart)

  • push=VALUE (Joint object property)

maximum force applied to the joint’s 1st object (i.e. the one whose name is listed first in the joint’s name, or if the names were not specified, the object the joint’s z axis points towards) along the joint normal; joint normal is the joint’s z axis, so for this value to actually be «push apart» (as a reaction to external forces pressing the parts together), this axis must be directed inside the 1st object

  • shift=VALU (Joint object property)

maximum force in the direction perpendicular to normal

Addition: joints also support non-fully-rigid (non-6dof) constraints. A full rigid constraint will become a dynamic constraint if its either bend and twist limit gets broken and the joint has a non-0 «constrant_limit» property.

Broken «bends» will become «socket» constraints, and «twists» will become hinges. The newly created dynamic constraint will inherit pull and shift limits from the joint. The constraint’s frame will be that of the joint’s helper in max. In order to preserve the meaning of «twisting», however, the axes will be swapped (z of the joint’s helper will become the constraint’s x — since both represent the «twising» axis, x will become y, and y wil become z). Thus, for hinges, z asis of the helper should be directed along the desired hinge direction. For socket’s, z axis should be the axis the attached part «bends around».

Here is the list of related properties:

  • constraint_limit=VALUE (Joint object property)

Force limit for the newly created constraint, is checked when the constraint hits a rotation limit and is being pushed further

  • constraint_minang=VALUE (Joint object property)
  • constraint_maxang=VALUE (Joint object property)

Rotation limits for the constraint (the interpretation is the same as in standalone constraints). The default is no limits

  • constraint_damping=VALUE (Joint object property)

Angular damping (default 0)

  • constraint_collides=VALUE (Joint object property)

Whether the constraint parts will ignore collisions with each other (default 1)

For example, to quickly create an unbreakable hinge constraint, one should put this into the joint’s properties: twist = 0 (the constraint will created at the first activation, regardless of force) constraint_limit = 1E20 (just something big enough) Note that the general «limit = xx» is not required, since we want the limits other than twist to remain unbreakable. Also note that the nodes that have dynamic constraints between them should always be physicalized as entities (not particles).

Dissolving into particlespieces

Jointed Objects can be set up to break in smaller pieces when being detached from the joint. i.e. a wooden sheet breaks into several planks. The object properties must contain the information about the pieces used. i.e. «pieces=$blah1», «pieces=$rock1». Several objects can share the same name, but it is also possible to set up the pieces with different names, i.e. «pieces=$blah1,$blah2». Pieces need to be linked to the object they should replace later on. NOTE: make sure the names of the objects you want to use as pieces are in lower case only i.e. $debris or $piece1. Debris would not work.

WARNING Be aware that the search function in the code also returns nodes with only partially matching strings. If you have problems with pieces spawning out of nowhere or existing nodes being cloned for no reason, look into the name strings and change them to avoid this issue.

If you don’t specify anything in the piece properties, they will be spawned as particles, which means they will have no collision and will disappear after a few seconds. If you want the pieces to behave like actual physicalized objects, you have to add «entity» into their properties box.

  • Sample setup


RTENOTITLE

Practical examples of how pieces can be used:

— Optimization: If you create a dummy object with a nodraw material (like a simple cube) and spawn it as a piece, the jointed object will simply disappear once the joint breaks — it will be replaced by an invisible object. This can be helpful since the piece that is broken off will not fall down and interact with the remaining pieces, potentially causing problems, and it is also beneficial performance-wise. Once the original object is seperated from its joint, no further physics calculations will be necessary.

— Adding dynamic detail: Pieces replace their original object once this object is «broken off» (seperated from it’s joint), so you can take the original object and cut it up into smaller pieces. An example of this is the huts in crysis, most roof panels have two sub-pieces that spawn once the panel breaks off. This results in more detailed breaking and smaller debris. Don’t forget to add «entity» and a realistic mass to the piece properties, and make sure the piece is physicalized, or else the pieces will fall through the ground and/or disappear after a few seconds. (in case they are only small «fluff» pieces, this might actually be intended)

— Adding static detail: You can also spawn small debris pieces, that, instead of falling down, stay where they appear (for example steel cables sticking out of a concrete wall). To do this, you have to add the following lines to the properties of the piece:

entity mass=0 density=0

Entity because you want the object to stay where it is once it is spawned, and because you want it to be physicalized. The object needs to be physicalized (i.e. contain polygons with a physicalized material) in order for this to work. Mass and density need to be 0 to assign the objects infinite mass, which results in the object staying where it spawns and not reacting to force. If it wasn’t 0, it would fall down upon spawning.

Level of detail settings

LodCreation per object can easily be added by naming them $lod1; $lod2, $lod3… and linking them to the relevant subobjects. In order to make differentiation easier, a postfix can be added; i.e. «$lod1_wooden plank»

Occlusion Proxy

An OcclusionProxy can be added by naming it $occlusion and linking it to the relevant jointed object; like a big sheet of metal on a metal fence or a wooden wall on a hut. Occlusion proxy is allowed to have open edges and need to be as low as possible (something around 2-10 polys).

Instancing within breakable objects

AssetCreation InstancingObjects Instancing objects] is used to optimize render time by reducing drawcalls and memory consumption. The engine automatically detects identical geometry elements within the exported objects. There is no special setup needed to take advantage of this feature. UVs and relative point position to the pivot need to be identical in objects in order to qualify them for instancing.

Linking Objects to simplify export

Linked objects don’t need to be exported, just the Root node needs to be added to the exporter list. All child nodes will automatically be exported. The name and pivot will be derived from the root joint.

  • Example of linking objects and joints for simpler export


RTENOTITLE

Setup in Sandbox

Add the object as a brush or a Geom. Entity. In case of a brush, the engine will detext automatically that the object is breakable. For multiplayer where breaking objects has a massive impact on the data transfer, breakability is automatically disabled (might change later)

Debugging

  • p_debug_joints 1 shows the default debug mode for joints (see picture below); p_draw_helpers needs to be activated
  • CAUTION Never scale a joint If you need a new size, create a new joint. the scaling value will be passed on to the engine and causes wrong results in the simulation.
  • The «spikes» on the joint objects show the orientation. For limits to properly reflect their names (i.e. pull, twist, etc), the spikes must be directed along the «natural» joints axes. However, it’s also possible to keep them always pointing up, for consistency.
  • The blue colored numbers show the mass of the single pieces. Note the «0.00kg» this is the mass of the top node — in this case a dummy.
  • Joints linked to the world are displayed red.
  • When a force is applied to a joint, the direction is shown (in this case shift and bend), together with the strength and the limit of the particular joint. Green text represents an impact with an impulse much lower then the joint limit. Yellow represents values closer to the joint limit. Red represents values which were higher than the limit — in this case the joint is broken.
  • NOTE: the debug mode is handy to see how the impulse of weapons react with the breakable object. set the general limit first and then fine tune the specific limits by setting them explicitly for shift, bend…
  • Example of debug display


RTENOTITLE