Improvement to Shadow System
Release 0.10.6
Better shadow system
- Shadow map filter can now be chosen in runtime. It current supports nearest and bilinear filter. More shadow smoothing techniques will be implemented in the future.
- Rename
STPCascadedShadowMaptoSTPDirectionalLightto make it more general. - Move shader storage buffer for shadow mapping from
STPDirectionalLighttoSTPShadowPipelinewhich is a new class. STPSunis now also given choices for casting or not casting shadows.- Add
STPShadowInformationfor sharing shadow map setting fromSTPShadowPipelineto various renderers. STPDirectionalLightnow uses camera callback to determine if light space matrices are outdated and only recompute them (and flush the buffer) whenever necessary.
With the new system, the correct order for setting up a rendering pipeline is:
- Create light that casts shadows.
- Create
STPShadowPipelinewith an array of pointers to light that just created. - Create all the rest of the scene including light that does not cast shadow and opaque object.
- Create
STPScenePipelinewith a pointer toSTPShadowPipeline.
As now lights hold memory owned by the scene pipeline, make sure lights are not writting to the buffer after the dependent scene pipeline is destroyed.
General fixes and improvement
- Fix a potential undefined behaviour in terrain fragment shader for accessing array of bindless samplers in a non-uniform manner.
- GL extension
NV_gpu_shader5is now required in order to run the program.
- GL extension
- Remove unnecessary extension directives from some shader codes.
- Move bindless shadow handle from individual shader to shader storage buffer to be shared among all renderers.
STPCameranow allows registering as many listeners as user wants.STPScenePipelinenow deregisters itself from camera callback at destruction.- Fix an incorrect return value semantics in shadow map sampling shader. The return value of that function represents the light intensity instead of shadow intensity, or light intensity = 1.0 - shadow intensity.
- Rename rendering function name from
operator()to some more concrete name likerender().