XLE  v0.02.0
Classes | Typedefs | Enumerations | Functions | Variables
SceneEngine Namespace Reference

World rendering technologies and lighting resolve. More...

Classes

class  AdvectionSettings
 
class  AmbientOcclusionResources
 
class  AmbientResolveShaders
 
class  AtmosphereBlurSettings
 
class  AttachedSceneMarker
 
class  CB_ArbitraryShadowProjection
 
class  CB_OrthoShadowProjection
 
class  CB_ShadowResolveParameters
 
class  CloudsForm2D
 
class  ColorGradingSettings
 
class  CoverageUberSurfaceInterface
 
class  DeepOceanSim
 
class  DeepOceanSimSettings
 
class  DiffusionHelper
 
class  DualContourMesh
 
class  DualContourRenderer
 
class  DuplicateDepthBuffer
 
class  DynamicImposters
 Prepares imposter "sprites" for objects, and uses them as a stand-in More...
 
class  EnforceIncompressibilityHelper
 
class  ErosionSimulation
 
class  FluidSolver2D
 
class  FluidSolver3D
 
class  FormatStack
 
class  ForwardTargetsBox
 
class  GenericUberSurfaceInterface
 
class  GestaltResource
 A GPU resources with one or more "views" More...
 
class  GlobalLightingDesc
 
class  GradientFlagsSettings
 
class  HeightsUberSurfaceInterface
 
class  IIntersectionTester
 Resolves ray and box intersections for tools More...
 
class  ILightingParserPlugin
 Plug-in for the lighting parser More...
 
class  IntersectionTestContext
 Context for doing ray & box intersection test More...
 
class  IntersectionTestScene
 Resolves ray and box intersections for tools More...
 
class  ISceneParser
 
class  ISurfaceHeightsProvider
 Interface to access surface height values for shader More...
 
class  ITerrainFormat
 Interface for reading and writing terrain data More...
 
class  IVolumeDensityFunction
 
class  LightDesc
 Defines a dynamic light More...
 
class  LightingParserContext
 
class  LightingParserStandardPlugin
 
class  LightingResolveContext
 The LightingResolveContext is used by lighting operations during the gbuffer resolve step More...
 
class  LightingResolveShaders
 
class  LightingResolveTextureBox
 
class  LuminanceResult
 
class  MainTargetsBox
 
class  MaterialOverride
 
class  MetricsBox
 
class  ModelIntersectionStateContext
 
class  MultiProjection
 Represents a set of shared projections More...
 
class  OceanLightingSettings
 
class  PerlinNoiseResources
 
class  PlacementsEditor
 
class  PlacementsManager
 Manages stream and organization of object placements More...
 
class  PlacementsQuadTree
 Quad tree arrangement for static placements More...
 
class  PlacementsQuadTreeDebugger
 
class  PreparedDMShadowFrustum
 Prepared "Depth Map" shadow frustum More...
 
class  PreparedRTShadowFrustum
 Prepared "Ray Traced" shadow frustum More...
 
class  PreparedShadowFrustum
 Contains the result of a shadow prepare operation More...
 
class  PrimedCell
 
class  ProtectState
 Low-level save and restore of state information More...
 
class  ReferenceFluidSolver2D
 
class  RefractionsBuffer
 
class  RenderingQualitySettings
 
class  SavedTargets
 
class  SceneParseSettings
 
class  ShadowProjectionDesc
 Defines the projected shadows for a single light More...
 
class  ShadowResourcesBox
 
class  ShadowTargetsBox
 
class  ShadowWriteResources
 
class  ShallowSurface
 
class  ShallowSurfaceManager
 
class  ShallowWaterSim
 
class  ShortCircuitUpdate
 
class  SimplePatchBox
 
class  SkyTextureParts
 
class  StochasticTransparencyOp
 
class  TerrainCachedData
 Loads cached data prepared in a pre-processing step More...
 
class  TerrainCell
 
class  TerrainCellId
 
class  TerrainCellRenderer
 
class  TerrainCellTexture
 
class  TerrainCollapseContext
 
class  TerrainConfig
 Configuration settings for terrain input assets More...
 
class  TerrainCoordinateSystem
 Describes the position and size of terrain in world coordinates More...
 
class  TerrainFormat
 Native XLE file format for terrain More...
 
class  TerrainManager
 Top-level manager for terrain assets More...
 
class  TerrainMaterialConfig
 
class  TerrainMaterialTextures
 
class  TerrainRendererConfig
 
class  TerrainRenderingContext
 
class  TerrainUberHeader
 
class  TerrainUberSurface
 Represents a single "uber" field of terrain data More...
 
class  TerrainUberSurfaceGeneric
 
class  TextureTile
 
class  TextureTileSet
 A set of "texture tiles", all of which are the same size More...
 
class  ToneMapSettings
 
class  TransparencyTargetsBox
 
class  VegetationSpawnConfig
 
class  VegetationSpawnManager
 
class  VolumetricFogConfig
 
