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

Implement celestial lighting #7

Open
aggregate1166877 opened this issue May 30, 2021 · 3 comments
Open

Implement celestial lighting #7

aggregate1166877 opened this issue May 30, 2021 · 3 comments
Assignees
Labels
needs investigation pre-alpha grind Pre-alpha MVP task: tasks used as rough indication of what needs to be done to get out of pre-alpha

Comments

@aggregate1166877
Copy link
Collaborator

aggregate1166877 commented May 30, 2021

[Parent issue: #74]

Details:
We need to make planets and the space ship interiors respect local star light.

Task:

  • Implement a mechanism to differentiate between stars, light emitting planets, and regular planets.
  • Make stars light emitters.
  • Give celestial bodies the materials needed to facilitate lighting.
  • Ensure the space ship itself has realistic shadows.

Note that this task refers to lighting from the local star and does not include stars that are light years away.

Investigation to be followed in comments below.

@aggregate1166877 aggregate1166877 added needs investigation pre-alpha grind Pre-alpha MVP task: tasks used as rough indication of what needs to be done to get out of pre-alpha labels May 30, 2021
@aggregate1166877 aggregate1166877 self-assigned this May 30, 2021
@aggregate1166877 aggregate1166877 changed the title Make planets respect local star light. Make planets and the space ship interior respect local star light. May 30, 2021
@aggregate1166877 aggregate1166877 changed the title Make planets and the space ship interior respect local star light. Make planets and the space ship interiors respect local star light. May 30, 2021
@aggregate1166877
Copy link
Collaborator Author

aggregate1166877 commented May 30, 2021

Investigation 1:
Naively create a light emanating from the Sun hitting the Earth.

Result:
We may need a few hacks to make this work nicely. Initial code written using traditional methods tank the framerate to 1FPS, and shadows don't work well over long distances. This likely because our scene is literally millions of kilometers wide (to scale, in meters) simply going from Sun to Earth, never mind beyond.

Putting this task on hold for now because it would be easier to implement at a later stage (such as when we have debugging menus/etc readily available).

@aggregate1166877 aggregate1166877 removed their assignment May 30, 2021
@aggregate1166877 aggregate1166877 changed the title Make planets and the space ship interiors respect local star light. Implement celestial lighting Aug 18, 2021
@aggregate1166877 aggregate1166877 self-assigned this Aug 18, 2021
@aggregate1166877
Copy link
Collaborator Author

aggregate1166877 commented Aug 18, 2021

Investigation 2:
Check if it's possible to isolate lighting between scene children. For example, in a parent -> child1, parent -> child2 setup, does a hemi light from child1 affect child2? If not, we could possibly set up hemi light for sun -> planets, a directional light for sun -> ship, and do some hacks such as fading ship light gradually the more a planet intersects of path to the sun.

Result:
Turns out if you add a light anywhere in a scene, it affects anything with castShadow or receiveShadow. The engine does not support layering within scenes. However - you can create two completely different scenes, and pass both through the same renderer. One is superimposed over the other, both exist physically in the same space, but visually looks identical. And light created in scene1 does not affect scene2.

Great success. Although not quite - it seems this breaks post-processing (likely related to mrdoob/three.js#1017). Right now I think lighting is more important because without it the game would be complete potato. Can't have that. Hopefully we find a work-around for the post-processing issues.

@aggregate1166877
Copy link
Collaborator Author

aggregate1166877 commented Aug 21, 2021

Initial lighting is working very nicely. Light values are currently hard-coded, though.

To make things realistic, we need to be able to do things like calculating distance to nearest star, adjust star color by class, etc. This is currently not possible because all planetary bodies are currently generated using hard-coded JSON.

Putting this on hold until #55 is resolved.

aggregate1166877 pushed a commit that referenced this issue Dec 19, 2021
aggregate1166877 added a commit that referenced this issue Dec 19, 2021
aggregate1166877 pushed a commit that referenced this issue Jan 4, 2022
…tarlight and make it compatible with EffectsContext.
aggregate1166877 pushed a commit that referenced this issue Mar 22, 2022
aggregate1166877 pushed a commit that referenced this issue Mar 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation pre-alpha grind Pre-alpha MVP task: tasks used as rough indication of what needs to be done to get out of pre-alpha
Projects
None yet
Development

No branches or pull requests

1 participant