Atlassian uses cookies to improve your browsing experience, perform analytics and research, and conduct advertising. Accept all cookies to indicate that you agree to our use of cookies on your device. Atlassian cookies and tracking notice, (opens new window)

Enlighten SDK 3.10 Documentation
Results will update as you type.
  • Welcome to Enlighten
  • How Enlighten works
  • Artist workflow
  • Install Enlighten
  • Libraries
  • Implementation guide
  • Technical reference
    • Output formats
    • Albedo handling
    • Lightmap lighting models
    • Light probe evaluation
    • Local IBL reflections
    • Light visibility data
    • Custom direct lights
    • Precompute pipeline
    • Low level precompute API
    • Debugging the precompute
    • The low level runtime
      • Low level runtime walkthrough
      • Input lighting
        • Input lighting concepts
        • Half-precision input lighting
        • Bounce Resampling
        • Probe bounce updates
        • Static destruction
      • Debug the low level runtime
    • Baked lighting
    • Performance tuning
    • Technical troubleshooting
    • Terrain LOD
    • Probe LOD
    • Lightmap LOD
  • Advanced techniques
  • Tools
  • Enlighten Mobile
  • White papers
  • Third-party licences
  • Release notes
    Calendars

You‘re viewing this with anonymous access, so some content might be blocked.
/
Static destruction

    This is the documentation for Enlighten.

    Static destruction

    Nov 21, 2019

    By designating geometry as transparent, you can adjust the transparency of the surface at runtime. This is not a physically-based transparency, but rather can be used to emulate destruction of surfaces, either by authoring the destruction or implementing it as a response to gameplay effects.

    For transparency to work, Enlighten needs to generate some additional data during precompute. This will happen by default, if however you do not need run time transparency to work for a given system you can switch it off with the following paramset parameter:

    computeClusterProbeSampleOffsetData="false"
    

    Once the precompute is run with this flag enabled, an optional RadDataBlock is generated within the InputWorkspace object:

    class InputWorkspace
    {
    public:
    ...
    /// Optional precomputed data used for transparency
    RadDataBlock m_ClusterProbeSampleOffsetData;
    };
    

    When this data is present in the InputWorkspace object, the following functions can be used to create the runtime transparency workspace:

    Geo::u32 GEO_CALL CalcTransparencyWorkspaceSize(const Enlighten::InputWorkspace* inputWorkspace, Geo::s32 numInterpolants, PrecisionHint::Value precision = PrecisionHint::DEFAULT_PRECISION);
    Enlighten::TransparencyWorkspace* GEO_CALL CreateTransparencyWorkspace(void* memory, const Enlighten::InputWorkspace* inputWorkspace, Geo::s32 numInterpolants, PrecisionHint::Value precision=PrecisionHint::DEFAULT_PRECISION);
    

    Note: Although the API currently provides specification of the precision, it is currently ignored.

    The transparency works by creating sample points on the opposite side of the transparent surface. The distance that these sample points are placed from the surface needs to be the approximate thickness of the transparent wall or object. This offset is automatically generated during the CreateSystemDusters stage of the precompute pipeline.

    To modify the transparency of a surface at runtime, update the TransparencyBuffer. You can also specify transparency per-pixel with InitialiseTransparencyBufferFromTexture, per-sample with InitialiseTransparencyBufferFromColoursPerPoint.

    Once per frame, before the call to DoIndirectInputLighting(), the transparency workspace needs to be updated with any new values in the probesets. This is done by calling:

    void GEO_CALL UpdateTransparencyWorkspace( const InputWorkspace* inputWorkspace, Enlighten::TransparencyWorkspace *transparencyWorkspace, const InterpolationInputSet* interpolationInputs, Geo::s32 numInterpolationInputs, bool recomputeInterpolants);
    

    When a probe set is added or removed from the list of inputs, the UpdateTransparencyWorkspace() function must be called with recomputeInterpolants set to true. If however, only the lighting has changed, then recomputeInterpolants can be set to false.

    To reset the transparency and offsets of the workspace, call the following functions passing 0.f for transparencyValue and offset:

    bool GEO_CALL SetTransparency(const Enlighten::InputWorkspace* inputWorkspace, Enlighten::TransparencyWorkspace *transparencyWorkspace, float transparencyValue);
    bool GEO_CALL SetSamplePositions( const Enlighten::InputWorkspace* inputWorkspace, Enlighten::TransparencyWorkspace *transparencyWorkspace, float offset, bool forceUpdate );
    

    For details on these functions, see InputWorkspace.h.

    The transparency workspace must then be set as a parameter on the Enlighten::IndirectInputLightingParameters class.

    Sample code for updating the transparency workspace:

    //Update transparency workspace
    if (system->m_TransparencyWorkspace && m_InterpolationInputSets.GetSize() && lightInputsChanged)
    {
    Enlighten::UpdateTransparencyWorkspace( system->m_InputWorkspace,
    system->m_TransparencyWorkspace,
    m_InterpolationInputSets.GetArray(),
    m_InterpolationInputSets.GetSize(),
    system->m_TransparencyInterpolantsNeedUpdate || requiresProbeInterpolationUpdate);
    system->m_TransparencyInterpolantsNeedUpdate = false;
    }
    
    , multiple selections available,
    {"serverDuration": 11, "requestCorrelationId": "cf8b1fe347874b4586300e57921f2418"}