class  VolumetricFogManager
 
class  VolumetricFogMaterial
 
class  WaterNoiseTexture
 
class  WorldPlacementsConfig
 

Typedefs

using Packer = RectanglePacker_MaxRects
 
using ScalarField2D = XLEMath::ScalarField2D< Eigen::VectorXf >
 
using VectorField2D = VectorField2DSeparate< Eigen::VectorXf >
 
using ScalarField3D = XLEMath::ScalarField3D< Eigen::VectorXf >
 
using VectorField3D = VectorField3DSeparate< Eigen::VectorXf >
 
using VectorX = Eigen::VectorXf
 
using MatrixX = Eigen::MatrixXf
 
using LightId = unsigned
 
using SPS = SceneParseSettings
 
using MetalContext = RenderCore::Metal::DeviceContext
 
using SupplementRange = ModelCache::SupplementRange
 
typedef std::pair< uint64, uint64 > PlacementGUID
 
typedef intrusive_ptr< ID3D::Resource > ResourcePtr
 
using SRV = RenderCore::Metal::ShaderResourceView
 
using UAV = RenderCore::Metal::UnorderedAccessView
 
using ResLocator = intrusive_ptr< BufferUploads::ResourceLocator >
 
using TerrainCoverageId = uint32
 
using CoverageFormat = RenderCore::Metal::NativeFormat::Enum
 
typedef std::pair< uint16, uint16 > ShadowSample
 
typedef TerrainUberSurface< float > TerrainUberHeightsSurface
 
using DelayedDrawCallSet = RenderCore::Assets::DelayedDrawCallSet
 
using ModelRenderer = RenderCore::Assets::ModelRenderer
 

Enumerations

enum  FluidDebuggingMode {
  Density, Velocity, Temperature, Vapor,
  Divergence
}
 
enum  AdvectionMethod { ForwardEuler, ForwardEulerDiv, RungeKutta, MacCormackRK4 }
 
enum  AdvectionInterp { Bilinear, MonotonicCubic }
 
enum  AdvectionBorder { None, Margin, Wrap }
 
enum  RenderFluidMode { Scalar, Vector }
 
enum  CopyFilter { Bilinear, BoxFilter, BoxFilterAlphaComplementWeight }
 
enum  SkyGeometryType { Plane, HalfCube }
 
enum  ShadowFilterMode { BoxFilter = 0, Seven = 1, Five = 2, None }
 

Functions

void AmbientOcclusion_Render (DeviceContext *, LightingParserContext &, AmbientOcclusionResources &, ShaderResourceView &, ShaderResourceView *, const ViewportDesc &)
 
void AmbientOcclusion_Render (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, AmbientOcclusionResources &resources, RenderCore::Metal::ShaderResourceView &depthBuffer, RenderCore::Metal::ShaderResourceView *normalsBuffer, const RenderCore::Metal::ViewportDesc &mainViewport)
 
DualContourMesh DualContourMesh_Build (unsigned samplingGridDimensions, const IVolumeDensityFunction &fn)
 
void DualContourMesh_DebuggingRender (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, unsigned techniqueIndex, const DualContourMesh &mesh)
 
UInt3 As3DDims (UInt2 input)
 
UInt3 As3DBorder (UInt2 input)
 
UInt3 As3DDims (UInt3 input)
 
UInt3 As3DBorder (UInt3 input)
 
template<typename OutType , typename InType >
OutType ConvertVector (const InType &in)
 
template<unsigned SamplingFlags, typename Field >
Field::ValueType LoadWithNearbyRange (typename Field::ValueType &minNeighbour, typename Field::ValueType &maxNeighbour, const Field &field, typename Field::FloatCoord pt)
 
template<typename Field , typename VelField >
void PerformAdvection (Field dstValues, Field srcValues, VelField velFieldT0, VelField velFieldT1, float deltaTime, const AdvectionSettings &settings)
 
template void PerformAdvection (ScalarField2D, ScalarField2D, VectorField2D, VectorField2D, float, const AdvectionSettings &)
 
template void PerformAdvection (VectorField2D, VectorField2D, VectorField2D, VectorField2D, float, const AdvectionSettings &)
 
template void PerformAdvection (ScalarField3D, ScalarField3D, VectorField3D, VectorField3D, float, const AdvectionSettings &)
 
template void PerformAdvection (VectorField3D, VectorField3D, VectorField3D, VectorField3D, float, const AdvectionSettings &)
 
void EnforceIncompressibility (VectorField2D velField, ScalarField1D qBuffer, ScalarField1D delwBuffer, const PoissonSolver &solver, const PoissonSolver::PreparedMatrix &A, PoissonSolver::Method method, unsigned wrapEdges)
 
void EnforceIncompressibility (VectorField3D velField, const PoissonSolver &solver, const PoissonSolver::PreparedMatrix &A, PoissonSolver::Method method)
 
void VorticityConfinement (VectorField2D outputField, VectorField2D inputVelocities, float strength, float deltaTime)
 
