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

gl_rasterizer/lighting: implement shadow attenuation #3618

Merged
merged 2 commits into from Apr 10, 2018

Conversation

@wwylele
Copy link
Member

commented Apr 1, 2018

The hw renderer counterpart of the first commit of #3516. The other two are still unimplemented.


I am still not sure how to implement the rest of shadow mapping stuff, specifically the third part Shadow map rendering in the output merger stage. To support soft shadow, PICA has a pretty complicated output merger stage algorithm, which is hard to emulate using the standard depth/stencil test & blending in OpenGL. So far the only feasible way I know is to use Image load store. Another option is to not support soft shadow (no game using this known to me), and to only implement hard shadow, which makes it a trivial depth test.


This change is Reviewable

@cluezbot

This comment has been minimized.

Copy link

commented Apr 1, 2018

Hi, this is neobot, using neobrain's account. I'm keeping an archive of versions of this PR:

2018-04-01T15:30:08Z: 3848492...wwylele:0f3acbaf4d7d01ed0decdd0d8800027fb247b5f9

@@ -202,6 +211,11 @@ static std::string SampleTexture(const PicaShaderConfig& config, unsigned textur
return "texture(tex[0], texcoord[0])";
case TexturingRegs::TextureConfig::Projection2D:
return "textureProj(tex[0], vec3(texcoord[0], texcoord0_w))";
case TexturingRegs::TextureConfig::Shadow2D:
case TexturingRegs::TextureConfig::ShadowCube:
LOG_CRITICAL(HW_GPU, "Unhandled shadow texture");

This comment has been minimized.

Copy link
@daniellimws

daniellimws Apr 2, 2018

Contributor

NGLOG?

@cluezbot

This comment has been minimized.

Copy link

commented Apr 4, 2018

Hi, this is neobot, using neobrain's account. I'm keeping an archive of versions of this PR:

2018-04-04T14:21:04Z: c084c97...wwylele:f707c80db28c594d9386febd7eb8a080ad92049a

@wwylele wwylele force-pushed the wwylele:shadow-new-1 branch from 0f3acba to f707c80 Apr 4, 2018

wwylele added 2 commits Apr 1, 2018
pica/lighting: split FresnelSelector into bitfields
The FresnelSelector was already working like a bitfield, so just make it actual bitfield to reduce redundant code. Also, it is already confirmed that this field also affects shadow on alpha. Given that the only two source that can affect alpha components are both controlled by this field, this field should be renamed to a general alpha switch
@cluezbot

This comment has been minimized.

Copy link

commented Apr 10, 2018

Hi, this is neobot, using neobrain's account. I'm keeping an archive of versions of this PR:

2018-04-10T17:43:44Z: bdf7b46...wwylele:4256641da483a6a03fded2dffb974243690955a0

@wwylele wwylele force-pushed the wwylele:shadow-new-1 branch from f707c80 to 4256641 Apr 10, 2018

@wwylele

This comment has been minimized.

Copy link
Member Author

commented Apr 10, 2018

Rebased. Please review

@jroweboy

This comment has been minimized.

Copy link
Member

commented Apr 10, 2018

@wwylele to answer the question, I am fine ignoring soft shadows in the hardware renderer since you said games don't use it. You already added it in the software renderer in #3516 so we do have a documentation for how it works :)

You are welcome to merge this (and potentially rebase 3499 if it conflicts)

@wwylele wwylele merged commit 575099f into citra-emu:master Apr 10, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@wwylele wwylele deleted the wwylele:shadow-new-1 branch Oct 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.