Comments (6)
Also, it's important to note that only the objects that cast shadow, not the ones that receives shadow, should be given as input to generate_shadow_map.
That's a really helpful point, thanks! Would be great to know when this changes, but no pressure on my side.
from three-d.
Only the cube should cast shadow, so if you only use the cube when generating the shadow map, it should look better. The problem is that the ground is really big and the 1024x1024 pixel shadow map will be stretched over a large area.
from three-d.
Ah that makes sense. So if I had custom terrain that I'd generated in some third party software and wanted it to cast shadows on itself, I would simply need to choose a larger shadow map?
from three-d.
Using the shadow map technique over large areas is generally not a good idea, you'll have to move the directional light with the camera to only cast shadow close to the camera view where the shadows are visible or maybe make several directional lights.
I came to think about that in the case you present, the artifacts are more visible by the direction of the light being close to parallel to the ground. Also, the shadow has a soft edge which is not looking good in this case.
from three-d.
Ah ok, in that case does a directional light have a some local bounds that it generates shadow maps within? Is there something like a ScissorBox
that applies here? I know these are probably quite simple questions, and appreciate your time.
from three-d.
Ah ok, in that case does a directional light have a some local bounds that it generates shadow maps within? Is there something like a ScissorBox that applies here?
Yes, it will position the shadow map camera such that the objects that cast shadow are all within its viewport. That means, if you have a large object or two objects that are far away from each other, the shadow map will cover a large area and the shadows therefore look pixelated.
you'll have to move the directional light with the camera to only cast shadow close to the camera view
This was not a well thought out reply, of course you can't move a directional light. Instead, you could generate the shadow map with only the objects that are just in front of the camera. Also, it's important to note that only the objects that cast shadow, not the ones that receives shadow, should be given as input to generate_shadow_map.
maybe make several directional lights.
I have considered supporting multiple shadow maps on a single directional light, but unfortunately there's more important tasks at the moment.
I know these are probably quite simple questions, and appreciate your time.
I think they're totally valid questions, I'll convert this into a discussion afterwards so others may find answers to the same questions 👍 I should maybe also update the documentation of generate_shadow_map to make it a bit more clear.
from three-d.
Related Issues (20)
- "You forgot to call destroy() on the egui glow painter. Resources will leak!" HOT 3
- Centering the camera on a model HOT 4
- `Camera` is trying to do too much - not compatible with custom camera implementations HOT 5
- Headless on windows HOT 2
- Weird stretching when rendering finite terrain HOT 2
- Converting between ui space and screen space? HOT 2
- How to control occlusion for 2D shapes? HOT 7
- InstancedMesh but with different material for each instance HOT 5
- Run three-d from egui app HOT 1
- Camera position_at_pixel() is missing window_scale_factor on HiDPI displays HOT 2
- Any plans to support custom buffer element types for interleaved data? HOT 1
- ColorMaterial Transparency breaks when renderered at negative Y position? HOT 2
- Upgrading V0.16.1 => V0.17 breaks loading a 1x1 pixel white texture HOT 3
- Some kind of blend/alpha issue with some models (inside-out models) HOT 1
- Trying to use PhysicalMaterial without lights crashes the program HOT 1
- Warning when running on the browser / crash in debug mode HOT 5
- InstancedMesh Individual Animations HOT 2
- `egui` links don't work? HOT 1
- Cascaded shadow map support HOT 1
- Pick geometry instance from coordinate HOT 10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from three-d.