Skip to content
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

Permanently noisy world after certain visual effects #226

Open
Paril opened this issue May 12, 2022 · 7 comments
Open

Permanently noisy world after certain visual effects #226

Paril opened this issue May 12, 2022 · 7 comments

Comments

@Paril
Copy link
Contributor

Paril commented May 12, 2022

When certain temporary visual effects are used, sometimes the result is that that area of the world becomes permanently noisy.

Initially I was able to repro this with a material on a TE_LIGHTNING bolt, but I couldn't get this to happen again with the latest versions. However, I found that RF_BEAM entities do repro the issue. Some mods use RF_BEAMs as replacements for blaster bolts, for instance, but I don't know if they're able to reproduce this on a large scale.

A way to reproduce this is to shim this code above the call to prepare_entities on line 2905:

	// TEST
	// debug bones
	int x = Cvar_Get("pt_test_debug", "0", 0)->integer;
	for (size_t i = 0; i < x; i++) {
		vec3_t r = { 40 + (crand() * 40), crand() * 40, crand() * 40 };
		particle_t *pr = &fd->particles[fd->num_particles++];
		memset(pr, 0, sizeof(*pr));
		pr->color = -1;
		pr->brightness = 1;
		pr->radius = 1.0f;
		pr->rgba = (color_t) { .u8 = { 255, 0, 0, 255 } };
		pr->alpha = 1.f;
		VectorAdd(cl.playerEntityOrigin, r, pr->origin);

		entity_t *b = &fd->entities[fd->num_entities++];
		memset(b, 0, sizeof(*b));
		b->skinnum = -1;
		b->rgba = (color_t) { .u8 = { 0, 0, 255, 255 } };
		b->alpha = 0.30f;
		b->flags = RF_TRANSLUCENT | RF_BEAM;
		b->frame = 8;
		VectorCopy(pr->origin, b->origin);
		vec3_t r2 = { 40 + (crand() * 40), crand() * 40, crand() * 40 };
		VectorAdd(pr->origin, r2, b->oldorigin);
	}
	// TEST

this produces a fake but similar output to what I'm doing with my bone debugger. Load up q2dm1, set pt_test_debug to a number (40 is what I was testing with, but various numbers will work), then set it back to 0. Notice now that the area you are in is permanently noisy even though there are no more lasers lighting the scene.

@res2k
Copy link
Contributor

res2k commented May 12, 2022

on line 2905:

Not sure this number is correct on current master; can you provide some context (lines before/after)?

@Paril
Copy link
Contributor Author

Paril commented May 12, 2022

Directly before the call to "prepare_entities". There's only one call to it, so it should be easy to find. It's 2828 on master I think?

Here's a video of the issue, but it may not be easy to see from a video. It's most noticeable in-game. https://streamable.com/736pzz

@res2k
Copy link
Contributor

res2k commented May 12, 2022

Directly before the call to "prepare_entities". There's only one call to it, so it should be easy to find. It's 2828 on master I think?

Ah ok. I was thinking I needed to add the stuff in prepare_entities(). That line number looks sensible.

@Paril
Copy link
Contributor Author

Paril commented May 12, 2022

It's definitely related to the renderer's current state; a vid_restart resolves the noise until you add the beams back.

@res2k
Copy link
Contributor

res2k commented May 12, 2022

Ok, I can see, not in the video but in the actual game.
It's quite subtle. Not really "noisy", more of a permanent shimmer that's added.
I suspect it's less visible with higher framerate, but it can be seen better with lower resolution scale.
When disabling the denoiser the difference is more apparent - they are quite a few more "dark" pixels afterwards.
So maybe something affects the directions chosen for light sampling or so?

@Paril
Copy link
Contributor Author

Paril commented May 12, 2022

Yeah, a shimmer is a good way of describing it. It creates ghosting behind everything too, which would kind of make sense if it's direction vector related.

res2k pushed a commit to res2k/Q2RTX that referenced this issue May 12, 2022
…ect_model_lights()

Previously, space was made in the light list offsets that amounted to the maximum
number of lights in a cluster, seen over the lifetime of the map. Unfortunately,
this affect light sampling after a large spike of dynamic lights in a cluster,
possibly resulting in a more 'noisy' appearance - as described in NVIDIA#226.

However, the exact number of lights in a cluster was actually already counted
and can be used to tightly pack the light lists, avoiding the permant effect
on sampling after a spike of dynamic lights.
res2k added a commit to res2k/Q2RTX that referenced this issue May 12, 2022
…ect_model_lights()

Previously, space was made in the light list offsets that amounted to the maximum
number of lights in a cluster, seen over the lifetime of the map. Unfortunately,
this affect light sampling after a large spike of dynamic lights in a cluster,
possibly resulting in a more 'noisy' appearance - as described in NVIDIA#226.

However, the exact number of lights in a cluster was actually already counted
and can be used to tightly pack the light lists, avoiding the permant effect
on sampling after a spike of dynamic lights.
res2k added a commit to res2k/Q2RTX that referenced this issue May 12, 2022
…ect_model_lights()

Previously, space was made in the light list offsets that amounted to the maximum
number of lights in a cluster, seen over the lifetime of the map. Unfortunately,
this affect light sampling after a large spike of dynamic lights in a cluster,
possibly resulting in a more 'noisy' appearance - as described in NVIDIA#226.

However, the exact number of lights in a cluster was actually already counted
and can be used to tightly pack the light lists, avoiding the permanent effect
on sampling after a spike of dynamic lights.
@Calinou
Copy link
Contributor

Calinou commented Dec 7, 2022

@Paril Can you test latest master now that #234 has been merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants