Water Shading
Pre-release
Pre-release
Release 0.13.0-Preview.3
BSDF
In this release we implemented a BSDF shader dedicated for rendering reflection and refraction of transparent object such as water. We have also added a material system to make rendering special effect flexibly and be easier to add supports for more objects in the future.
Currently BSDF is implemented using screen-space reflection/refraction therefore certain limitations apply. We will try to improve the visual quality and reduce artefacts brought by this approach, as well as introducing better algorithms, in the future.
We also update and refactor STPScenePipeline to support the newly added transparent objects and post effect.
- Add a new fragment shader that implements BSDF for water reflection and refraction using screen-space technique.
- Add
STPBidirectionalScatteringas a new rendering component for rendering reflective and refractive water (for now). - Add
STPBidirectionalScatteringSetting. - Add
STPMaterialLibrarywhich allows specifying material properties for special rendering components like water. STPWateris now allowed to specify material property with a material ID.- Introduce a new G-Buffer, material buffer. This buffer is a
unsigned intformat texture which stores material ID. This G-Buffer is enabled and has memory allocated only when material library is attached to the scene pipeline.
General fixes and improvement
- Improve
STPAlphaCullingand now it supports use of dual boolean expressions. - Replace unique light space size record in
STPScenePipelinefromstd::vectortostd::unordered_set. - Improve ambient occlusion shader to reuse the casted projection matrix in every iteration to avoid repetitive casting.
- Change noise texture in
STPHeightfieldTerrainto a bindless sampler. - Improve the HBAO algorithm a bit to make the occlusion more noticeable, i.e., stronger.
- Refactor view to NDC conversion function from
STPAmbientOcclusion.glslintoSTPCameraInformation.glsl. - Add a new function for camera to linearise depth.
STPScreennow passes shared vertex buffer around via astd::weak_ptrrather than a pointer to astd::shared_ptr.STPTextureandSTPSamplernow allows to set integer and unsigned integer format of border colour.- Remove
setData(vec3)function inSTPLightSpectrumbecause it is not useless. STPSunnow copiesSTPSunSettingunder its instance instead of taking a reference.
STPWater
- Fix a mistake in water tessellation shader which uses a variable before it is declared.
- Simplify the tessellation shader slightly.
- Fix a few silly mistakes in the shader which causes error during compilation.
- Fix some errors in the wave function.
- Improve water plane culling algorithm to reduce the chance of false positive.