S&box Wiki

Revision Difference

RenderTags#548800

<cat>Code.Rendering</cat>⤶ <title>Render Tags</title>⤶ ⤶ # Render Tags⤶ ⤶ [Entity Tags](https://wiki.facepunch.com/sbox/Entity_Tags) and tags assigned to Scene Objects can be used to filter out what should be rendered by a [Camera](https://wiki.facepunch.com/sbox/Camera).⤶ ⤶ A Scene Object will automatically inherit tags from the [Entities](https://wiki.facepunch.com/sbox/Entities) that own them.⤶ ⤶ ## Default Tags⤶ ⤶ ### Particles⤶ ⤶ All [Particles](https://wiki.facepunch.com/sbox/Using_particle_systems_from_CSharp) will automatically have the `particles` tag applied to them.⤶ ⤶ ### World⤶ ⤶ The game world including all Hammer meshes and static objects will automatically have the `world` tag applied to them.⤶ ⤶ ### Lighting⤶ ⤶ All lights automatically have the `light` tag applied, but some lights will have additional tags applied such as `spotlight`, `ortholight`, or `envlight`.⤶ ⤶ # Usage⤶ ⤶ ⤶ You can change which Entities or Scene Objects a [Camera](https://wiki.facepunch.com/sbox/Camera) should render by adding any tags associated with them to either `RenderTags` or `ExcludeTags` on the camera.⤶ ⤶ ## Render Tags⤶ ⤶ If this set contains any tags, the camera will *only* render Entities or Scene Objects that have any of these tags.⤶ ⤶ ## Exclude Tags⤶ ⤶ If this set contains any tags, the camera will *exclude* Entities or Scene Objects that have any of these tags from rendering.⤶ ⤶ # Example⤶ ⤶ If you had a minimap in your game and you wanted its camera to only render the world and nothing else, you could do this:⤶ ⤶ ```csharp⤶ Camera = new SceneCamera( "Minimap" );⤶ Camera.World = Game.SceneWorld;⤶ Camera.RenderTags.Add( "world" );⤶ ```