Counter-Strike 2 Workshop Tools/BreakableWindows: Difference between revisions
Jump to navigation
Jump to search
Note:This tutorial assumes a basic familiarity with ModelDoc Editor.
Bug:func_breakable does not spawn gibs on break in
Counter-Strike 2. It's recommended to use prop_dynamic instead [todo tested in ?]
Warning:Window can only be in shape of a box.
Tip:it is not needed to have custom model file since primitive shapes are created inside of ModelDoc
Important:Model should be facing forward in X+ direction.
Note:It will show an error and will not let you compile the model, this would be fixed by adding RenderMeshFile.
Important:Сopy Bounding Dimensions from box primitive created earlier.
Important:Glass material should have dynamic expressions configured, otherwise there would be no break pieces.
No edit summary |
No edit summary |
||
(19 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
{{note|This tutorial assumes a basic familiarity with [[ModelDoc Editor]].}} | {{note|This tutorial assumes a basic familiarity with [[ModelDoc Editor]].}} | ||
{{Bug|func_breakable does not spawn gibs on break in {{cs2|4}}. It's recommended to use prop_dynamic instead}} | {{Bug|func_breakable does not spawn gibs on break in {{cs2|4}}. It's recommended to use prop_dynamic instead}} | ||
{{ | {{warning|Window can only be in shape of a box.}} | ||
{{todo|add screenshots with in depth explanation}} | |||
example model can be found in {{path|Counter-Strike Global Offensive\content\csgo\workshop\content_examples\breakable_glass\breakable_glass_01|vmdl}} | example model can be found in {{path|Counter-Strike Global Offensive\content\csgo\workshop\content_examples\breakable_glass\breakable_glass_01|vmdl}} | ||
Line 8: | Line 9: | ||
[[File:Cs2 br glass mdoc hierarchy.png|thumb|right|250|model doc outliner setup for breakable glass]] | [[File:Cs2 br glass mdoc hierarchy.png|thumb|right|250|model doc outliner setup for breakable glass]] | ||
== Making base window model == | |||
{{tip|it is not needed to have custom model file since primitive shapes are created inside of ModelDoc}} | |||
=== Adding a root node === | |||
RenderMeshFile: | * add '''RenderMeshFile''' to model, cancel the file selection and press '''Keep''' on popup , It should appear as empty node, change '''RenderMeshFile''' Name to something like "window". This would be used as root node to add modifiers as child later. It should have the following parameters in inspector: | ||
{ | |||
====RenderMeshFile==== | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| Name || window | |||
|- | |||
| Source file|| <none> | |||
|} | |||
=== Adding box primitive === | |||
#add '''Mesh Operation Stack''' node as parent of '''RenderMeshFile''' | |||
#add [[Box Primitive]] as child of [[Mesh Operation Stack]] , set desired `Box dimensions` (x-thickness,y-width,z-height), but keep `Position` at [0,0,0], for this example, use {{path|workshop/content_examples/breakable_glass/breakable_glass_01|vmat}} material | |||
#add [[UV map planar custom]] stretch it so only single part of window texture fills model (you need to unselect this node and compile to preview how uv will look) | |||
{{important|Model should be facing forward in {{code|X+}} direction.}} | |||
=== Adding physic properties === | |||
====PhysicsHullFromRender==== | |||
*add '''PhysicsHullFromRender''' with following properties: | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| Surface Property || glass | |||
|- | |||
| Collision Property|| window | |||
|} | |||
====prop_data==== | |||
*add '''prop_data''' with following properties: | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| Base Prop || Glass.Window | |||
|- | |||
| Allow As Static Prop|| yes | |||
|- | |||
| Health || 1 | |||
|} | |||
This will make sure that the prop can be used as '''prop_physics''' | |||
== Adding Break pieces to model == | == Adding Break pieces to model == | ||
todo | ===Base setup=== | ||
Broken glass shards are done procedurally inside of modeldoc, to do that: | |||
#add '''BreakPieceEmbedded''' to model. | |||
#set the following properties: | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| Ragdoll Applies Bind Pose Root || no | |||
|- | |||
| Collision Group || Debris | |||
|- | |||
| Fade Time || 3 | |||
|- | |||
| Essential Piece|| yes | |||
|- | |||
| Material Group Mode|| Inherit Material Index | |||
|- | |||
| Spawn Piece Motion Disabled|| yes | |||
|- | |||
| Piece Health Override|| 0 | |||
|} | |||
{{note|It will show an error and will not let you compile the model, this would be fixed by adding '''RenderMeshFile'''.}} | |||
*add empty '''RenderMeshFile''' as child of '''BreakPieceEmbedded''' same way as described in 1.1 of this tutorial, error should disappear. Name it something like "window_broken" | |||
===Creating shattered glass model=== | |||
====RenderMeshFile==== | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| Name || window_broken | |||
|- | |||
| Source file|| <none> | |||
|} | |||
*Add '''Mesh Operation Stack''' as child node | |||
Now add the following operators to it: | |||
=====Voronoi Plane Primitive===== | |||
Uses voronoi noise to slice model | |||
{{important|Сopy '''Bounding Dimensions''' from box primitive created earlier.}} | |||
{{important|Glass material should have dynamic expressions configured, otherwise there would be no break pieces.}} | |||
Example configuration | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| <span style="color: yellow;">Bounding Dimensions</span> || [Copy from box primitive, leave x=0] | |||
|- | |||
| <span style="color: yellow;">Material</span> || | |||
{{path|workshop/content_examples/breakable_glass/breakable_glass_01_broken|vmat}} | |||
|- | |||
| Number of Points || 64 | |||
|- | |||
| Random Seed || 2 | |||
|- | |||
| Weld Distance || 0.5 | |||
|- | |||
| Bias to Center || 0.1 | |||
|- | |||
| Shrink Pieces || 0 | |||
|- | |||
| Extra Border Points || 1 | |||
|- | |||
| Add center Vertex || no | |||
|- | |||
|} | |||
======Inflate====== | |||
Create '''Inflate''' as child node, used to give thickness to glass shards | |||
::{| class=standard-table | |||
! Property Name || Value | |||
|- | |||
| Inflation Amount || 0.75 | |||
|- | |||
| Build Sides || yes | |||
|- | |||
| Build Backfaces || yes | |||
|- | |||
|} | |||
{{todo|Box Select/ Vertex sine wave for distortion}} | |||
=====Select All===== | |||
=====Assign Vertex Pivot Data===== | |||
Used to assign material expressions to break pieces | |||
{{todo|Explain material creation}} | |||
== Creating custom glass material == | == Creating custom glass material == | ||
Latest revision as of 00:37, 4 October 2024