void RenderFluidDebugging2D (RenderCore::Metal::DeviceContext &metalContext, LightingParserContext &parserContext, RenderFluidMode debuggingMode, UInt2 dimensions, float minValue, float maxValue, std::initializer_list< const float * > data)
 
void RenderFluidDebugging3D (RenderCore::Metal::DeviceContext &metalContext, LightingParserContext &parserContext, RenderFluidMode debuggingMode, UInt3 dimensions, float minValue, float maxValue, std::initializer_list< const float * > data)
 
ScalarField1D AsScalarField1D (VectorX &v)
 
void EnforceIncompressibility (VectorField2D velField, ScalarField1D qBuffer, ScalarField1D delwBuffer, const PoissonSolver &solver, const PoissonSolver::PreparedMatrix &A, PoissonSolver::Method method, unsigned marginFlags, bool wrapEdges)
 
void LightingParser_ResolveGBuffer (DeviceContext &context, LightingParserContext &parserContext, MainTargetsBox &mainTargets, LightingResolveTextureBox &lightingResTargets)
 
LightResolveResourcesRes LightingParser_BindLightResolveResources (DeviceContext &context, LightingParserContext &parserContext)
 
StateSetResolvers & GetStateSetResolvers ()
 
void SetFrameGlobalStates (DeviceContext &context)
 
void ReturnToSteadyState (DeviceContext &context)
 
void LightingParser_SetGlobalTransform (DeviceContext &context, LightingParserContext &parserContext, const RenderCore::Techniques::ProjectionDesc &projDesc)
 
RenderCore::Techniques::ProjectionDesc BuildProjectionDesc (const RenderCore::Techniques::CameraDesc &sceneCamera, UInt2 viewportDims, const Float4x4 *specialProjectionMatrix=nullptr)
 Build a projection desc with parameters from a standard camera More...
 
RenderCore::Techniques::ProjectionDesc BuildProjectionDesc (const Float4x4 &cameraToWorld, float l, float t, float r, float b, float nearClip, float farClip)
 Build a projection desc for an orthogonal camera More...
 
void LightingParser_LateGBufferRender (DeviceContext &context, LightingParserContext &parserContext, MainTargetsBox &mainTargets)
 
void LightingParser_ResolveMSAA (DeviceContext &context, LightingParserContext &parserContext, ID3D::Resource *destinationTexture, ID3D::Resource *sourceTexture, NativeFormat::Enum resolveFormat)
 
void LightingParser_PostProcess (DeviceContext &context, LightingParserContext &parserContext)
 
void LightingParser_PreTranslucency (DeviceContext &context, LightingParserContext &parserContext, ShaderResourceView &depthsSRV)
 
void LightingParser_PostGBufferEffects (DeviceContext &context, LightingParserContext &parserContext, ShaderResourceView &depthsSRV, ShaderResourceView &normalsSRV)
 
void LightingParser_Overlays (DeviceContext *context, LightingParserContext &parserContext)
 
void LightingParser_PrepareShadows (DeviceContext *context, LightingParserContext &parserContext)
 
void LightingParser_MainScene (DeviceContext &context, LightingParserContext &parserContext, const RenderingQualitySettings &qualitySettings)
 
PreparedDMShadowFrustum LightingParser_PrepareDMShadow (DeviceContext &context, LightingParserContext &parserContext, const ShadowProjectionDesc &frustum, unsigned shadowFrustumIndex)
 
PreparedRTShadowFrustum LightingParser_PrepareRTShadow (DeviceContext &context, LightingParserContext &parserContext, const ShadowProjectionDesc &frustum, unsigned shadowFrustumIndex)
 
void LightingParser_PrepareShadows (DeviceContext &context, LightingParserContext &parserContext)
 
void LightingParser_InitBasicLightEnv (DeviceContext &context, LightingParserContext &parserContext, ISceneParser &sceneParser)
 
AttachedSceneMarker LightingParser_SetupScene (DeviceContext &context, LightingParserContext &parserContext, ISceneParser *sceneParser)
 
void LightingParser_ExecuteScene (RenderCore::IThreadContext &context, LightingParserContext &parserContext, ISceneParser &sceneParser, const RenderCore::Techniques::CameraDesc &camera, const RenderingQualitySettings &qualitySettings)
 Execute rendering More...
 
void LightingParser_ExecuteScene (RenderCore::Metal::DeviceContext &metalContext, LightingParserContext &parserContext, const RenderingQualitySettings &qualitySettings)
 Executes the scene currently set to the parser context More...
 
auto LightingParser_SetupScene (MetalContext &context, LightingParserContext &parserContext, ISceneParser *sceneParser=nullptr) -> AttachedSceneMarker
 Initialise basic states for scene rendering More...
 
void LightingParser_SetGlobalTransform (MetalContext &context, LightingParserContext &parserContext, const RenderCore::Techniques::ProjectionDesc &projDesc)
 Set camera related states after camera changes More...
 
