stephen-hqxu / superterrainplus

SuperTerrain+: A real-time procedural 3D infinite terrain engine with geographical features and photorealistic rendering.
MIT License
12 stars 1 forks source link

Implementing Photorealistic Rendering Engine #31

Closed stephen-hqxu closed 2 years ago

stephen-hqxu commented 2 years ago

This is probably one of the biggest releases ever made, with the introduction of a new module, SuperRealism+, as a photorealistic rendering engine.

With this aside, SuperDemo+ has also received a significant amount of rework. As the new module will now handle all rendering, therefore the demo application can be simplified. Currently not all features in the realism module are added to the demo program due to the development time constraints, we will be doing that post-release.


SuperRealism+

This new module aims to provide built-in support for real-time photorealistic rendering, with certain utilities that help building such application.

GL wrappers

It comes with GL object wrappers for handing GL objects in a object-oriented manner, and currently it supports:

More objects will be wrapped later, but for now we have only added stuff we need.

STPSun

This is a newly introduced feature to our procedural rendering. Based on this implementation, it renders a sun and simulates atomshperic scattering such that the color of the sky can be presented, relatively accurately, based on the time of a day as well as other physica aspects like thickness of atmosphere. Scattering is rendered using two-phase sphere-ray marching; it is understandable that this simulation is pretty expensive, so we also included settings for clients to adjust the rendering quality based on the amount of computation power on their machine. What's more, it also allows simulating sky effects on other planets because all rendering equations are real-world based.

In addition to this, the sun in the sky physically and accurately cycles following the pattern how the Earth rotates about the Sun, this allows the the renderered scene to have seasonal effects and the angle of the sun varies based on such conditions.

STPSun is only the first step into photorealistic, later we will be adding more elements like night scene rendering with procedural starfield generation.

STPHeightfieldTerrain

This is a migration of the old STPProcedural2DINF with use of GL wrappers introduced newly. Generally the functionality remains the same, with texture splatting system improved and, instead of hard-coding the size of texture lookup table in the shader, we introduce a pre-defined macro utilities that allows assigning macro with values during runtime (N.B. runtime is relative to the application rather than OpenGL) before shader compilation.

Checklist

SuperRealism+

SuperDemo+

Others