Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
This question was closed Mar 02, 2016 at 07:54 PM by Le-Pampelmuse for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by multinfs · Mar 01, 2016 at 07:00 PM · lightingproceduralworld

[Solved] GI like lighting in procedural world

So I have this procedural world that is generated at runtime and I'm not pleased with how the lighting handles the resulting mesh..

[Solved] 1. First issue is that I would like to have Global Illumination in the world but since it's a procedural world the possibility for that is out the window. So I'm stuck with pitch dark shadows in places where no light shines, is there any solution to this?? (Note that raising the ambient light just makes the now black area a bit brighter, leaving out the details of the mesh)

Img1 EDIT: I fixed this by changing my shader a bit.

[Solved] 2. Second issue is the directional light used as a sun doesn't know where not to shine it's light, it doesn't get blocked by terrain above a cave but instead lights up the floor inside the cave. Why does it do this and is there any fix for it?? (Note2 I'm using my own shader for the terrain in forward rendering mode but I doubt that is the problem) I have tested with disabling backface culling in the shader but that doesn't help at all..

img2

temp2.png (212.1 kB)
temp1.png (491.4 kB)
Comment
Add comment · Show 12
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Graphics_Dev · Mar 01, 2016 at 07:12 PM 0
Share

A directional light has a shadow strength property you can use to make shadows not pitch black.

avatar image multinfs Graphics_Dev · Mar 01, 2016 at 07:16 PM 0
Share

That does sadly not help here since those black areas aren't lit by any lightsource at all so there are no shadows either that can be causing it.

avatar image Graphics_Dev multinfs · Mar 01, 2016 at 07:19 PM 0
Share

Oh, I see. You could add another light going in the opposite direction to brighten up these areas, but that probably wouldn't be much better than ambient lighting...

Show more comments
avatar image Cherno · Mar 01, 2016 at 07:30 PM 0
Share

Are you using real-time shadows?

Copy your "sun" light source, give it an intensity of about 0.1 or 0.2, and don't let it cast shadows. This is your "back-up" sun which basically works as a form of ambient lighting that can slightly enlighten all the places that would be cast in shadow otherwise. The main advantage is that it will also pick up normal maps. You can go one step further and make another back up sun light, but let it shine in the inverse direction (diagonally upwards). With this setup, you will have all surfaces covered.

avatar image Graphics_Dev Cherno · Mar 01, 2016 at 07:40 PM 0
Share

Like @multinfs said, black spots are not in shadow but just backfacing tris.

avatar image multinfs Cherno · Mar 01, 2016 at 07:41 PM 0
Share

As noted on earlier comment, I have tested this and this is how it looks like: img1 The bright area in the ceiling is the inverse light (intensity is exaggregated here to better show dark areas) and while most of the darkness is brighter it still leaves some faces that aren't lit at all. To make those lit too I'd need tons of directional lights in all directions which I'm not liking since I will Implement a day-night cycle later.

As I'm writing this I remembered that I can change the terrain shader code to potentially fix the dark areas.

temp3.png (318.6 kB)
avatar image Polymo · Mar 02, 2016 at 01:16 AM 1
Share

You should be able to change the light-angle-falloff in a custom lighting function like the diffuse wrap example in the manual http://docs.unity3d.com/$$anonymous$$anual/SL-SurfaceShaderLightingExamples.html to get more details out of the dark areas. And for the sunlight inside the cave, enabling shadows is the way to go (what you described is the normal behaviour of virtual lights).

avatar image Nick Brooks · Mar 02, 2016 at 07:33 PM 0
Share

@multinfs Wow, how did you do the vertex welding for the terrain? Looks amazing.

avatar image Le-Pampelmuse Nick Brooks · Mar 02, 2016 at 07:52 PM 2
Share

If you have a solution, add an answer. If not, add a comment please. I've converted your answer to a proper comment.

avatar image Graphics_Dev Le-Pampelmuse · Mar 02, 2016 at 07:54 PM 0
Share

Thank you! I've only seen a few billion answers that were actually comments today. I can't wait to get a few hundred more karma ;)

avatar image Le-Pampelmuse · Mar 02, 2016 at 07:53 PM 2
Share

Don't "tag" questions with "Solved" or similar. Close them if they are answered so it it obvious. IF they are not closed, and someone comments, or edits some content on it, it will pop up on the feed of the front page, which is useless.

1 Reply

  • Sort: 
avatar image
0
Best Answer

Answer by multinfs · Mar 02, 2016 at 11:45 AM

Soo, to make the solution clear to my problems I simply had to modify my shader a bit to 1. Handle ambient lighting correctly ( The ambient wasn't adding the color of the fragment but the ambient color only.) 2. Support shadows ( Added built in AutoLight.cginc functions to shader for shadows )

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

42 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to get objects to spawn in according to rules 1 Answer

I want to create a billowing fog/cloud/dry-ice effect, possibly constrained 0 Answers

How do I hide an emissive object but keep its affect on the global illumination? 3 Answers

Shader help: Is it possible to make the sprite's under a circle/mask appear brighter/more vibrant? 0 Answers

Writing a shader that emulates graphic novel coloring 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges