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

Shadow problems with THREE.DirectionalLight and THREE.MeshBasicMaterial #7617

Closed
Mugen87 opened this issue Nov 17, 2015 · 16 comments
Closed
Labels

Comments

@Mugen87
Copy link
Collaborator

Mugen87 commented Nov 17, 2015

Hi everybody!

i want to upgrade three.js to R73 in my current project. Unfortunately, i'm getting strange shadows casted by a THREE.DirectionalLight on a THREE.MeshBasicMaterial. Check out the following screenshots:

three.js R72 👍
shadow_r72

three.js R73 👎
shadow_r73

As you can see, the shadow in R73 is totally black.

OS: OS X Yosemite 10.10.5
GPU: AMD Radeon R9 M295X 4096 MB
Browser: Chrome 46.0.2490.86 (64-bit)

@GGAlanSmithee
Copy link
Contributor

Shadow darkness was removed? #7321

Sorry guys, but shadowDarkness is gone, use AmbientLight instead. shadowDarkness at 0.5 is actually the one making the shadow acne more obvious than it should.

@GGAlanSmithee
Copy link
Contributor

I do think shadows are still being worked on though #6420 not sure if this landed in r73?

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 17, 2015

I have an THREE.AmbientLight in this scene but it actually has no effect on the shadow...

@Mardonis
Copy link

Try and use the development version r74 and see what you get. Lots of things have been fixed.

@mrdoob
Copy link
Owner

mrdoob commented Nov 17, 2015

I changed the shadowDarkness default to 1 (to start discouraging its use). You can still do light.shadowDarkness = 0.5 but I would suggest adding new THREE.AmbientLight( 0x808080 ) to your scene instead.

@WestLangley
Copy link
Collaborator

I would suggest adding new THREE.AmbientLight( 0x808080 ) to your scene instead.

@Mugen87 is using MeshBasicMaterial, which does not respond to light sources. Switching to another material is required in that case.

@mrdoob
Copy link
Owner

mrdoob commented Nov 17, 2015

Ah! True.

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 18, 2015

Thanks for your feedback!

@mrdoob and @WestLangley : Is using light.shadow.darkness = 0.5 in combination with MeshBasicMaterial still a valid way for tweaking shadows? Or is this approach deprecated?

Besides, maybe it's a good idea to include the new shadow handling to the migration guide. I can image, that other users run in the same issue...

@mrdoob
Copy link
Owner

mrdoob commented Nov 18, 2015

@mrdoob and @WestLangley : Is using light.shadow.darkness = 0.5 in combination with MeshBasicMaterial still a valid way for tweaking shadows? Or is this approach deprecated?

For the time being it's ok. However MeshBasicMaterial is supposed to be unlit. So it shouldn't support shadows. However, http://threejs.org/examples/#webgl_geometry_spline_editor is a good use case where one can control the color of the surface and add shadow. This example is why MeshBasicMaterial still supports shadows and shadow.darkness is still available. Once I figure out how to do it in a different way the current approach may get deprecated.

For your use case, you may want to use case... Any reason you're using MeshBasicMaterial and not MeshLambertMaterial or MeshPhongMaterial?

Besides, maybe it's a good idea to include the new shadow handling to the migration guide. I can image, that other users run in the same issue...

Done.

@makc
Copy link
Contributor

makc commented Nov 18, 2015

@mrdoob

This example

just fyi this example looks like this over here:

screen shot 2015-11-18 at 23 02 39

@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 19, 2015

For your use case, you may want to use case... Any reason you're using MeshBasicMaterial and not MeshLambertMaterial or MeshPhongMaterial?

I want a consistent color over the entire surface of a 3D object. MeshBasicMaterial is perfect for this, because i don't need any lights to get this effect. If there are alternate ways to do same, well, i always have an open mind for other solutions 😉

@mrdoob Thanks again for your answers!

@Mugen87 Mugen87 closed this as completed Nov 19, 2015
@Mugen87
Copy link
Collaborator Author

Mugen87 commented Nov 19, 2015

By the way, i close this issue because my original problem is solved!

@mrdoob
Copy link
Owner

mrdoob commented Nov 19, 2015

just fyi this example looks like this over here

Looks correct to me...?

@makc
Copy link
Contributor

makc commented Nov 19, 2015

Looks correct to me...?

so the shadow is supposed to look dashed?

@mrdoob
Copy link
Owner

mrdoob commented Nov 19, 2015

Yeah, I guess these are the expected artefacts when combining THREE.PCFShadowMap and lines...

weiserhei added a commit to weiserhei/threejs-experiments that referenced this issue Mar 18, 2016
meshbasicmaterial cant cast shadow anymore, use the new shadowMaterial instead.
mrdoob/three.js#7617 (comment)
@douglascross
Copy link

Was trying to get softer shadows and then discovered a trick of using emissive color on the object receiving the shadow. This might help someone.

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

No branches or pull requests

7 participants