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

Osg shadows and lighting #976

Closed
wants to merge 5 commits into from
Closed

Conversation

costashatz
Copy link
Contributor

@costashatz costashatz commented Feb 6, 2018

This PR enables shadows in the OpenSceneGraph (OSG) wrapper of DART and solves #971. In more detail:

  • There was an issue in the OSG lighting setup:
    • The turning on/off of the lights was reversed. I fixed it.
    • The lights were always directional; directional lights do not have any attenuation and this results in unrealistic scenes. I selected point lights with distance attenuation in order to produce nicer scenes.
  • I created a ShadowedWorldNode that overrides WorldNode and provides the shadow capability (using the ShadowMap technique). I did this for 2 reasons: (1) someone may not want to use shadows (and they can be computationally intensive) and (2) for some reason in OSG when no shadow can be casted, nothing is shown; I am still investigating this issue and ways of by-passing it. Edit: I misinterpreted this; see below (everything is fine).

Here's a demo:
hexa_shadow

Let me know what you think...

@costashatz costashatz mentioned this pull request Feb 6, 2018
@codecov
Copy link

codecov bot commented Feb 7, 2018

Codecov Report

Merging #976 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #976   +/-   ##
=======================================
  Coverage   56.63%   56.63%           
=======================================
  Files         310      310           
  Lines       23924    23924           
=======================================
  Hits        13550    13550           
  Misses      10374    10374

@costashatz
Copy link
Contributor Author

I was mistaken about the issue of OpenSceneGraph; the real issue was that the home position was being resetted and as such my objects were too far away to be seen. I fixed the issue. The main issue that I see of this implementation is that the ShadowMap technique finds the first light in the scene to create the shadows and does not use all the lights. I am not an expert in OpenSceneGraph and it's mostly okay for me, so I am not planning on trying to fix this.

Let me know what you think..

Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @costashatz, this generally looks good to me!

I have one suggestion. Could we make ShadowWorldNode shadowing method agnostic? OSG supports multiple methods for shadowing. They say ShadowMap is the most frequently used option, but it would be worth to allow us to set the shadow methods of ShadowWorldNode. I believe it shouldn't be too much work, but if so we could make that change in a separate PR.

@jslee02
Copy link
Member

jslee02 commented Feb 8, 2018

Also, could you retarget this PR to release-6.4? To do so, you could:

  • creating a new branch from release-6.4 and
  • cherry-picking the commits in this PR to the new branch and
  • creating a new PR from the branch targeting to release-6.4

Thanks! 😄

@costashatz costashatz closed this Feb 9, 2018
@costashatz costashatz mentioned this pull request Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants