crest icon indicating copy to clipboard operation
crest copied to clipboard

Triggering Particle Effects on Wave Peaks.

Open holdingjason opened this issue 7 years ago • 32 comments

I there a good way to apply a particle effect at the peak of a certain wave spectrum? My guess it would be similar to when foam is created,. Do not need all of them just an occasional effect.

(posted this in a new thread since I just realized where I have posted before was closed).

holdingjason avatar Oct 09 '18 14:10 holdingjason

Ah sorry i did actually get an email and i was planning to dig it up but i got buried under other stuff.

As a matter of fact there is something like this! The approach was suggested by Tessendorf - it samples random points near the viewer and detects choppy waves and emits particles, which is basically what you suggested.

Dig out the branch fx_test https://github.com/huwb/crest-oceanrender/tree/fx_test . It's from March and is utterly unrecognizable as Crest which is amusing in itself, but if you run the scene and wait a few moments you should start to see PFX being triggered in choppy parts of water (they look really bad and can take a while to spot).

I think this could be pretty awesome with some FX love, I found it really hard to author fx because im not a vfx artist at all. I'd be very interested if you wanted to mess around with this and see if you can get good results out of it..

huwb avatar Oct 09 '18 21:10 huwb

Sounds great will dig that up. Yep we have an artist on staff that can put some things together and make something look nice that you can use. Right now we are ultra focused on ship movement, fx etc to make a fun visual experience for our players so things like this, spray coming up from the boat as it impacts the water etc.

holdingjason avatar Oct 09 '18 22:10 holdingjason

Ok! Even just seeing your result/sharing techniques for making it look good would be helpful, but let's see how we go.

This stuff will probably need a bit of love to bring it forward - it needs to be adjusted to use the collision providers which didn't exist back then. It should not be a huge amount of work. I can assist or make a pr for it sometime soon, maybe on weekend.

huwb avatar Oct 10 '18 07:10 huwb

We are in no big rush so whenever you get to it is fine.

holdingjason avatar Oct 10 '18 16:10 holdingjason

@huwb Hola. Just starting to finally get back and look at this.

Ya that old branch is a mess and does not even really run anymore. Will see if I can make any sense of how it computed the chop. I guess we could also track some spots and check the normals overtime and determine when we have a sharp normal change at a certain height. Thinking of how you mapped the crosshairs in debug for boats etc. Not perfect but probably would work as a hack.

BTW had an idea for generating foam for moving objects like ships etc. Just emitting growing/fading Alpha Textures using the RenderAlphaOnSurface script. Worked really well not sure if you can key me into a downside, guessing performance if we get to many of those running (so far did not seem that bad). Just puked a bunch out behind the ship and various spots. Will pass along a video of that. This probably would also work around specific things like dock posts, floating objects etc. I know we also have that RenderOceanDepth and OceanDepthCache but those do something a bit different since they also effect the wave patterns etc which I would not want. But open to your thoughts if this is a stupid way to do this or someway is better. Thanks

holdingjason avatar Nov 15 '18 23:11 holdingjason

@huwb Here is a quick video showing off all the stuff we have been working on that you have helped us with. Thanks a ton looks great (well I need to create a really nice video at somepoint but wanted to at least pass something along).

https://drive.google.com/open?id=1qwbS9ouV9s8uFFyT8saHWwlordNZGBdz

holdingjason avatar Nov 15 '18 23:11 holdingjason

The scene has a nice look and feel to it! Well done! @holdingjason How did you manage to get that smooth blending between the sky/ocean. We've been testing a photo realistic setting and everything is top notch until we change the light model and having to tweak the ocean material in order to have a match. I went into inspecting the shaders and how they would talk with Enviro ( the sky module ), but I'm still researching... Is that just a regular skybox + fog ?

Here is quick look at early tests ( having tweaked every single parameter in Crest :) https://drive.google.com/open?id=1Gzxb34hU5DtnZvRyeYCuCW7OxTZ6I1Te

P.S. @huwb You're doing outstanding work which helps me stay motivated! Trying to build a scene doesn't feel like work.

Tsetso avatar Nov 16 '18 08:11 Tsetso

