wave-harmonic / crest

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

Edge feathering for flow for a fix direction #851

Open nitroman123 opened 3 years ago

nitroman123 commented 3 years ago

Please describe the desired feature/behavior.

This will help simulating dynamic waves when the ship is is at low speeds. This will help a lot for waterjets in the near future I want to add and the dynamic waves to be simulated like real when the ship has low speeds . This will look very realistic

Supporting images/mockups, or example reference videos are very helpful to communicate ideas.

https://user-images.githubusercontent.com/62849221/121402064-22a2ba80-c962-11eb-8d7c-81cec68306e6.mp4

daleeidd commented 3 years ago

Thanks.

One workaround until we look into adding this is making use of the texture input is an option. Here is a radial gradient which won't have a seam.

Radial

nitroman123 commented 3 years ago

the result is amazing !!! really

nitroman123 commented 3 years ago

But in the start is fine but when is start gaining speed its like rotating around it self

Start Screenshot_372

At speed and turned

Screenshot_373

Screenshot_374

nitroman123 commented 3 years ago

@daleeidd @huwb After some experiment with programming some custom properties I found that the flow float2 attribute they x and y values must have a different value for every single rotation in order to simulate the correct value (pushing the waves backwards or regardless the rotation this could help a lot with my case and will give a unique touch for the game)

Screenshot_381

huwb commented 3 years ago

Thanks for this, looks interesting. we can help but i think i need to see the issue in motion to understand your latest posts. or if you can share the effect with us we can work on it with you.

nitroman123 commented 3 years ago

@huwb yes here i made a 3 min video to see , hope this helps , i tweak the values runtime to see the correction it makes , its a very nice effect and for me and i think everyone love to have it cause it simulates the real sea behavior especially for ships. The combination of fixed direction and the 2 texture could be awesome .

https://youtu.be/VGu_Crjg9V8

nitroman123 commented 3 years ago

Any updates for this i really love to have it to make some nice videos... this feature will give a very nice feeling on the water pushing ?

daleeidd commented 3 years ago

@nitroman123 Unfortunately, no. All time has gone towards the next release as it was a big update.

nitroman123 commented 3 years ago

@huwb @daleeidd Ive made some experiments and i found the values for the degrees based on the rotation , i was trying to make a script to control the X and Z values. I made the X and Z float variables and i found the right values for the X and Z .

Basically the values goes from to for each rotation

degrees 0 x = 0 , z = 1 degrees 90 x = 1 , z = 0 degrees 180 x = 0 , z = -1 degrees 270 x = -1 , z = 0 degrees 360 x = 0 , z = 1

tell me if i cant make something the help the procedure cause i really want it !!!

Thanks in advance

nitroman123 commented 3 years ago

So after 1 day of trying i made a script that controls the values for the shader to be rotated with the right numbers

script :

https://pastebin.com/JpfB4FPa

assign the material and the modified shader

https://pastebin.com/2kNcg5us

download

daleeidd commented 3 years ago

Nice work. Have a video of it in action? Very interested in seeing it.

nitroman123 commented 3 years ago

it doesnt work correctly for all rotations and imagine that if you want to make a flow input look at the side of the ship (Bow thruster) the rotations change dramatically i will make a sort video and send it over in a bit

nitroman123 commented 3 years ago

here is the video https://youtu.be/vru4gtWMCTc it is almost getting the right values but i would very costly to make for a lot of points and more points mean more script etc... I really want this feature it will give a very big impact on the visuals and a unique feature for a ship sim game

daleeidd commented 3 years ago

The video is private and I cannot view it.

nitroman123 commented 3 years ago

sry for this now you should be able to see it https://youtu.be/vru4gtWMCTc

huwb commented 3 years ago

Still can't seem to access it. Has it worked for you dale?

daleeidd commented 3 years ago

Still can't seem to access it. Has it worked for you dale?

It does but I had to copy and paste the link manually. I've updated both links and they will work when clicked now.

daleeidd commented 3 years ago

sry for this now you should be able to see it https://youtu.be/vru4gtWMCTc

Thanks. Looks great. Interesting approach to get that effect.

nitroman123 commented 3 years ago

Is very nice effect to show that forces push the water backwards etc. This is a must effect in my ship sim game. Its getting close to release next year and having this effect will be a miracle. If a had a fixed direction with the smoothness of the add flow map is all i need.

Sry for the link don't know what was wrong with that.

daleeidd commented 3 years ago

Test branch here: test/feature/flow-input-improvements. Spoke with @nitroman123 on Discord with feedback. The rotation works with a quad as I just took the code from the spline. I'll need to work out how to make it user friendly before it can be merged. Will do a PR soon for the UV feathering as that works well.

daleeidd commented 2 years ago

Feathering has been added for 4.15. Rotation has been moved to its own branch: https://github.com/wave-harmonic/crest/tree/feature/flow-rotation