Skip to content

Shadow Mapping in igl::opengl::glfw::Viewer#2155

Merged
alecjacobson merged 4 commits intomainfrom
alecjacobson/shadow-mapping
Feb 3, 2023
Merged

Shadow Mapping in igl::opengl::glfw::Viewer#2155
alecjacobson merged 4 commits intomainfrom
alecjacobson/shadow-mapping

Conversation

@alecjacobson
Copy link
Copy Markdown
Contributor

Shadows!

Before:
Screen Shot 2023-01-25 at 6 18 39 PM
After:
Screen Shot 2023-01-25 at 6 18 34 PM

Pretty straightforward shadow mapping implementation for directional lights. I'm guessing this could be optimized, but I'd like to have something in there for visualization of things where close contact is important, like, contact simulations.

I left a few notes about the funny coordinate system for our current positional lights. I didn't change that yet, but I think if we upgrade this to handle point lights then it'd worth reconsidering the coordinate system lights live in.

For now lights are turned off by default and can be turned on with 'S','s'. That'll also switch to directional lights.

I kinda like the floor in those renderings, but for now it's just ad hoc for the new tutorial entry. (actual tutorial entry to follow in that repo). Try it out in 113_Shadows

@alecjacobson
Copy link
Copy Markdown
Contributor Author

Before:
Screen Shot 2023-01-27 at 12 50 29 AM
After
Screen Shot 2023-01-27 at 12 50 33 AM

In general, raw matcaps won't look very good with hard shadows. If the matcap has an well-approximate-able light-direction and has a near constant "dark-side", then it can look alright. For now, I don't have C++ code to approximate light directions or filter matcaps, but if someone has those, then this PR's shader will now handle them alright. The example above uses light_direction = -0.2003 0.3390 0.9192 and

matcap-1-shadow

Another example.

libigl-shadow-matcaps.mov

Using 0.3016 0.2469 0.9209 and ok-45-shadow

@alecjacobson alecjacobson merged commit 50ac379 into main Feb 3, 2023
@alecjacobson alecjacobson deleted the alecjacobson/shadow-mapping branch February 3, 2023 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant