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

Hard-coded specularity #38

Closed stephen-hqxu closed 2 years ago

stephen-hqxu commented 2 years ago

Issue

The specular power is a hard-coded value in the lighting shader.

https://github.com/stephen-hqxu/superterrainplus/blob/08eb7a6b07d8beb63a1adffe9d70576e4d9594b2/SuperTerrain%2B/ModuleInterface/SuperRealism%2B/Shader/STPDeferredShading.frag#L146

Suggestion

Provide a way to configure it. I also noticed the roughness map in the terrain fragment shader is not written to the geometry buffer and used by the lighting shader, maybe we can calculate the specularity based on texture roughness value?

stephen-hqxu commented 2 years ago

Done

During initialisation of STPScenePipeline, user can now specify the shading equation to be used for lighting and pass appropriate parameters.