void SetFrameGlobalStates (MetalContext &context)
 
void BindShadowsForForwardResolve (Metal::DeviceContext &metalContext, Techniques::ParsingContext &parsingContext, const PreparedDMShadowFrustum &dominantLight)
 
void UnbindShadowsForForwardResolve (Metal::DeviceContext &metalContext, Techniques::ParsingContext &parsingContext)
 
LightResolveResourcesRes LightingParser_BindLightResolveResources (Metal::DeviceContext &context, LightingParserContext &parserContext)
 
void LightingParser_ResolveGBuffer (Metal::DeviceContext &context, LightingParserContext &parserContext, MainTargetsBox &mainTargets, LightingResolveTextureBox &lightingResTargets)
 
void LightingParser_InitBasicLightEnv (Metal::DeviceContext &context, LightingParserContext &parserContext, ISceneParser &sceneParser)
 
void Deferred_DrawDebugging (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, MainTargetsBox &mainTargets, unsigned debuggingType)
 
void BuildShadowConstantBuffers (CB_ArbitraryShadowProjection &arbitraryCBSource, CB_OrthoShadowProjection &orthoCBSource, const MultiProjection< MaxShadowTexturesPerLight > &desc)
 
RenderCore::SharedPkt BuildScreenToShadowConstants (unsigned frustumCount, const CB_ArbitraryShadowProjection &arbitraryCB, const CB_OrthoShadowProjection &orthoCB, const Float4x4 &cameraToWorld, const Float4x4 &cameraToProjection)
 
RenderCore::SharedPkt BuildScreenToShadowConstants (const PreparedShadowFrustum &preparedFrustum, const Float4x4 &cameraToWorld, const Float4x4 &cameraToProjection)
 
void BindShadowsForForwardResolve (RenderCore::Metal::DeviceContext &metalContext, RenderCore::Techniques::ParsingContext &parsingContext, const PreparedDMShadowFrustum &dominantLight)
 
void UnbindShadowsForForwardResolve (RenderCore::Metal::DeviceContext &metalContext, RenderCore::Techniques::ParsingContext &parsingContext)
 
void RenderGPUMetrics (RenderCore::Metal::DeviceContext &context, LightingParserContext &parsingContext, const ::Assets::ResChar shaderName[], std::initializer_list< const ::Assets::ResChar * > valueSources, unsigned protectStates)
 
void FFT_DoDebugging (RenderCore::Metal::DeviceContext *context)
 
bool CalculateGridProjection (GridRenderingConstants &result, Techniques::ProjectionDesc &mainCameraProjection, float oceanBaseHeight)
 
void DrawProjectorFrustums (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, Techniques::ProjectionDesc &mainCameraProjection, float oceanBaseHeight)
 
void RenderOceanSurface (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, const DeepOceanSimSettings &oceanSettings, const OceanLightingSettings &oceanLightingSettings, DeepOceanSim &fftBuffer, ShallowWaterSim *shallowWater, RefractionsBuffer *refractionsBox, RenderCore::Metal::ShaderResourceView &depthBufferSRV, int techniqueIndex)
 
void Ocean_Execute (DeviceContext *context, LightingParserContext &parserContext, const DeepOceanSimSettings &settings, const OceanLightingSettings &lightingSettings, ShaderResourceView &depthBufferSRV)
 
void Ocean_Execute (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, const DeepOceanSimSettings &settings, const OceanLightingSettings &lightingSettings, RenderCore::Metal::ShaderResourceView &depthBufferSRV)
 
void OrderIndependentTransparency_ClearAndBind (RenderCore::Metal::DeviceContext &context, TransparencyTargetsBox &transparencyTargets, const RenderCore::Metal::ShaderResourceView &depthBufferDupe)
 
TransparencyTargetsBoxOrderIndependentTransparency_Prepare (Metal::DeviceContext &metalContext, LightingParserContext &, const Metal::ShaderResourceView &depthBufferDupe)
 
void OrderIndependentTransparency_Resolve (RenderCore::Metal::DeviceContext &metalContext, LightingParserContext &parserContext, TransparencyTargetsBox &transparencyTargets, const Metal::ShaderResourceView &originalDepthStencilSRV)
 
TransparencyTargetsBoxOrderIndependentTransparency_Prepare (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, const RenderCore::Metal::ShaderResourceView &depthBufferDupe)
 
void OrderIndependentTransparency_Resolve (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, TransparencyTargetsBox &targets, const RenderCore::Metal::ShaderResourceView &originalDepthStencilSRV)
 
uint64 BuildGuid64 ()
 
void Rain_Render (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext)
 
void Rain_RenderSimParticles (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, RenderCore::Metal::ShaderResourceView &depthsSRV, RenderCore::Metal::ShaderResourceView &normalsSRV)
 
void SparkParticleTest_RenderSimParticles (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, RenderCore::Metal::ShaderResourceView &depthsSRV, RenderCore::Metal::ShaderResourceView &normalsSRV)
 
