Help Foam Rendering suggestions - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Fluid (https://obi.virtualmethodstudio.com/forum/forum-3.html) +--- Thread: Help Foam Rendering suggestions (/thread-4396.html) |
Foam Rendering suggestions - spikebor - 26-10-2024 Hello there! First, pls look at this video It shows 3 problems with foam particle rendering. I'm On Unity 2022.3.45 URP deferred rendering. In this example, I use Obi Fluid only for splash and trail effects, the infinitive ocean is KWS water system. Problems with the Foam shown in the video: 1-Culling is so sensitive. The foam particles are so easy to be culled, it can break immersion. 2-In script, I animate the ObiEmitter.speed to do the motorboat foam trail effect, and the dive into water splash effect. for motorboat: when I contact the water and move on it, I set the ObiEmitter.speed to high value, when exit water, I set it to 0. for dive splash effect: when I dive into water, I set ObiEmitter.speed to high value, then gradually animate the value to 0, it is Stream, but when I animate the speed, it looks like burst effect. The problem is, after the ObiEmitter.speed is set to 0 in script, the emitter stops emitting, but the foam needs to be continued updated to it can gradually die out, but in the video, foam just hang in place. Is there somewhere in the system, when system detect ObiEmitter has 0 emission speed, it stop the ObiFoamGenerator from updating? Suggest: ObiFoamGenerator only stop updating when the foam particles all die out. 3-Suggestion regarding foam rendering. The foam currently not work well with KWS water system underwater rendering. I think if it is just opaque, it can receive those lighting. Currently, it is just white while everything is tinted, looks so out of place. But a quick edit in the shader code to turn it to Opaque shows no noticeable changes. Can you provide a shader graph version of the Foam shader? I'll try with Cutout Opaque to see. Thank you! RE: Foam Rendering suggestions - josemendez - 31-10-2024 (26-10-2024, 05:57 PM)spikebor Wrote: 1-Culling is so sensitive. Hi, Foam is not independently culled (it gets culled with the solver, if the solver's "simulate when invisible" is disabled). (26-10-2024, 05:57 PM)spikebor Wrote: 2-In script, I animate the ObiEmitter.speed to do the motorboat foam trail effect, and the dive into water splash effect. Setting emitter.speed only sets the emission speed, existing fluid particles continue to live on until they reach their maximum lifetime. Foam continues being updated as long as foam particles still exist, it does not care about fluid particle lifetime or emitter's emission speed at all. The foam simulation and the fluid simulation are completely independent from each other, so setting emitter.speed = 0 will not affect foam behavior at all. My guess is that your foam's "atmospheric drag" value is set to 1?. This will cause fluid particles to immediately lose all energy when no nearby fluid is around, making foam unnaturally stay frozen midair. Typically you're have a small drag value to simulate atmospheric density, allowing foam to slowly fall due to gravity when no fluid is close to it. It can also age faster, using the "air aging" parameter so that foam vanishes faster mid-air, when no fluid is around. This should result in natural-looking airborne foam. (26-10-2024, 05:57 PM)spikebor Wrote: 3-Suggestion regarding foam rendering. Setting the shader's render queue and/or render type to Opaque does not make the shader opaque, it just changes the point during the frame at which the object is rendered. It does not change what the actual shader does at all. You need to change the blending mode too, write to the depth buffer, and add proper lighting which may not be trivial at all if you want it to integrate with KWS's custom lighting. Unfortunately, the foam shader cannot currently be made using ShaderGraph. You'll have to edit the shader as plain text. kind regards, |