Todo: add screenshots with in depth explanation
example model can be found in Counter-Strike Global Offensive\content\csgo\workshop\content_examples\breakable_glass\breakable_glass_01.vmdl
Making base window model

Adding a root node
- add RenderMeshFile to model, cancel the file selection and press Keep on popup , It should appear as empty node, change RenderMeshFile Name to something like "window". This would be used as root node to add modifiers as child later. It should have the following parameters in inspector:
RenderMeshFile
Property Name Value Name window Source file <none>
Adding box primitive
- add Mesh Operation Stack node as parent of RenderMeshFile
- add Box Primitive as child of Mesh Operation Stack , set desired `Box dimensions` (x-thickness,y-width,z-height), but keep `Position` at [0,0,0], for this example, use
workshop/content_examples/breakable_glass/breakable_glass_01.vmat
material - add UV map planar custom stretch it so only single part of window texture fills model (you need to unselect this node and compile to preview how uv will look)

Adding physic properties
PhysicsHullFromRender
- add PhysicsHullFromRender with following properties:
Property Name Value Surface Property glass Collision Property window
prop_data
- add prop_data with following properties:
Property Name Value Base Prop Glass.Window Allow As Static Prop yes Health 1
This will make sure that the prop can be used as prop_physics
Adding Break pieces to model
Base setup
Broken glass shards are done procedurally inside of modeldoc, to do that:
- add BreakPieceEmbedded to model.
- set the following properties:
Property Name Value Ragdoll Applies Bind Pose Root no Collision Group Debris Fade Time 3 Essential Piece yes Material Group Mode Inherit Material Index Spawn Piece Motion Disabled yes Piece Health Override 0

- add empty RenderMeshFile as child of BreakPieceEmbedded same way as described in 1.1 of this tutorial, error should disappear. Name it something like "window_broken"
Creating shattered glass model
RenderMeshFile
Property Name Value Name window_broken Source file <none>
- Add Mesh Operation Stack as child node
Now add the following operators to it:
Voronoi Plane Primitive
Uses voronoi noise to slice model


Example configuration
Property Name Value Bounding Dimensions [Copy from box primitive, leave x=0] Material workshop/content_examples/breakable_glass/breakable_glass_01_broken.vmat
Number of Points 64 Random Seed 2 Weld Distance 0.5 Bias to Center 0.1 Shrink Pieces 0 Extra Border Points 1 Add center Vertex no
Inflate
Create Inflate as child node, used to give thickness to glass shards
Property Name Value Inflation Amount 0.75 Build Sides yes Build Backfaces yes
Todo: Box Select/ Vertex sine wave for distortion
Select All
Assign Vertex Pivot Data
Used to assign material expressions to break pieces
Todo: Explain material creation