Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
white particles are rendered completely clear
#4
(13-07-2022, 12:50 PM)locque Wrote: Thanks for the in-depth explanation once again!

I suppose I'm stuck with using two fluid renders. It actually looks better than I expected, just rendering the clear fluid on top of the white fluid is cleaner than the mixing effect with both fluids on the same semi-transparent renderer.

Two fluid renderers can be quite expensive, even more in VR since you're be forcing the entire fluid rendering pipeline to run 4 times (2 for each eye) which is a lot of work.

Slightly modifying the fluid shader as I suggested before seems like a much simpler, far better performing option imho. If I understood your use case correctly, all you'd need to do is add a constant color (white-ish) to the final fluid color and that would do the trick.

(13-07-2022, 12:50 PM)locque Wrote: The shadowmap resolution is way too low, even with the resolution in the light set to very high. My particles have to be small though since I'm working with real-world scale. They also look like hard shadows, or at least significantly less blurred than you would want. As far as I can tell the hard / soft setting of the light only affects shadows cast by the fluid, but not the ones received.

Fluids do not do any custom shadow mapping, they read from Unity's own shadow maps. The only custom part is reading from them (see below). So shadow map resolution is whatever Unity is using at that point.

(13-07-2022, 12:50 PM)locque Wrote: Is there any way to disable dithered shadows? I think the shadows could look pretty good if the resolution was higher, but the dither pattern is going to look nasty either way. I'd much rather have the fluid receive no shadows from transparent things at all.

I'm not 100% sure, Unity will apply dithered shadows to semi-transparent objects by default. As far as I know it's not possible to choose whether the shadow received by an object is dithered or not. I'm no expert on Unity's shadow pipeline, someone in the Unity forums might be of more help.

Regarding shadow resolution, keep in mind that reducing shadow distance in the render settings will result in better utilization of your shadowmap: If your game takes place in a relatively small room, you could considerably reduce shadow distance to get more detail out of the same resolution.

(13-07-2022, 12:50 PM)locque Wrote: As you can see the fluid shadow received from the mortar is disconnected from the mesh, I really need to adjust the bias and near plane specifically for the fluid shadowmap while keeping the current settings for the rest of the scene, which means I have to use a separate light that only affects the fluid.

I can't do that though because the fluid doesn't inherit its layer from the emitter or the fluid renderer gameobject and instead always ends up on the default layer, which means I would have to create a new default layer and replace it on every other object in my scene. Is there a less obvious way to affect the layer the fluid is rendered on that I'm unaware of?

Fluid isn't rendered the usual way other objects are. It's rendered as a kind of post-process once everything else in the scene has been rendered, so it cannot use layers because it's not being rendered as a regular object that each individual camera/light can choose to render or not.

Instead, while rendering fluid the fluid shader taps into Unity's shadowmap and reads from it. For this reason Unity's built-in shadow softening (which I believe is just variable-width PCF filtering) does not work, since fluids "hijack" the shadowmap to read from it at a much later stage in the render pipeline.

However, it's possible to modify how the fluid shader reads the shadowmap, and do your own filtering/biasing on it if needed. I've modified the fluid shader a bit to include a 3x3 PCF filter, biasing, as well as a white-ish additive color. Here's a comparison of the retail shader and the custom one:

[Image: N1kgEE7.png]
[Image: IrSeDCZ.png]

You can find it attached, a few comment lines have been added to let you know which values to modify should you need. let me know if I can be of further help.


Attached Files
.shader   FluidShader.shader (Size: 10.04 KB / Downloads: 8)
Reply


Messages In This Thread
RE: white particles are rendered completely clear - by josemendez - 13-07-2022, 02:56 PM