PreparedRTShadowFrustum PrepareRTShadows (Metal::DeviceContext &metalContext, LightingParserContext &parserContext, const ShadowProjectionDesc &frustum, unsigned shadowFrustumIndex)
 
void RTShadows_DrawMetrics (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, MainTargetsBox &mainTargets)
 
PreparedRTShadowFrustum PrepareRTShadows (RenderCore::Metal::DeviceContext &metalContext, LightingParserContext &parserContext, const ShadowProjectionDesc &frustum, unsigned shadowFrustumIndex)
 
RenderCore::Metal::ShaderResourceView BuildDuplicatedDepthBuffer (RenderCore::Metal::DeviceContext *context, ID3D::Resource *sourceDepthBuffer)
 
void DrawBasisAxes (RenderCore::Metal::DeviceContext *context, const SceneEngine::LightingParserContext &parserContext, const Float3 &offset)
 
BufferUploads::IManagerGetBufferUploads ()
 
BufferUploads::BufferDesc BuildRenderTargetDesc (BufferUploads::BindFlag::BitField bindFlags, const BufferUploads::TextureDesc &textureDesc, const char name[])
 
void SetupVertexGeneratorShader (Metal::DeviceContext &context)
 
void BuildGaussianFilteringWeights (float result[], float standardDeviation, unsigned weightsCount)
 
float PowerForHalfRadius (float halfRadius, float powerFraction)
 
ResourcePtr CreateResourceImmediate (const BufferUploads::BufferDesc &desc)
 
void DrawPendingResources (Metal::DeviceContext *context, SceneEngine::LightingParserContext &parserContext, RenderOverlays::Font *font)
 
void DrawQuickMetrics (Metal::DeviceContext *context, SceneEngine::LightingParserContext &parserContext, RenderOverlays::Font *font)
 
Int2 GetCursorPos ()
 
bool IsLButtonDown ()
 
bool IsShiftDown ()
 
void CheckSpecularIBLMipMapCount (const RenderCore::Metal::ShaderResourceView &srv)
 
IteratorRange< RenderCore::Assets::DelayStep * > AsDelaySteps (SceneParseSettings::BatchFilter filter)
 
void ShaderBasedCopy (Metal::DeviceContext &context, const Metal::DepthStencilView &dest, const Metal::ShaderResourceView &src, ProtectState::States::BitField protectStates)
 
void ShaderBasedCopy (Metal::DeviceContext &context, const RenderCore::Metal::RenderTargetView &dest, const RenderCore::Metal::ShaderResourceView &src, std::pair< UInt2, UInt2 > destination, std::pair< UInt2, UInt2 > source, CopyFilter filter, ProtectState::States::BitField protectStates)
 
void SetupVertexGeneratorShader (RenderCore::Metal::DeviceContext &context)
 
void DrawPendingResources (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, RenderOverlays::Font *font)
 
void DrawQuickMetrics (RenderCore::Metal::DeviceContext *context, SceneEngine::LightingParserContext &parserContext, RenderOverlays::Font *font)
 
Float3 AsFloat3Color (unsigned packedColor)
 
unsigned AsPackedColor (Float3 col)
 
void ShaderBasedCopy (RenderCore::Metal::DeviceContext &context, const RenderCore::Metal::DepthStencilView &dest, const RenderCore::Metal::ShaderResourceView &src, ProtectState::States::BitField protectStates=~0u)
 Copy from a shader resource onto a depth buffer, using a Draw operation More...
 
void ShaderBasedCopy (RenderCore::Metal::DeviceContext &context, const RenderCore::Metal::RenderTargetView &dest, const RenderCore::Metal::ShaderResourceView &src, std::pair< UInt2, UInt2 > destination, std::pair< UInt2, UInt2 > source, CopyFilter filter=CopyFilter::Bilinear, ProtectState::States::BitField protectStates=~0u)
 
ScreenSpaceReflectionsResources::Desc GetConfig (unsigned width, unsigned height, bool useMsaaSamplers, bool hasGBufferProperties)
 
Metal::ShaderResourceView ScreenSpaceReflections_BuildTextures (Metal::DeviceContext *context, LightingParserContext &parserContext, unsigned width, unsigned height, bool useMsaaSamplers, Metal::ShaderResourceView &gbufferDiffuse, Metal::ShaderResourceView &gbufferNormals, Metal::ShaderResourceView &gbufferParam, Metal::ShaderResourceView &depthsSRV)
 
RenderCore::Metal::ShaderResourceView ScreenSpaceReflections_BuildTextures (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, unsigned width, unsigned height, bool useMsaaSamplers, RenderCore::Metal::ShaderResourceView &gbufferDiffuse, RenderCore::Metal::ShaderResourceView &gbufferNormals, RenderCore::Metal::ShaderResourceView &gbufferParam, RenderCore::Metal::ShaderResourceView &depthsSRV)
 
void CheckInitialClear (MetalContext &context, ShallowWaterGrid &grid)
 
