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

ShapeFFT and ShapeGerstner produce lines in foam simulation data #878

Open
daleeidd opened this issue Jul 20, 2021 · 20 comments
Open

ShapeFFT and ShapeGerstner produce lines in foam simulation data #878

daleeidd opened this issue Jul 20, 2021 · 20 comments
Labels
Milestone

Comments

@daleeidd
Copy link
Collaborator

daleeidd commented Jul 20, 2021

Describe the bug
Reported by @klauskobald on Discord. When using the ShapeFFT, foam simulation data appears to have grid lines.

Screenshots / video
Evidence

Versions
Latest

To Reproduce

  1. In the main scene, swap ShapeGerstnerBatched for ShapeFFT.
  2. Reduce foam fade rate to something like 0.2 to make it more prominent.

Platform

  • Editor and Standalone
  • MacOS and Windows

Additional context
I tried disabling the variance to see if it was that but had no effect from what I could see.

@daleeidd daleeidd added the Bug label Jul 20, 2021
@huwb
Copy link
Contributor

huwb commented Jul 24, 2021

Thanks for posting. I don't immediately know what works cause this but will post if I figure it out

@gamemachine
Copy link

This is not specific to fft, it happens with shape gerstner also.

@daleeidd daleeidd changed the title FFTs produce lines in foam simulation data FFTs and ShapeGerstner produce lines in foam simulation data Aug 16, 2021
@daleeidd daleeidd changed the title FFTs and ShapeGerstner produce lines in foam simulation data ShapeFFT and ShapeGerstner produce lines in foam simulation data Aug 17, 2021
@daleeidd
Copy link
Collaborator Author

daleeidd commented Aug 17, 2021

It also affects ShapeGerstnerBatched, but it is not noticeable with a full spectrum.

@huwb I think ShapeGerstner and ShapeFFT are more susceptible because they are tiled? Rendering the Jacobian directly into the foam data shows the issue still. The foam data from the ShapeGerstnerBatched appears more stable. An option could be to add noise or blur the foam data.

@huwb
Copy link
Contributor

huwb commented Aug 17, 2021

Would it be possible to see it happening for SGB? With a simplified spectrum would be useful.

I messed around here but did not notice an issue using SGB.

Yeah the tiling could be exacerbating it for SG/SFFT. But its not clear to me why. If the waves were not tiling properly that would do it. Perhaps some very large wavelengths are not tiling or something. Although I jut spent some time messing around with SFFT. There are obvious repeating patterns in the foam data, but im not getting "gridlines" like the above screenshot. I tried the repro steps above. Would itbe worth pushing a temp branch that we can use as a repro, so i can make sure i get the issue here?

@daleeidd
Copy link
Collaborator Author

Sure. Test branch here: https://github.com/wave-harmonic/crest/tree/test/foam-grid-issue

Test scenes are under Test folder. There is one scene per shape type.

@huwb
Copy link
Contributor

huwb commented Aug 30, 2021

Thanks. Weirdly i suddenly seem to repro it easily by just dropping in an FFT component.

It looks indeed like the wave patches are not tiling. I see lines every 0.5m which is exactly the size of the first wave cascade. If i turn off ~0.5m waves in the spectrum sliders, they go away.

I don't know why the waves are not tiling properly, the FFT was not messed with too much. so it is supposed to be strictly repeating patches (FFT is not able to do non-repeating). Might be worth comparing the spectrum with other similar code, or hacking the spectrum to only have one non-zero value to produce a single wave and try to show that it clearly does not tile.

Will post again if i make progress.

@daleeidd
Copy link
Collaborator Author

daleeidd commented Nov 4, 2021

Fixed with 4.14.

@daleeidd daleeidd closed this as completed Nov 4, 2021
@klauskobald
Copy link

Has this really been fixed?
I still get lines after updating from 4.13 - 4.15.
Do I need to replace components?

image

@daleeidd
Copy link
Collaborator Author

I still get lines after updating from 4.13 - 4.15. Do I need to replace components?

It should have been fixed in 4.14. Have you seen any improvement? It may still be possible to incur these with low settings perhaps.

@klauskobald
Copy link

Watch the image above. The foam damping was almost zero - just to illustrate. But one can also see it with other settings. The "idea" of stripes is everywhere. It has not changed at all compared to 4.13. What component(s) is producing that? What files are involved, so I could have a look at the diff.

@daleeidd
Copy link
Collaborator Author

#903 was the fix for ShapeFFT and #968 for ShapeGerstner. They increase the quality of the waves which reduces the repeating grid pattern. It didn't eliminate it completely. Maybe certain quality settings will make the pattern more prominent, but you should've seen an improvement.

@klauskobald
Copy link

I tried different values for SAMPLES_PER_WAVE (in FFTSpectrum & ShapeFFT) but cannot see any difference. It looks more or less like this.

image

There is 4 WaterInteractionSpheres producing the waves with these parameters:
image
Greater weight produces more waves and more of the lines.

@daleeidd
Copy link
Collaborator Author

So the lines only appear because of the Sphere Water Interaction and FFTs together? There is a resolution param on the ShapeFFT. Not sure if it will help with these sort of patterns.

@klauskobald
Copy link

The strips are everywhere. The WaterInteraction creates more waves, that´s why they are better visible. But here is the scene away from WaterInteraction. You can see the lines
image
Stripes align always on the x-axis, and it seems like they are only in the inner most LOD.
image

@daleeidd
Copy link
Collaborator Author

Are you able to share a minimal scene or presets to reproduce? I haven't seen these lines that prominent since they were fixed. No need to provide Crest as I have a copy (I'll use latest URP version). Can send on Discord if you want.

@klauskobald
Copy link

This is an export of a prefab with minimal dependencies.
http://clients.kobald.com/crest/ocean/
I could not get it to work in a new project because of some urp setting. If you have a working scene it should be ok, I think.

@daleeidd
Copy link
Collaborator Author

daleeidd commented May 3, 2022

Thanks! I can see them now. Looks like we only improved the situation for a OR resolution of 384. Anything else appears to produces the pattern. I'll reopen.

@daleeidd daleeidd reopened this May 3, 2022
@klauskobald
Copy link

That´s interesting - I can live with 384.
Question: a higher number (like 384) will use more cpu or gpu? If I increased _geometryDownSampleFactor to 4, would that compensate for higher cpu usage then?

@daleeidd
Copy link
Collaborator Author

daleeidd commented May 8, 2022

Mostly GPU and memory. Increasing that will help performance but I don't think it will help with CPU.

@daleeidd
Copy link
Collaborator Author

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

4 participants