volumetric: Add volumetric lighting#3668
Conversation
|
Doing some very preliminary testing:
|
|
Something seems to be broken in this PR with regard to OpenGL rendering backend. Even with "volumetric lighting = off" (but also reproduces with other value for the setting), when I start beta 1 campaign, I consistently see null pointer dereference exception at void gl_context::bind_pipeline(gfx_api::pipeline_state_object* pso, bool notextures)
{
gl_pipeline_id* newPSOId = static_cast<gl_pipeline_id*>(pso);
// lookup pipeline
auto& pipelineInfo = createdPipelines[newPSOId->psoID]; //< `newPSOId` is null!
gl_pipeline_state_object* new_program = pipelineInfo.pso;
...Also attaching the stacktrace: Additional info:
|
ManManson
left a comment
There was a problem hiding this comment.
Some minor comments, plus the PR crashes for OpenGL rendering backed. Otherwise, looks good.
Also, please rebase the branch to resolve the conflicts against master.
|
|
||
|
|
||
| uniform vec4 cameraPos; // in modelSpace | ||
| //uniform vec4 cameraPos; // in modelSpace |
There was a problem hiding this comment.
No need to keep commented code. We can always bring it back via git, if needed.
| vec4 fragColor = main_bumpMapping(); | ||
|
|
||
| if (fogEnabled > 0) | ||
| if (WZ_VOLUMETRIC_LIGHTING_ENABLED != 1) { |
There was a problem hiding this comment.
Can you please elaborate why in this particular place the condition is != 1, when in other places (e.g. tcmask_instanced.frag) it's != 0? If this is expected, a comment about this would be really helpful.
| vec4 fragColor = main_bumpMapping(); | ||
|
|
||
| if (fogEnabled > 0) | ||
| if (WZ_VOLUMETRIC_LIGHTING_ENABLED != 1) { |
@ManManson Can you try running again with command-line option |
|
Sure, I'll try to check in a few days. |
|
Here are some relevant details from the log file: Is this output sufficient to pinpoint the problem? |
|
I'll take another stab at this in a few days and will try to fix the remaining issues mentioned above so we can proceed with merging this to upstream. |
This PR adds volumetric lighting for sunlight and point lights.
The volumetric effect is raymarch based and is based on physical transmittance equation
The fog is "thicker" around z = 0, and thickness follow an exponential curve
sunlight has shadow support (but it seems quite costly)