Float4 OceanHack_CompressionConstants (RenderCore::Metal::DeviceContext &metalContext, LightingParserContext &parserContext, float baseHeight, float compressionAmount, float compressionRadius)
 
void Sky_Render (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, bool blendFog)
 
void Sky_RenderPostFog (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext)
 
void SunFlare_Execute (RenderCore::Metal::DeviceContext *context, LightingParserContext &parserContext, RenderCore::Metal::ShaderResourceView &depthsSRV)
 
unsigned CompressedHeightMask (bool encodedGradientFlags)
 
float GetTerrainHeight (ITerrainFormat &ioFormat, const TerrainConfig &cfg, const TerrainCoordinateSystem &coords, Float2 queryPosition)
 Gets the height of the terrain at a position, without using the GPU More...
 
std::pair< float, float > CalculateMinAndMaxHeights (const ::Assets::ResChar heightMapFilename[], ITerrainFormat &ioFormat)
 
void WriteTerrainCachedData (Utility::OutputStream &stream, const TerrainConfig &cfg, ITerrainFormat &format)
 
void WriteTerrainMaterialData (Utility::OutputStream &stream, const TerrainMaterialConfig &cfg)
 
std::vector< PrimedCellBuildPrimedCells (const TerrainConfig &cfg)
 
template<typename InputType >
::Assets::rstring AsRString (InputType input)
 
template<typename InputType >
::Assets::rstring AsRString (StringSection< InputType > input)
 
bool IsCompatible (const TerrainRendererConfig &lhs, const TerrainRendererConfig &rhs)
 
void DoShortCircuitUpdate (uint64 cellHash, TerrainCoverageId layerId, std::weak_ptr< TerrainCellRenderer > renderer, TerrainCellId::UberSurfaceAddress uberAddress, const ShortCircuitUpdate &upd)
 
void TiledLighting_DrawDebugging (RenderCore::Metal::DeviceContext &context, LightingParserContext &lightingParserContext, TileLightingResources &tileLightingResources)
 
RenderCore::Metal::ShaderResourceView TiledLighting_CalculateLighting (RenderCore::Metal::DeviceContext *context, LightingParserContext &lightingParserContext, ShaderResourceView &depthsSRV, ShaderResourceView &normalsSRV)
 
ConstantBuffer DuplicateResource (DeviceContext *context, ConstantBuffer &inputResource)
 
void TiledLighting_RenderBeamsDebugging (RenderCore::Metal::DeviceContext *context, LightingParserContext &lightingParserContext, bool active, unsigned mainViewportWidth, unsigned mainViewportHeight, unsigned techniqueIndex)
 
RenderCore::Metal::ShaderResourceView TiledLighting_CalculateLighting (RenderCore::Metal::DeviceContext *context, LightingParserContext &lightingParserContext, RenderCore::Metal::ShaderResourceView &depthsSRV, RenderCore::Metal::ShaderResourceView &normalsSRV)
 
ColorGradingShaderConstants BuildColorGradingShaderConstants (const ColorGradingSettings &settings)
 
ToneMapSettingsConstants AsConstants (const ToneMapSettings &settings)
 
LuminanceResult ToneMap_SampleLuminance (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, const ToneMapSettings &settings, const RenderCore::Metal::ShaderResourceView &inputResource, bool doAdapt)
 
LuminanceResult ToneMap_SampleLuminance (RenderCore::Metal::DeviceContext &context, RenderCore::Techniques::ParsingContext &parserContext, const ToneMapSettings &settings, const RenderCore::Metal::ShaderResourceView &inputResource, bool doAdapt)
 
void ToneMap_Execute (Metal::DeviceContext &context, RenderCore::Techniques::ParsingContext &parserContext, const LuminanceResult &luminanceResult, const ToneMapSettings &settings, const Metal::ShaderResourceView &inputResource)
 
void AtmosphereBlur_Execute (Metal::DeviceContext &context, LightingParserContext &parserContext, const AtmosphereBlurSettings &settings)
 
ColorGradingSettings DefaultColorGradingSettings ()
 
void ToneMap_Execute (RenderCore::Metal::DeviceContext &context, RenderCore::Techniques::ParsingContext &parserContext, const LuminanceResult &luminanceResult, const ToneMapSettings &settings, const RenderCore::Metal::ShaderResourceView &inputResource)
 
void AtmosphereBlur_Execute (RenderCore::Metal::DeviceContext &context, LightingParserContext &parserContext, const AtmosphereBlurSettings &settings)
 
void VegetationSpawn_Prepare (Metal::DeviceContext *context, LightingParserContext &parserContext, const VegetationSpawnConfig &cfg, VegetationSpawnResources &res)
 
bool VegetationSpawn_DrawInstances (Metal::DeviceContext &context, VegetationSpawnResources &res, unsigned instanceId, unsigned indexCount, unsigned startIndexLocation, unsigned baseVertexLocation)
 
