The Scene System
Imagine the scene system as what is dealing with all the different types of things for rendering everything to your screen or technically a texture.
This is only used for clients, server has no reason to be rendering anything, no one will ever see what's rendered.
Everything from your actual main game world with your player and so on is rendered via the scene system. Every ModelEntity, WorldEntity and so on, is just creating SceneObjects to go in the main game's SceneWorld to be rendered to the players screen!
But it can also be used to do additional stuff like creating extra miniature 3D worlds in UI elements, Or adding an extra SceneCamera to render a CCTV camera to a monitor entity and so on, you can do a lot with them!
What does the Scene System consist of?
Contains all the SceneObjects for a specific world we want in one place
A SceneWorld is just a collection of all the SceneObjects that you want to be contained in one separate world for rendering, then extra options for trace related stuff on all SceneObjects.
Every time you want to create anything scene related you need to put it in a SceneWorld. Entities in the main game will do that for you, but if you are doing your own SceneWorld you will have to keep it in mind.
You can actually get the main game's SceneWorld by just doing
Game.SceneWorld and you can manually add in SceneObjects and lights if you so desired!
Everything needed for how WE WANT to render everything in a SceneWorld
A SceneCamera holds all the data about how we should render stuff to a texture, or view, or screen. The camera is provided a world to render, in which it will now render all the SceneObjects within that world! There are also a lot of properties you can mess with to change how the SceneCamera will render everything to the screen.
Like you can mess with FOV, Orphographic, ZNear, ZFar and so on.
Another thing to remember is you can use RenderTags to dictate what objects to and not to render, and also RenderHooks to hook in and do extra stuff within each render stage when the camera is rendered!
Lastly, the global
Sandbox.Camera is technically a wrapper for the main SceneCamera the main world uses!
so you can do
Camera.Main and this will allow you to get your main game's SceneCamera!
Objects that are rendered models, anything in the SceneWorld that is rendered HAS to inherit from this
So where Entities are what allow things to exist physically in our main game world, SceneObjects are what allow models to be rendered by the camera in the SceneWorld.
WHATEVER that is in a SceneWorld has to inherit from the
SceneObject class to be able to be added to a SceneWorld.
for example all these are children of SceneObjects!
Now with SceneObjects we now have access to messing with materials, dynamic expressions, attributes, body groups, the mesh, interacting with the shaders on the model and so on and so fourth.