(thanks all really awesome to see results, thanks for posting! i've been flying under the radar a bit the last couple of weeks as things have been quite busy at work, and i've been working on an enormous refactor #117, but im almost at the end of that now..).

huwb avatar Nov 16 '18 09:11 huwb

@huwb What you are doing is already a huge help to a lot of people I guess. The least I can do is share my results and hopefully share improvements / fixes that emerge.

Tsetso avatar Nov 16 '18 09:11 Tsetso

@Tsetso That is some great work really impressive. The blending is done by using a height fog (or just use the standard fog in the lighting section). In our case we are using azure sky with there height fog which creates a great blend.

https://assetstore.unity.com/packages/tools/particles-effects/azure-sky-dynamic-skybox-36050

We have a thread here that talks about blending/transparency with sky systems/boxes etc.

https://github.com/huwb/crest-oceanrender/issues/62

You will also want to read through this one. Especially if you need to adjust the surface over time based on lighting ie night vs morning vs afternoon etc. We are using the procedural gradient instead of a skybox for crest so we can adjust everything based on the current light. Different issue then what your asking but figured you would run into it.

https://github.com/huwb/crest-oceanrender/issues/46

The azure sky guy showed us (crest) how to modify the shader to work with azure. The link is in that issues thread 62. I believe those threads might also mention enviro but not sure.

holdingjason avatar Nov 16 '18 15:11 holdingjason

@huwb Looking forward to #117 that sounds like a fantastic improvement. Let me know down the road when you get more time and we can talk more about adding in these effects. I will attempt to get something hacked together for now.

holdingjason avatar Nov 16 '18 15:11 holdingjason

Finally got around to this. See the branch https://github.com/huwb/crest-oceanrender/tree/feature/wave-peak-fx .

If you run the main.unity scene in the example content on this branch, you should see the ugliest particles you've ever witnessed being emitted from the wave peaks (more so in deeper water).

The magic happens in the Ocean FX component that is attached to the Ocean gameobject. Let me know if you have any questions or requests.

huwb avatar Nov 24 '18 22:11 huwb

Great. You have been busy. Will take a look at it in Monday thanks for getting me something to play with

holdingjason avatar Nov 24 '18 22:11 holdingjason

Just going through old issues. Let me know if you did have a chance to look at this yet?

huwb avatar Dec 21 '18 20:12 huwb

Still playing with it. Got pulled off on some other parts of the project but will continue to work on this and let you know.

holdingjason avatar Dec 21 '18 20:12 holdingjason

@huwb Going to dig into effects again. Has there been any changes or thoughts since we last discussed this? Grabbing feature wave-peak-fx.

holdingjason avatar Jan 26 '19 23:01 holdingjason

Nope nothing that im aware of. Excited to see what comes out of this, keep us posted! 👍

huwb avatar Jan 27 '19 15:01 huwb

Hi. I got lost in crest some weeks before and added two spray cloud flipbook particle to the peak fx. I stared 30min on it. I then started to find opensource tools to generate them and found the flipbook generator from the unity vfx graph toolbox. https://github.com/Unity-Technologies/VFXToolbox. Looks puffy nice.

A second test for the boat spray similar to this https://youtu.be/bojdpqi2l_o which i love i did with https://github.com/keijiro/KvantSpray 3 systems give a nice speedy look. Two for motorspray and one sprayed when boat bumps the surface. But to get collision when hitting water surface is over my knowledge and it s an older whenever fast system. Looks great with TAA.

Then I started to look into the new vfx graph preview who has an backport to Unity BuiltIn.(Particles are not lit on the backport) It s perfect for generating a very dense cloud of little bubbles for nearly no cost. Even great for underwater before wave breaks with nice turbulences.

see 0:15 to 0:19 https://youtu.be/uUHRJ26gMGI

Think this is the way to go. Low cost. Cinematic addition. Problem. BuiltIn backport is not developed further.. Focus is on the HDRP VFX Graph development. But i could add these for an test too when you think it makes sense. Somehow i have the feeling that you could use these even for water surface interaction by generating an proxy realtime sdf. But only with turbulences there are endless possibilities.

Would https://github.com/huwb/crest-oceanrender/tree/fx_test still be the right branch for these and makes it sense.

I am pretty new with github. It s on the same level like my english writing.

There is a little visual problem you should think about. Every material in example scene is adjusted to look good without PostProcessing Stack and Tonemapping.

It s really hard to add something because you must touch every material. Water. Sky... Sure you have reasons to do soo. But enabling neutral Colorgrade and ACES Tonemapping and fitting all materials to the linear workflow would make it much easier to extend the visual quality. Slightly Bloom is working then great too and finishs the highlights on water surface. For underwater i did a second post volume.

TAA gives great boost for all particle work.

What would be the best way for this?

sasa42 avatar Jan 30 '19 23:01 sasa42

In addition. A little problem is that water writes not to depth and i could not get DOF working. I did a long internet read but there seems to be no way.

sasa42 avatar Jan 31 '19 00:01 sasa42

Thanks sasa42 for the info, really interesting. Feel free to post any results you have :).