void VegetationSpawn_Prepare (RenderCore::Metal::DeviceContext *context, LightingParserContext &lightingParserContext, const VegetationSpawnConfig &cfg, VegetationSpawnResources &resources)
 
bool VegetationSpawn_DrawInstances (RenderCore::Metal::DeviceContext *context, VegetationSpawnResources &resources, unsigned instanceId, unsigned indexCount, unsigned startIndexLocation, unsigned baseVertexLocation)
 
VolumetricFogMaterial VolumetricFogMaterial_Default ()
 
float CalculateInscatter (float distance, float density)
 
void VolumetricFog_Build (RenderCore::Metal::DeviceContext *context, LightingParserContext &lightingParserContext, bool useMsaaSamplers, PreparedDMShadowFrustum &shadowFrustum, const VolumetricFogConfig::Renderer &rendererCfg, const VolumetricFogConfig::FogVolume &cfg)
 
void VolumetricFog_Resolve (RenderCore::Metal::DeviceContext *context, LightingParserContext &lightingParserContext, unsigned samplingCount, bool useMsaaSamplers, bool flipDirection, PreparedShadowFrustum *shadowFrustum, const VolumetricFogConfig::Renderer &rendererCfg, const VolumetricFogConfig::FogVolume &cfg)
 

Variables

DeepOceanSimSettings GlobalOceanSettings
 
OceanLightingSettings GlobalOceanLightingSettings
 
MaterialOverride GlobalMaterialOverride = { 0.f, 0.6f, 0.05f, 0.f, 1.f, 1.f, 1.f, 0.f, 0.f, 1.f, 0.f, 0.f }
 
RenderCore::Metal::ShaderResourceView OceanReflectionResource
 
Float4x4 OceanWorldToReflection = Identity<Float4x4>()
 
ISurfaceHeightsProviderMainSurfaceHeightsProvider = nullptr
 
Int2 TerrainOffset
 
template TerrainUberSurface< ShadowSample >
 
template TerrainUberSurface< uint8 >
 

Detailed Description

World rendering technologies and lighting resolve.

SceneEngine provides rendering technologies and features for environments, as well as the structure for the lighting resolve step.

It works on top of RenderCore (which provides the primitive low-level API for draw operations) to create the elements of the scene: forests of objects, terrain, lighting, fogging, water, etc.

"Parsing" a scene

SceneEngine provides the technologies for rendering a scene, but it doesn't provide all of the structure for composing a scene. Many engines use a rigid structure (such as a scene graph) for composing and organising the part of the scene. But the nature of this structure is (in some ways) less generic than the parts themselves. So this behaviour has been pushed into a higher level library.

Instead, the SceneEngine simply introduces the concept of "parsing" a scene. That just means moving through the structure of the scene (whatever structure that is) and executing the component parts as necessary.

Here, we are using the term in the same way we use "walking" in "walking through a tree" or "parsing" in "parsing a scripting language." Let's imagine that the scene is (conceptually) a structured set of commands (such as draw this object, conditionally set this render state, etc) which we must parse through every frame.

Lighting "parser"

We also have a lighting "parser", which works in parallel to the scene parser. Here, we again imagine the lighting process as a set of commands. The lighting parser controls how we step through those commands.

The goal is to separate the contents of the scene (ie, what objects make up our world) and the lighting process (ie, how the objects are presented).

The scene parser is responsible for what is in the scene; and the lighting parser is responsible for how it appears on screen.

Key concepts

Concept Description
ISceneParser interface for a scene implementation. Implemented at a higher level
LightingParserContext context state for the lighting parser
ILIghtingParserPlugin plug-in to allow extensions to the lighting process
LightingParser_ExecuteScene() main lighting parser entry point
LightingResolveContext context while performing deferred lighting resolve steps

Scene element implementations

Concept Description
TerrainManager top level manager for terrain rendering
PlacementsManager top level manager for "placements" (or simple static objects)
Ocean_Execute() deep ocean rendering
ShallowSurfaceManager shallow water surfaces (such as rivers and lakes)
VolumetricFogManager volumetric fog effect renderer
AmbientOcclusion_Render() ambient occlusion renderer
TiledLighting_CalculateLighting() tiled & cascaded lighting implementation
ToneMap_Execute() tonemap entry point

Platform considerations

SceneEngine is a combination of platform-generic and platform-specific functionality. Most of the platform specific code is pushed into the RenderCore library. However, some effects and technologies in SceneEngine are designed and optimised for specific hardware (or a specific platform).

As a result, while the core parts of SceneEngine are platform-generic, there are some parts that must be disabled on some platforms (particularly for lower-power platforms).

Given that the graphics API is selected at compile-time (as opposed to link-time or run-time), the are separate scene engine library outputs for each graphics API (in other words, the library compiles to SceneEngineDX11.lib or SceneEngineOpenGLES.lib).

Function Documentation

RenderCore::Techniques::ProjectionDesc SceneEngine::BuildProjectionDesc ( const RenderCore::Techniques::CameraDesc sceneCamera,
UInt2  viewportDims,
const Float4x4 *  specialProjectionMatrix = nullptr 
)

