Jump to content

Light like Sun


hesam_a110
 Share

Recommended Posts

For the sun on the Earth, you could use a directional light with a specular map on the Earth (the land and the ocean are quite different materials) - of course this ignores 'subsurface scattering' and atmospheric effects, which I guess could be approximated with a Fresnel term - https://github.com/BabylonJS/Babylon.js/wiki/How-to-use-FresnelParameters%3F

For the moon's shadow I'd be tempted not to worry about shadows, and instead use a point sprite of blurry black transitioning to full transparency, if I even bothered to show it at all.

A custom shader really wouldn't hurt though - in addition to making the above more realistic you could have an additional texture for domestic lighting - not sure how you'd encode the lights to get them to turn off/dim as the night goes on though (perhaps you don't need to and the light from cities comes more from the lights which stay on from buildings and street lighting)

Link to comment
Share on other sites

hi

thanks chg and deltakosh

I was see them i need that by some different case sun is middle actually it is   a light i don't know how can i simulate that by lights I will bee happy if you provide sample to me 

imagine sun it is middle and earth turn around sun and moon turn around earth 

thanks

Link to comment
Share on other sites

I see you have altered your original post to make it clearer that you just care about the shadow of the moon, and not so much about a nice looking rendering of the Earth. My answer was mostly concerned with some ideas on [faking] the latter. Perhaps I misunderstood your issue.

 

thanks chg and deltakosh

I was see them i need that by some different case sun is middle actually it is a light i don't know how can i simulate that by lights I will bee happy if you provide sample to me...

I'm sorry, but I won't write your code for you; besides a directional light is a simple concept, that you should try to understand the principle of, not just how to use it in code. I'm sure that taking the time to understand the maths of realtime lighting and shadowing techniques will be much simpler than the astrophysics involved in your simulation ;)

With regard to the shadow of the moon, the reason I recommended trying a point sprite was to try to capture the look of the penumbra & antumbra/umbra of the shadow, which I assume can be precalculated as the Moon is always a fixed distance from the Earth, and the sun is pretty far away (meaning the shadow can possibly just be scaled slightly and still be close enough), and as the Moon is kinda spherical so it's shadow looks the same no matter which angle it is seen from.

EDIT: TLDR version: you can probably use a point sprite presuming you are happy for the shadow to be a dark fuzzy spot that is painted over the Earth, to better represent the spherical nature of the Earth ( which I honestly forgot about D: ) a warped quad might be better. I am going of pictures like http://www.mikekemble.com/astro/image/moon%20shadow%20on%20earth.jpg and assume that the shadow just has to look right and be in the right place.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...