Opened 7 years ago

Closed 7 years ago

Last modified 7 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 7 years ago.
4351_shadows.patch (4.6 KB ) - added by Vladislav Belov 7 years ago.
Current state

Download all attachments as: .zip

Change History (24)

by Vladislav Belov, 7 years ago

Attachment: shadows_resized.png added

comment:1 by Vladislav Belov, 7 years ago

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

comment:2 by Vladislav Belov, 7 years ago

Description: modified (diff)

comment:3 by gameboy, 7 years ago

@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 by Lionkanzen, 7 years ago

Needs review may be.

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

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 by Lionkanzen, 7 years ago

Add review tag to your work.

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

Replying to Lionkanzen:

Add review tag to your work.

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

comment:8 by Vladislav Belov, 7 years ago

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

comment:9 by gameboy, 7 years ago

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 7 years ago by gameboy (previous) (diff)

by Vladislav Belov, 7 years ago

Attachment: 4351_shadows.patch added

Current state

comment:10 by elexis, 7 years ago

Milestone: Alpha 22Work In Progress

Moving to the new WIP milestone.

comment:11 by Sandarac, 7 years ago

Description: modified (diff)

Refs #743.

comment:12 by elexis, 7 years ago

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 by elexis, 7 years ago

Replace the switch with a formula.

comment:14 by elexis, 7 years ago

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 by Stan, 7 years ago

Maybe we could disable it somehow for low end computers.

in reply to:  15 comment:16 by Vladislav Belov, 7 years ago

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 by Stan, 7 years ago

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

comment:18 by elexis, 7 years ago

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 a 2x-multiple of the screensize, so 1024x1024 or 2048x2048 and this patch multiplies that with 1/4, 1/2, 1, 2 or 4.

Version 0, edited 7 years ago by elexis (next)

comment:19 by elexis, 7 years ago

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 by elexis, 7 years ago

Keywords: review removed

Thanks for the patch!

comment:21 by elexis, 7 years ago

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 by elexis, 7 years ago

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.