Build a projection desc with parameters from a standard camera

RenderCore::Techniques::ProjectionDesc SceneEngine::BuildProjectionDesc ( const Float4x4 &  cameraToWorld,
float  l,
float  t,
float  r,
float  b,
float  nearClip,
float  farClip 
)

Build a projection desc for an orthogonal camera

float SceneEngine::GetTerrainHeight ( ITerrainFormat ioFormat,
const TerrainConfig cfg,
const TerrainCoordinateSystem coords,
Float2  queryPosition 
)

Gets the height of the terrain at a position, without using the GPU

There are 2 forms of intersection testing supported by the system. TerrainManager::CalculateIntersections uses the GPU, and calculates an intersection against post-LOD geometry. It is intended for tools that want match mouse clicks against rendered geometry. In constrast, GetTerrainHeight does not use the GPU and only tests against the top LOD. This is used by simple physical simulations (such as sliding a character across the terrain surface). Note that this requires loading some terrain height data into main memory (whereas rendering only requires height data in GPU memory). So, this can require reading height data from disk a second time.

void SceneEngine::LightingParser_ExecuteScene ( RenderCore::IThreadContext context,
LightingParserContext parserContext,
ISceneParser sceneParser,
const RenderCore::Techniques::CameraDesc camera,
const RenderingQualitySettings qualitySettings 
)

Execute rendering

This is the main entry point for rendering a scene. The lighting parser will organize buffers, perform lighting resolve operations and call out to the scene parser when parts of the scene need to be rendered. Typically this is called once per frame (though perhaps there are times when multiple renders are required for a frame, maybe for reflections).

Note that the lighting parser will write the final result to the render target that is currently bound to the given context! Often, this will be the main back buffer. Usually, the width and height in "qualitySettings" should be the same dimensions as this output buffer (but that doesn't always have to be the case).

The "qualitySettings" parameter allows the caller to define the resolution and sampling quality for rendering the scene. Be careful to select valid settings for sampling quality.

Basic usage: auto renderDevice = RenderCore::CreateDevice(); auto presentationChain = renderDevice->CreatePresentationChain(...); LightingParserContext lightingParserContext(...); renderDevice->BeginFrame(presentationChain.get());

SceneEngine::RenderingQualitySettings qualitySettings; auto presChainDesc = presentationChain->GetDesc(); qualitySettings._width = presChainDesc._width; qualitySettings._height = presChainDesc._height; qualitySettings._samplingCount = 1; qualitySettings._samplingQuality = 0;

auto context = RenderCore::Metal::DeviceContext::GetImmediateContext(renderDevice.get()); SceneEngine::LightingParser_Execute(context, lightingParserContext, qualitySettings);

presentationChain->Present();

void SceneEngine::LightingParser_ExecuteScene ( RenderCore::Metal::DeviceContext &  metalContext,
LightingParserContext parserContext,
const RenderingQualitySettings qualitySettings 
)

Executes the scene currently set to the parser context

The currently attached scene will be rendered. Call LightingParser_SetupScene to attach a scene to the parser context before calling this. The other version of LightingParser_ExecuteScene is intended for most cases. But this version can be used for special case purpose (for example, when a special case projection matrix is required)

void SceneEngine::LightingParser_SetGlobalTransform ( MetalContext &  context,
LightingParserContext parserContext,
const RenderCore::Techniques::ProjectionDesc projDesc 
)

Set camera related states after camera changes

Normally this is called automatically by the system. But in cases where you need to change the camera settings, you can manually force an update of the shader constants related to projection with this call. (for example, used by the vegetation spawn to temporarily reduce the far clip distance)

See also
LightingParser_SetupScene
auto SceneEngine::LightingParser_SetupScene ( MetalContext &  context,
LightingParserContext parserContext,
ISceneParser sceneParser = nullptr 
) -> AttachedSceneMarker

Initialise basic states for scene rendering

Some render operations don't want to use the full lighting parser structure. In these cases, you can use LightingParser_SetupScene() to initialise the global states that are normally managed by the lighting parser. Note – don't call this if you're using LightingParser_Execute.

See also
LightingParser_Execute
void SceneEngine::Ocean_Execute ( RenderCore::Metal::DeviceContext *  context,
LightingParserContext parserContext,
const DeepOceanSimSettings settings,
const OceanLightingSettings lightingSettings,
RenderCore::Metal::ShaderResourceView &  depthBufferSRV 
)

Entry point for ocean rendering Draws the surface of the ocean, according to the given settings.

void SceneEngine::ShaderBasedCopy ( RenderCore::Metal::DeviceContext &  context,
const RenderCore::Metal::DepthStencilView &  dest,
const RenderCore::Metal::ShaderResourceView &  src,
ProtectState::States::BitField  protectStates = ~0u 
)

Copy from a shader resource onto a depth buffer, using a Draw operation