Code Monkey home page Code Monkey logo

Comments (19)

huwb avatar huwb commented on May 31, 2024 1

So Denis Lemos (the Azure[Sky] developer) has very kindly demonstrated what is required to add the Azure scattering to Crest. See his reply here:

https://forum.unity.com/threads/azure-sky-dynamic-skybox.322773/page-17#post-3630571

He includes a version of the ocean shader with the lines added with comments referring to Azure. I don't anticipate that the steps will change much, if it does I'll update this thread accordingly.

Thanks for reporting and I'm happy to see it working - looks really nice!

from crest.

angry-penguin avatar angry-penguin commented on May 31, 2024 1

I saw that. Huge thumbs up to you both for being so responsive!

from crest.

huwb avatar huwb commented on May 31, 2024

Ha ok, one of the teams is using azure skies so it should work in theory..

Also i recently fixed a bug that broke the deferred fog - are you on latest from master, or the previous release? Here is the where it was reported and fixed: #53 (comment)

Otherwise please provide pictures if you can and any other relevant info. Are you using forward or deferred? Is azure providing the scattering and fog, or is it standard unity fog? I've never worked with the azure stuff so I'm a bit of a noob.

Thanks!

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

I'm in linear/deferred using azure for fog. Post processing V2 but have fog disabled there and disabled in lighting.

First pic is how it renders. Second is where I placed a giant blue cube in the scene with the top face just above water level, to show how how the fog and scattering looks without the water.

From observation Azures's technique fogs existing geometry along with it's own skybox. So it uses it's skybox material to provide the volume when no geometry exists.

image
image

from crest.

huwb avatar huwb commented on May 31, 2024

Thanks! Oh so Azure has its own version of fog? My guess would be that this does not work with transparents. If you made a huge transparent sphere above the island i guess it would not fog?

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

Transparent appears to work fine. There is a large sphere between the camera and terrain in this pic. I can barely make out an outline of it on my pc, appears to have no effect on fog. Water is a different water here not Crest.

image

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

FYI I have seen comments by the azure author re other waters about correctly rendering to the depth buffer. Also his shader notes seem to indicate it's using the same core technique as the unity deferred fog.

from crest.

huwb avatar huwb commented on May 31, 2024

Sorry for this menial sounding request but could you make the sphere 80% opaque and put it back to where the island is? I'm a bit confounded as to how this works. Is it a standard unity material set to Transparent?

In the last couple of weeks i made the changes necessary to get crest working with unity's deferred fog. Even in deferred rendering, the water is rendered in a forward manner, but is fed fog data to do the fogging itself. Generally transparents cannot just be fogged once in a deferred way - imagine you could make 5 overlapping spheres which can't be fogged in a deferred way, because it will all be collapsed down to one layer at the point that shading occurs. This is a core, fundamental issue with deferred rendering which is at the heart of this issue.

I don't think forcing depth on is going to help in deferred situations - i tried this and unity is like "ok you want to write to depth, i'm going to sneakily copy out the deferred depth BEFORE you start writing!!". this is again due to the problem of deferred not working if there are multiple transparent layers. It could help in forward rendering situations though - but it does not come without its own side effects!

I did a quick bit of googling and found this post so far: https://forum.unity.com/threads/azure-sky-dynamic-skybox.322773/page-4#post-2532897 . It suggests adding some code to the shader to do the fogging in a forward way which was my only idea so far - add some code to the ocean shader which does the Azure fogging.

However this may be shortcomings in my understanding, I appreciate the help talking this through. There are also some others we can consult who are using Azure but i'm not sure if they use the fogging component of it.

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

Ya this is standard shader set to transparent.

image

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

Found this maybe it's useful.
https://forum.unity.com/threads/writing-to-depth-buffer-with-custom-shader.217814/#post-2724985

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

Tried adding a shadow pass no effect, well other then messing up the ocean rendering. But seems to not help fog at all.

from crest.

huwb avatar huwb commented on May 31, 2024

Is that working? The sphere didn't look like it's picking up the scattering, I was expecting it to be somewhat blue... but it might just be the image. Pushing it further back and/or making the sphere a more different colour would be useful to see? Sorry to keep drilling on this one point, but if its actually working wtih out of the box unity alpha stuff then that would change a lot..

from crest.

holdingjason avatar holdingjason commented on May 31, 2024

Hi just saw this. Yep we are seeing the same thing. Just noticed it. Normal fog, deferred fog etc using postprocessing v2 works fine but not azures fog stuff. Ocean ignores it. Honestly not sure we are going to use there fog anyway so need to test with some others like HX Volumetric and Weather Maker.

Played around with it briefly but so far not really sure what is happening.

from crest.

holdingjason avatar holdingjason commented on May 31, 2024

Ok confirmed this is not just an issue with AzureSky. @huwb you can repro this simply by using the standard assets GlobalFog.

I am including it here. Just two scripts and a shader. Also a nice image to show the issue. Just add this to your camera and your good to go.

Standard Assets.zip

image

from crest.

holdingjason avatar holdingjason commented on May 31, 2024

Normal fog from lighting works fine btw. Need to check the volumetric fog system and see how they go like I mentioned.

from crest.

gamemachine avatar gamemachine commented on May 31, 2024

Tested this with the Volumetric fog and mist asset. It results in the entire water being clipped. It has a compute depth toggle which if toggled on removes the clipping and then exhibits the same behavior as Azure.

Tested Enviro same behavior as Azure.

from crest.

angry-penguin avatar angry-penguin commented on May 31, 2024

I'm also testing out Crest and using Azure Sky. I haven't got to testing sky integration in particular yet, but I think it's worth pointing out with regard to the sphere screenshot earlier that Azure does not support fog scattering with transparent objects with the standard shaders. Until recently it didn't support fog with transparent objects at all.

For transparency support you need to use one of the provided transparent shaders with fog support, or follow provided instructions to add fog support yourself. I haven't tried either of those myself, we're still on an older version of Azure and using built-in Unity fog to get around that. The author mentions this here.

I suspect that this will be a similar case across the board with any fog system for reasons huwb mentioned earlier.

from crest.

huwb avatar huwb commented on May 31, 2024

Thanks guys, angry penguin you have unconfused me!

Ok guys please follow the instructions provided in the Azure sky package to add fogging to the ocean shader. The ocean shader has scene depth in the code which should be enough I would guess, but if you need anything else I'm happy to help if I can. (But I don't know if it's ok to post Azure sky code of it's not public, obviously, so perhaps take care here).

If someone does it and can give feedback on whether it was easy/hard and what was involved, please do share! And feel free to share screenshots :).

Is that reasonable? I'll leave this issue open for now in case I'm missing something.

UPDATE: Posted a note on the Azure sky thread to verify: https://forum.unity.com/threads/azure-sky-dynamic-skybox.322773/page-17#post-3628414

from crest.

huwb avatar huwb commented on May 31, 2024

I've now added a comment calling out specifically where the azure code should be added for applying the fog. If it is just added at the end of the shader, it will mess with the underwater effect. See the above referenced commit.

from crest.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.