-
Notifications
You must be signed in to change notification settings - Fork 45
3D Rendering Notes
There are several Layers available, that are pre-defined. These are drawn into separate cameras and composited. The cameras are set up in CameraTracking.cs and available via FPlatform.
The layer integer ids are also available via FPlatform:
- FPlatform.WidgetOverlayLayer: this layer is for 3D widgets that should be drawn "on top" of the scene geometry
- HUDLayer: for heads-up display / 3D UI elements
- UILayer: this is for 2D UI elements
- CursorLayer: for cursors
The above are not hard/fast rules, however some f3 code automatically configures things using these layer ids. You can change them, or use these layers for other things, as you see fit.
Note that the layer IDs are actually set by querying Unity, because the layers themselves have to be set up in the Unity scene (under the Layers drop-down in the top-right of the Unity editor). The field names are the same as the string names set in Unity. This also determines the compositing order of the layer cameras.
Also note that there is no explicit association between cameras and layers. However each unity Camera has a cullingMask field, which is a bitmask of which layers to include. We configure these bitmasks appropriately when the cameras are constructed in CameraTracking.Initialize().
Each SceneObject has a SOMaterial associated with it. This gets converted into a Unity Material via MaterialUtil.ToUnityMaterial().
To control the ordering of rendering, each Unity Material has a RenderQueue associated with it, which is an integer ID. There are standard queues, ie Geometry is 2000 and Transparent is 3000. F3 Shaders use these default queues, however you can set SOMaterial.RenderQueueShift to positive/negative numbers to shift the rendering order of specific materials.
RenderQueue
each