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

Lighting on surface on different versions on Crest #448

Closed
StickeydM opened this issue Mar 18, 2020 · 15 comments
Closed

Lighting on surface on different versions on Crest #448

StickeydM opened this issue Mar 18, 2020 · 15 comments
Labels

Comments

@StickeydM
Copy link

So I'm trying to implement something like this:
image The lighting here baked not with a skybox but with ambient color.

So far what I achieved with crest is this.
image

Seems that light doesn't affect the water surface. There is also no glow around the ship, but that's probably because I turned off volumetrics for testing Crest.

I will be doing it via URP/HDRP(Haven't fully decided yet). URP is preferable because of performance. It seems that Dale did something about this in built-in version #383 , #382 .

What do I need to implement for this? Does it require changing code? Also, do I need something else to implement what I need that I didn't consider? For example, how do I implement this reflection? 048a0d52dd8e974024e30540a0b202a51

@huwb
Copy link
Contributor

huwb commented Mar 19, 2020

Lighting has two components.

Reflection:

Light reflected off the surface, so bright highlights from the lights. I dont see any direct reflection of the lights on the surface in your screenshot. But i will document here for completeness.

BIRP: Dale had a swing at this and put details in the issues you linked. Not merged into master, might be in the future but no timeline currently.

URP: The default ocean shader is hardcoded to reflect just the sunlight. However there is a second ocean shader that we'll hopefully switch to one day, which should give more flexible reflection - it should reflect lights like any shiny material would. It is currently called Ocean/Framework.

HDRP: The hdrp ocean shader should be as flexible as any shiny transparent material in hdrp, so it should reflect different light types.

Volume emission:

The above screenshot shows a green glow around the ship. This is light that entered the volume, scattered around, and then left towards the viewer.

All variants of crest model the volume lighting with a simple formula, and they are hardcoded to consider only the main directional light. They could be extended to handle multiple lights, and I can add this to our list. I'd be interested to hear from others who want this, I've had only one other request for this in the past.

In the short term, treat this as a constraint of current versions of crest.

Of course the full source code is provided with crest, and the functions are fairly well named and straightforward, so if you have graphics programming support you can extend the OceanEmission to with some kind of model of how light would scatter. I assume you have done that in the above screenshots to achieve this effect.

@huwb
Copy link
Contributor

huwb commented Mar 19, 2020

So far what I achieved with crest is this

Btw this colour you're seeing will be the diffuse colour on the material, multiplied by the ambient light. You could darken the diffuse colour on the material to make it darker.

@StickeydM
Copy link
Author

StickeydM commented Mar 19, 2020

Yes, you're totally right, that was not light reflected of the surface. I was wrong. Volume emission you are talking about is seemingly called Subsurface Scattering at Ultimate Water System(just tested).

https://gyazo.com/b6bbc6cd34793e67bbfc10a96ddc00a3

Also, the light that reflected from the light just around the ship that I circled by red color is called planar reflection. It seems that Crest has planar reflections, would it work the same with point lights just like on the screenshot?
048a0d52dd8e974024e30540a0b202a51

@StickeydM
Copy link
Author

Also, what did you mean by saying that in URP reflection works only with another shader? Why isn't that anothe shader default? Does it miss any important feature? Would I require to change something in shaders to make reflection work

@huwb
Copy link
Contributor

huwb commented Mar 19, 2020

would it work the same with point lights just like on the screenshot?

Yes I believe so. Needs to be tested to say 100%.

Crest/Framework is a shader that is generated from a shadergraph. It is less flexible in terms of custom features, but being a shadergraph it is more compatible with URP so can be more flexibly lit. I can't do a detailed comparison right now as I don't have all the info at hand and don't have time to collect it right now, but I'll let you try both and compare as it's easy to do.

@huwb
Copy link
Contributor

huwb commented Mar 19, 2020

I missed the video the first time but I watched it now. It looks really good. Is it automatically picking up your point lights from the ship when it does the volume lighting?

I'm not sure how this is done and we don't have this feature at the moment. I'll discuss with my colleagues about potentially adding this on the future.

@daleeidd
Copy link
Collaborator

A possible solution for lighting (only faking though) is the Render Alpha On Surface component. They would just need to disable the displacement (floating with the wave movement). It would require manual work to get it to look right, but for anyone who really needs a quick solution.

@StickeydM
Copy link
Author

Huw, yeah, it is automatically picking up my points lights. Hopefully with the help of my graphics programmer we can achieve same effect

@daleeidd do you mean lighting reflecting on the water surface?

@daleeidd
Copy link
Collaborator

daleeidd commented Mar 20, 2020

The component is the Crest logo floating in the main example scene. You can basically render almost anything you want on the ocean surface with it. It isn't affected by lighting so it could be used to render colour onto the surface as if it were a light.

@StickeydM
Copy link
Author

@daleeidd Hmmm, so theoretically I can try to even do this volume scattering, green "glow" around the ship with it?

@StickeydM
Copy link
Author

Our graphics programmer seems to be of opinion that this kind of dynamic subsurface scattering(green glow) would be much better to implement with deferred renderer mode when it comes out with 2020.2

@daleeidd
Copy link
Collaborator

From the camera perspective you've shown I believe so. A green radial gradient texture could work well enough. An issue I can think of is that it probably won't work well with foam. But yeah, proper lighting support is always the ideal.

@StickeydM
Copy link
Author

@daleeidd Isn't it possible to apply foam on top of any applied textures in the shader? I think I did it when I added stylized texture support.

@huwb huwb added the Question label Mar 25, 2020
@daleeidd
Copy link
Collaborator

I'm not sure. I haven't worked with both systems.

@huwb huwb closed this as completed Aug 23, 2020
@daleeidd
Copy link
Collaborator

Adding additional light support as a feature request is handled by #357

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants