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

Shadowing still gives shadow acne #7359

Closed
throni3git opened this issue Oct 16, 2015 · 28 comments
Closed

Shadowing still gives shadow acne #7359

throni3git opened this issue Oct 16, 2015 · 28 comments

Comments

@throni3git
Copy link
Contributor

Hello und a big ThankYouAll for three.js :)

I'm trying to achieve beautiful shadowed render graphics und i have followed the recent changes in shadowmapping ( #7321 and #6420 ). Anyway, using the current master build, i still get shininess through shadow and shadow acne artifacts. This seems to be an issue with multiple lights (of type Spot / Directional)

I've forked a jsfiddle from mrdoob with a spotlight and a directional light. Have a look at http://jsfiddle.net/wgwoqncy/4/

Spotlights shining through shadows:

issue_shininess_throug_shadow

Shadow Acne with two SpotLights:

issue_shadow_acne_spotlights

Shadow Acne with a SpotLight and a DirectionalLight:

issue_shadow_acne_spot_and_dir

Greetings,
Thomas

@mrdoob
Copy link
Owner

mrdoob commented Oct 16, 2015

Yes. We still haven't solved this...

@mrdoob
Copy link
Owner

mrdoob commented Oct 16, 2015

Using a single light (DirectionalLight, SpotLight or PointLight) with shadowDarkness set to 1 and an ambient light (AmbientLight or HemisphereLight) gives the best results at the moment.

@throni3git
Copy link
Contributor Author

Yes, this is my solution so far. Good to know, you're on it :) Thanks

@WestLangley
Copy link
Collaborator

@throni3git The shadow acne is caused by self-shadowing. That is what shadowBias helps correct. Adjust the spotlight bias. The trade-off is peter-panning.

@makc
Copy link
Contributor

makc commented Oct 20, 2015

@bhouston
Copy link
Contributor

There must be more advanced ways to solve our shadow acne problem. Most modern game development systems do not show the degree of shadow acne ThreeJS currently has. There must be an automated solution. It is on my list of things to get to.

@mrdoob
Copy link
Owner

mrdoob commented Oct 23, 2015

@bhouston I think it's just a matter of moving away from the shadowMask concept. As you suggested, storing whether is shadow or not in the light per fragment sounds like a better approach.

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2015

Fixed! http://jsfiddle.net/wgwoqncy/5/

@mrdoob mrdoob closed this as completed Nov 6, 2015
@bhouston
Copy link
Contributor

bhouston commented Nov 6, 2015

Dude!

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2015

Things look a lot better now.

screen shot 2015-11-06 at 08 32 49

webgl_shadowmap_pointlight is now extra sexy 😊

screen shot 2015-11-06 at 09 10 30

@bhouston
Copy link
Contributor

bhouston commented Nov 6, 2015

It fails on Linux Intel drivers:

THREE.WebGLShader: gl.getShaderInfoLog() fragment 0:158(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:159(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:160(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:161(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:162(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:163(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:164(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:165(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later
0:166(63): error: sampler arrays indexed with non-constant expressions is forbidden in GLSL 1.30 and later

Interesting, I'm pretty sure @tschw figured out how to address that in this comment:

#7426 (comment)

@makc
Copy link
Contributor

makc commented Nov 6, 2015

@mrdoob

Fixed! http://jsfiddle.net/wgwoqncy/5/

are you sure? it looks like this over here:

screen shot 2015-11-06 at 17 43 50

@bhouston
Copy link
Contributor

bhouston commented Nov 6, 2015

I think it may be possible to not cast shadows on faces facing away from the light that is shadowing them. Or at least extend the bias in those cases. That should help with this situation.

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2015

@makc what your os/hardware?

@bhouston
Copy link
Contributor

bhouston commented Nov 6, 2015

I have shadow acne on the back side as well with Windows 10, Chrome latest and GeForce 660:

image

@makc
Copy link
Contributor

makc commented Nov 6, 2015

@mrdoob
screen shot 2015-11-06 at 18 19 50

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2015

@makc no errors in the console?

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2015

@bhouston well, yes, I guess saying that I fixed the shadow acne was not correct. however, it's WAY less noticeable 😇

@makc
Copy link
Contributor

makc commented Nov 6, 2015

@mrdoob total silence after THREE.WebGLRenderer 74dev. maybe some undefined behavior?

@MasterJames
Copy link
Contributor

On mobile Android chrome it's just flat and dark no lights?

@mrdoob
Copy link
Owner

mrdoob commented Nov 6, 2015

On mobile Android chrome it's just flat and dark no lights?

Any example? Or only the ones with shadows?

@MasterJames
Copy link
Contributor

screenshot_2015-11-07-01-58-18
This is from your link http://jsfiddle.net/wgwoqncy/5/
I'm pondering it has something to do with the rawgit's delivery or what I don't know. I'm not clear on how to get debug or log from it (Android 5.0.0 Galaxy Note3 ~ Chrome 46.0.2490.76) without using something like "weinre", etc.

There is a weird long purple shadow that can't be helping here, it seems to come from nowhere. Oh wait that's expected? Ambient only there?
I've tried commenting out the various lights (via scene.add and each attribute) but that made no difference (even with a reboot). I goes black without Ambient so the other lights are a noshow somehow?

@bhouston
Copy link
Contributor

bhouston commented Nov 7, 2015

To debug Chrome on an Android device you have to follow these instructions:

https://developer.chrome.com/devtools/docs/remote-debugging

@MasterJames
Copy link
Contributor

Thanks for that. It needed redoing more then a few timed before it showed up under chrome://inspect

@MasterJames
Copy link
Contributor

And here is the console errors.

Uncaught TypeError: Cannot read property 'getOption' of undefined
THREE.WebGLRenderer 74dev
THREE.WebGLRenderer: OES_texture_float_linear extension not supported.
Uncaught TypeError: Cannot read property 'setOption' of undefined

@mrdoob
Copy link
Owner

mrdoob commented Nov 11, 2015

@makc @MasterJames can you guys try again with the latest in dev?

@MasterJames
Copy link
Contributor

Yes that's got it!
New confidence in "one for all" phylosophy.

@mrdoob
Copy link
Owner

mrdoob commented Nov 11, 2015

Good to know. My Nexus 5 still crashes. I think I'll have to move a few things around...

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

No branches or pull requests

6 participants