fenomas / noa

Experimental voxel game engine.
MIT License
616 stars 91 forks source link

Added shadowOffset to shadow component for adjusting the offset via options #28

Closed Nesh108 closed 7 years ago

Nesh108 commented 7 years ago

I noticed that an offset for the shadow was added to the shadows (0.05), since I needed to have control over that value, I thought of making it into an engine option.

fenomas commented 7 years ago

Hey, thanks for the PR!

Two things:

  1. There are a lot of changes in this PR besides the shadow offset - I think it's because you're working in the develop branch but committing against master. When submitting a PR, can you make sure you're at the current commit of the develop branch, and then commit your changes against that?

  2. About the y-offset, is the intent of your change to fix z-fighting issues? If so, I was meaning to do something about that - I think the right fix will be to have the shadow component use different offset values depending on how far the entity is from the camera. (Because if every shadow has the same y-offset, then close-up ones look like they're floating, but far-away ones still get z-fighting.)

If the intent of your change is something unrelated to that then disregard the above and let me know.

Nesh108 commented 7 years ago

Oh, I see. Yeah, probably that's the case. I will look into fixing that.

For the second point, I am fixing the shadowOffset because it seemed that it was not touching the ground properly. Setting the offset to 0 or 0.01, would make it flicker between the blocks. But at around 0.015, the shadow should stay perfectly on the terrain and not weirdly floating in the air.

Nesh108 commented 7 years ago

@andyhall I am going to close this PR and open the updated one (from a different branch).