Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#4351 closed enhancement (fixed)

[PATCH] Shadow map improvements

Reported by: Vladislav Belov Owned by: Vladislav Belov
Priority: Must Have Milestone: Alpha 23
Component: Core engine Keywords: patch
Cc: Patch:

Description (last modified by Sandarac)

Planned features:

  • Quality level selection (exists in current state): from Very Low (1/4x original size) to Very High (4x original size).
  • PSM optimization.

Current state: https://github.com/vladislavbelov/0ad/tree/shadows Comparasion: http://trac.wildfiregames.com/raw-attachment/ticket/4351/shadows_resized.png

Attachments (2)

shadows_resized.png (424.4 KB) - added by Vladislav Belov 3 years ago.
4351_shadows.patch (4.6 KB) - added by Vladislav Belov 3 years ago.
Current state

Download all attachments as: .zip

Change History (24)

Changed 3 years ago by Vladislav Belov

Attachment: shadows_resized.png added

comment:1 Changed 3 years ago by Vladislav Belov

Keywords: patch rfc added
Owner: set to Vladislav Belov
Status: newassigned
Summary: Shadow map improvements[PATCH] Shadow map improvements

comment:2 Changed 3 years ago by Vladislav Belov

Description: modified (diff)

comment:3 Changed 3 years ago by gameboy

@vladislavbelov: Your patch is very good, you can formally submit them, I would like to know, you have to add the graphics anti aliasing features.

comment:4 Changed 3 years ago by Lionkanzen

Needs review may be.

comment:5 in reply to:  3 Changed 3 years ago by Vladislav Belov

Replying to gameboy:

@vladislavbelov: Your patch is very good, you can formally submit them, I would like to know, you have to add the graphics anti aliasing features.

I couldn't commit, so I'm waiting for dev comments/review. There is a work about FXAA (https://wildfiregames.com/forum/index.php?/topic/20175-programmer-graphics-gameplay-ai-mikita-hradovich-yet-another-game-developer-wants-to-participate/&page=2), but it looks blured. I will test FXAA & SSAO, but I'm not sure that will be ok.

comment:6 Changed 3 years ago by Lionkanzen

Add review tag to your work.

comment:7 in reply to:  6 Changed 3 years ago by Vladislav Belov

Replying to Lionkanzen:

Add review tag to your work.

Review queue for final patches, before it should be in the rfc queue.

comment:8 Changed 3 years ago by Vladislav Belov

Changed the option label to "Shadow Quality", as @mimo suggested.

comment:9 Changed 3 years ago by gameboy

Yes, about the graph anti-aliasing patch, the people who make the patch we have not contact with him, his patch still exist many problems not be processed Maybe you can refer to his graphic anti-aliasing capabilities, make your graphics anti-aliasing patches. http://trac.wildfiregames.com/ticket/3640

Last edited 3 years ago by gameboy (previous) (diff)

Changed 3 years ago by Vladislav Belov

Attachment: 4351_shadows.patch added

Current state

comment:10 Changed 3 years ago by elexis

Milestone: Alpha 22Work In Progress

Moving to the new WIP milestone.

comment:11 Changed 2 years ago by Sandarac

Description: modified (diff)

Refs #743.

comment:12 Changed 2 years ago by elexis

Keywords: review added; rfc removed
Milestone: Work In ProgressAlpha 23
Priority: Should HaveMust Have

The options part can luckily become written way more elegantly now that options.js is agnostic of options.json, that we we can specify the value range -2 to +2 in the options.json file with a dropdown or better a slider.

The C++ patch is very very simple as it only scales the shadow texture size by a factor of 2. (Which explains why we only have -2 to +2 in the options).

The patch is correct because using the screensize as the texture size isn't perfect, considering that we don't use the top down perspective and therefore map multiple terrain pixels to a screen pixel.

The patch is a must have because the effects are great, especially when trying to render promotional material!

comment:13 Changed 2 years ago by elexis

Replace the switch with a formula.

comment:14 Changed 2 years ago by elexis

Perhaps we need a warning for people with low-memory graphic cards and a higher number for people with high memory graphic cards. Tried to increase the Ultra setting by 2x for the trailer and I got out of memory errors.

comment:15 Changed 2 years ago by stanislas69

Maybe we could disable it somehow for low end computers.

comment:16 in reply to:  15 Changed 2 years ago by Vladislav Belov

Replying to stanislas69:

Maybe we could disable it somehow for low end computers.

No need to do so, middle is default value, so if even this value doesn't work then nonpatched version won't work too. Also it's hard to detect free memory by many reasons.

But I want to implement shadows map changing without reloading.

comment:17 Changed 2 years ago by stanislas69

Quick question does it fix the flickering even in default mode ?

comment:18 Changed 2 years ago by elexis

It does not fix the flickering (just for the record: the flickering means the shadow changing position depending on the camera angle quickly) at all. It just makes it less visible the higher the shadow map resolution becomes.

Try reading the C++ patch, it's easy to understand. The shadow map size is just the closest power of 2 of the screensize, so 1024x1024 or 2048x2048 and this patch multiplies that with 1/4, 1/2, 1, 2 or 4.

Last edited 2 years ago by elexis (previous) (diff)

comment:19 Changed 2 years ago by elexis

Resolution: fixed
Status: assignedclosed

In 20001:

Shadow map quality option.

Differential Revision: https://code.wildfiregames.com/D745
Fixes #4351
Refs #743
Patch By: Vladislav

comment:20 Changed 2 years ago by elexis

Keywords: review removed

Thanks for the patch!

comment:21 Changed 2 years ago by elexis

In 20003:

Support numerical data in option dropdowns, as expected by the shadow map quality option.

Differential Revision: https://code.wildfiregames.com/D803
Refs #4351, D745.
Patch By: Vladislav

comment:22 Changed 2 years ago by elexis

In 20011:

Change the shadow map quality without restarting the match.

Differential Revision: https://code.wildfiregames.com/D804
Refs #4351
Patch By: Vladislav

Note: See TracTickets for help on using tickets.