-
-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
volumetric: Add volumetric lighting #3668
base: master
Are you sure you want to change the base?
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -60,7 +60,7 @@ uniform vec4 diffuseLight; | |||
uniform vec4 specularLight; | |||
|
|||
|
|||
uniform vec4 cameraPos; // in modelSpace | |||
//uniform vec4 cameraPos; // in modelSpace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to keep commented code. We can always bring it back via git, if needed.
@@ -186,7 +190,13 @@ void main() | |||
{ | |||
vec4 fragColor = main_bumpMapping(); | |||
|
|||
if (fogEnabled > 0) | |||
if (WZ_VOLUMETRIC_LIGHTING_ENABLED != 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -125,7 +130,13 @@ void main() | |||
{ | |||
vec4 fragColor = main_bumpMapping(); | |||
|
|||
if (fogEnabled > 0) | |||
if (WZ_VOLUMETRIC_LIGHTING_ENABLED != 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
@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)