wave-harmonic / crest

A class-leading water system implemented in Unity
MIT License
3.45k stars 476 forks source link

Ocean Depth Cache Layer #42

Closed holdingjason closed 6 years ago

holdingjason commented 6 years ago

I believe this used to be a mask setting so we could pick multiple layers to apply this to.

It appears we now would create multiple ocean cache object for each layer we want to apply this to. Seems like the old way made a bit more sense but maybe there is a good reason to do it this way. Just curious.

Thanks

huwb commented 6 years ago

Hey there, i didn't intentionally change anything here but its probably some of the recent changes related to how layers are managed thats making something wonky. I should be able to look into this in the next day or two.

huwb commented 6 years ago

Hi there, sorry it took me a while to get onto this.

It has not changed, but circumstances around it have. The OceanDepthCache takes as input a layer name (set to Terrain in the main scene in the example content), and should render anything in that layer into a cache. I changed the way layers are handled, because previously it was storing the index of the Terrain layer, which when imported into another project could be any random layer :(, so I reference this layer by name - on the aforementioned script, and on the object that im rendering into the cache - Island0 in the main scene. There is a ApplyLayers script on Island0 - again i'm circumventing the unity setting because it will index to something random when importing into another project :/. In your own project you could assign the layer in the inspector instead of using the ApplyLayers script, if you dont need to worry about importing this content to a new project.

I've just realised that there was a race condition between the two scripts a i mention above - the cache could be populated before the Terrain layer is applied. I've just pushed a fix for this in the referenced commit.

Does this make sense, and answer your question?

holdingjason commented 6 years ago

Don't worry about it. Your super responsive and we all really appreciate the hard work.

Hmm I see how that works and that does make sense. However the bigger issue would be allowing multiple layers (names) on the OceanDepthCache so I can include multiple layers to act as "terrain". So I might have rocks in a obstacle layer, terrain meshes in a terrain layer, boat in a objects layer and I want to apply the depth cache to all of them. Granted I could have made them all terrain but that would cause issues elsewhere. I can also create multiple similar depth cache objects for each layer but not sure if that is adding additional overhead etc.

Does that make sense?

Also not sure if you got a chance to check out the last few questions on https://github.com/huwb/crest-oceanrender/issues/33

Just was curious what your thoughts where my two videos as far as if what I am seeing makes sense and is normal or if I should maybe be doing something a bit different. But again no rush and thanks for everything.

huwb commented 6 years ago

Ah ok, yeah multiple layers should hopefully be a fairly straightforward extension - i'll report back when i've made an attempt.

Yeah its on my list to reply to #33. I'm on hols at the moment so expect a little more latency than usual but i'll see if i can jump in there in the next day or two.

Btw i spent a couple of hours this evening looking at having chop and wave speed tweakable per octave. Think i've got the groundwork done now so hopefully that stuff can come online in the not too distant future!

holdingjason commented 6 years ago

Not a huge deal. Please do not spend time away from your holiday on our account. I am just shooting you stuff as I find them so no rush just want to make sure you know about it. I need to dig into some of this stuff myself so I can solve it without bugging you about every little thing and pass along the changes. So much to do so few hours. Our team completely loves the water in the game btw always raving about it and they have pretty much seen every water implemention I could find and come up with before that.

huwb commented 6 years ago

Should be sorted on latest - let me know/reopen if not!