Yes fx_test is still the right branch, i brought it up to date relatively recently and it should not have conflicts but i can update it again if it helps.

If you do bubbles it may be possible to have the inherit the velocity of the water volume but I'd need to about how exactly and im not hugely familiar with how to work with gpu particle systems.

Yeah i agree from a hdr point of view the example scene is a mess :( and i encountered the same thing when i tried to pull in a hdr sky. I'll consider fixing it but most likely it will stay like this, and the LWRP/HDRP versions of crest will use the new sky stuff and hopefully use proper values that are hdr friendly.

See #123 regarding rendering depth / using DoF. Its not solved and i dont think ill get onto it for built-in. i hope LWRP/HDRP will open the door to doing this properly.

huwb avatar Feb 01 '19 09:02 huwb

I just caught up with this conversation and found out the 'fx_test' branch seems to be a little outdated :( Are you still considering finishing this feature?

Also, a little off-topic - why do paid non-flat ocean assets even exist? I bought two of them and they are comparable with CREST at best. If not worse. Weird question, I know. It just baffles me. Maybe I'm just missing something.

StepanMynarik avatar Aug 07 '19 12:08 StepanMynarik

@VizzzU posted these references

https://www.youtube.com/watch?v=8ok9Ra6WTFU https://www.youtube.com/watch?v=OQ3D0Q5BlOs

The status is that this is unlikely to progress in this implementation, but we have plans for a much cooler system that will be based on VFX graph. I don't know yet if it will work in the built-in render pipeline, it may be URP/HDRP only.

We could still use help with particle assets like a splash texture, and/or an example particle effect to help us. They'd need to be free for us to use/distribute.

huwb avatar Apr 05 '20 11:04 huwb

Hi there ! oceanFx & TrackOceanSurface are still conflict .(i have Tried the Fx_Branch ). Now the problem comes from the SampleDisplacement function which is missing . Guess i have to use the query function ? Or i am maybe a bit slow ...

VizzzU avatar Apr 05 '20 21:04 VizzzU

Sorry to bother you but i am still struggle with the particle fx . I have managed to update the track ocean surface ( using sampleheightdemo.cs ) but i cant fix the oceaneffect. cs . Guess i have to query displacement & vel but i am not smart as you are guys ... Btw , i m going to buy the HDRP version to still harasse you with bugs ! Cheers .

VizzzU avatar Apr 13 '20 10:04 VizzzU

I tried to update the branch but failed. I will see if I can find time later, but this is now deprecated and we don't plan to pursue this direction as it is not efficient. We are exploring a VFX Graph implementation and hope to have news for you soon..

huwb avatar Apr 19 '20 12:04 huwb

Ok i got it working. If you get latest of the branch fx_test and open main.unity, it will spawn instances of the SprayPFX prefab at wave crests. You can modify the prefab to hopefully make it look good :). Would be really interested to see what you do with it!

huwb avatar Apr 19 '20 14:04 huwb

you are awesome !

VizzzU avatar Apr 20 '20 05:04 VizzzU

Ok i got it working. If you get latest of the branch fx_test and open main.unity, it will spawn instances of the SprayPFX prefab at wave crests. You can modify the prefab to hopefully make it look good :). Would be really interested to see what you do with it!

Lovely! Is there any way to make this work on the HDRP version from the Asset Store?

StepanMynarik avatar Apr 20 '20 06:04 StepanMynarik

(@StevenKek It is a "soon-coming" feature but via shader graph .)

I knew the query was the way to go but i didnt managed to get it work ... : ( I ve Just tried the new fx scripts but i get an error after a time : "Too many guids registered with CollProviderCompute. Increase s_maxGuids." Increasing this max value gives much better results but the error still pops after short time . I have tried to tweak the particle options without results so i guess some collisions rregistration are not cleaned but i am not smart enough .

VizzzU avatar Apr 20 '20 06:04 VizzzU

Interesting! That is an issue and we need to fix it. I dont have an immediate fix for it right now. Hopefully setting max guids to a large value is enough until we have a better fix.

huwb avatar Apr 20 '20 14:04 huwb