Realtime PCF soft shadows support #18750

Closed
opened 2009-05-14 21:49:50 +02:00 by Sebastian De LA Torre · 15 comments

%%%This patch adds support for pcf filtering on realtime shadows using the spotlights Samples and Soft settings.

What you get is soft realtime spotlight shadows in the viewport and GE that closely matching the internal renderer's.

It's been tested with both nvidia and ati cards on the BA forums.
%%%

%%%This patch adds support for pcf filtering on realtime shadows using the spotlights Samples and Soft settings. What you get is soft realtime spotlight shadows in the viewport and GE that closely matching the internal renderer's. It's been tested with both nvidia and ati cards on the BA forums. %%%

Changed status to: 'Open'

Changed status to: 'Open'

%%%can you attach a .blend file showing the effect?%%%

%%%can you attach a .blend file showing the effect?%%%

%%%a few comments:

  1. shouldn't you set result as 0 or whatever before start adding values to it? (inp != 0.0 and shadowkernel > 1.0)
  2. Why not replace all this hardcoded (if shadowkernel == ....) tests by:
    "
    if(shadowkernel == 1.0)
    result = shadow2DProj(shadowmap, co).x;
    else {
    for(i=0;i<shadowkernel; i++) {
for(j=0;j<shadowkernel;j++)
 result += shadow2DProj(shadowmap, co+vec4(((j * sstep)-soffs)/co.w, (y-soffs)/co.w, 0.0, 0.0)).x;

y+= sstep;
}
}
"
void test_shadowbuf would be like: http://www.pasteall.org/5570
3) nice patch !%%%

%%%a few comments: 1) shouldn't you set result as 0 or whatever before start adding values to it? (inp != 0.0 and shadowkernel > 1.0) 2) Why not replace all this hardcoded (if shadowkernel == ....) tests by: " if(shadowkernel == 1.0) result = shadow2DProj(shadowmap, co).x; else { for(i=0;i<shadowkernel; i++) { ``` for(j=0;j<shadowkernel;j++) result += shadow2DProj(shadowmap, co+vec4(((j * sstep)-soffs)/co.w, (y-soffs)/co.w, 0.0, 0.0)).x; ``` y+= sstep; } } " void test_shadowbuf would be like: http://www.pasteall.org/5570 3) nice patch !%%%

%%%Erwin:
softshadow.blend attached. From what I got from Sebastian's patch it's only a matter of changing Samples and Softness in the GUI.

Sebastian:
It looks like the lighting already supports softness. Do you know if the light method is the same method as the shadow?%%%

%%%Erwin: softshadow.blend attached. From what I got from Sebastian's patch it's only a matter of changing Samples and Softness in the GUI. Sebastian: It looks like the lighting already supports softness. Do you know if the light method is the same method as the shadow?%%%

%%%Nice patch. However the settings don't really match the internal renderer that well in my tests? In particular the softness is much stronger in GLSL. In the test softshadow.blend file, compare the GLSL result with a shift+P preview render.

One problem if this gets committed is how to handle backwards compatibility. Right now games using shadows will have samples set quite high and so they will get a big performance degradation. If this gets committed as part of 2.5 with other compatibility changes it may not be a problem though.%%%

%%%Nice patch. However the settings don't really match the internal renderer that well in my tests? In particular the softness is much stronger in GLSL. In the test softshadow.blend file, compare the GLSL result with a shift+P preview render. One problem if this gets committed is how to handle backwards compatibility. Right now games using shadows will have samples set quite high and so they will get a big performance degradation. If this gets committed as part of 2.5 with other compatibility changes it may not be a problem though.%%%

%%%Brecht ("how to handle backwards compatibility"):
How about an option in the GLSL menu: enable soft shadows?
Then in 2.5 we leave it enabled by default (or even remove from the menu).%%%

%%%Brecht ("how to handle backwards compatibility"): How about an option in the GLSL menu: enable soft shadows? Then in 2.5 we leave it enabled by default (or even remove from the menu).%%%

%%%Dalai Felinto, the reason is compatibility. Older PS 2.0/ATI cards do not support dynamic sized and nested loops.

Brecht Van Lommel, I've attached an improved patch(pcfshadows2.txt & the test.blend I used) that attempts to more closely match the internal renderer, and a small optimization as well.

As for compatibility, no one raised this on the BA forums so I'm not sure it's a big deal? If so I agree with a GLSL menu option.%%%

%%%Dalai Felinto, the reason is compatibility. Older PS 2.0/ATI cards do not support dynamic sized and nested loops. Brecht Van Lommel, I've attached an improved patch(pcfshadows2.txt & the test.blend I used) that attempts to more closely match the internal renderer, and a small optimization as well. As for compatibility, no one raised this on the BA forums so I'm not sure it's a big deal? If so I agree with a GLSL menu option.%%%

%%%Personally Id not worry about compatibility, games should not use a huge number of spot lamps, when people run their games in a new version of blender they often need to update a few settings.

Adding more stuff for people to have to tweak should be avoided however I think in this case its acceptable.

  • 2c%%%
%%%Personally Id not worry about compatibility, games should not use a huge number of spot lamps, when people run their games in a new version of blender they often need to update a few settings. Adding more stuff for people to have to tweak should be avoided however I think in this case its acceptable. - 2c%%%

%%%This patch seemed to have gotten lost in the 2.49 pre-release madness. I've modified the patch to work with the latest trunk (23357) in hopes of getting discussion going again.

http://www.pasteall.org/8037/diff%%%

%%%This patch seemed to have gotten lost in the 2.49 pre-release madness. I've modified the patch to work with the latest trunk (23357) in hopes of getting discussion going again. http://www.pasteall.org/8037/diff%%%

%%%What needs to be done here to get this in trunk?%%%

%%%What needs to be done here to get this in trunk?%%%

%%%hi all
i tried to update this patch but no use :(
@mitchell
can you update this patch, it is very old and some need it, i wonder why it didn't got to trunk to now ????%%%

%%%hi all i tried to update this patch but no use :( @mitchell can you update this patch, it is very old and some need it, i wonder why it didn't got to trunk to now ????%%%

%%%Updated the patch to svn 41542.
attached by the file named <pcf_shadows_r41542.patch>
one question though, when it will go to trunk ?%%%

%%%Updated the patch to svn 41542. attached by the file named <pcf_shadows_r41542.patch> one question though, when it will go to trunk ?%%%

%%%hi
can someone update please,as i can patch no after harmony's merge
and when it will go to trunk ?%%%

%%%hi can someone update please,as i can patch no after harmony's merge and when it will go to trunk ?%%%
Brecht Van Lommel removed their assignment 2013-11-13 14:05:06 +01:00

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Mitchell Stokes self-assigned this 2014-05-28 06:27:11 +02:00

We're using VSMs for soft shadows, so I don't think we really need PCF anymore.

We're using VSMs for soft shadows, so I don't think we really need PCF anymore.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
8 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#18750
No description provided.