Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Shaders for Reflections / Refractions in 3D
#1
Implementing Obi Fluids for cinematics, where performance is not an issue.

What is the best method for adding real-time (or baked) reflections and refractions to our fluids with Deferred Rendering?

It looks like the Dielectric Fluid Shader only works in 2D space?
Reply
#2
(27-05-2019, 03:28 AM)Josterday Wrote: Implementing Obi Fluids for cinematics, where performance is not an issue.

What is the best method for adding real-time (or baked) reflections and refractions to our fluids with Deferred Rendering?

It looks like the Dielectric Fluid Shader only works in 2D space?

Hi there,

The included dielectric fluid shader already does realtime reflection and refraction, in addition to transmission. You can tweak all parameters that control it in the material that is using this shader.

The entire fluid rendering pipeline in Obi Fluid uses a technique known as screen-space ellipsoid splatting. This is state of the art for realtime fluid rendering. It works by drawing each particle's depth, thickness and color as an ellipsoid to an offscreen-buffer (splatting), generating a normal map from that, and using all buffers to perform a final lighting pass.

As you can see this is very similar to deferred rendering. More details here:
http://obi.virtualmethodstudio.com/tutor...ering.html
http://obi.virtualmethodstudio.com/tutor...ering.html
Reply
#3
We applied the DielectricFluidShader to the Emitter in the "FluidViscosity" demo scene for testing, but were unable to see anything render. The only particles that seemed to be visible were the standard "ParticleShader". 

We applied a texture to the Dielectric Material, but still couldn't see it. We then replaced the "Obi Particle Renderer" with "Obi Fluid Renderer" and added the DielectricFluid Material as the Color (left the ClearFluid material as is?) but couldn't see any difference. It does add a 2D camera, which is why we were thinking it would only render in orthographic.

The other part of this is having Obi fluids appear in environment/object reflections and interact with lighting. It looks like the particles reflect into themselves but the surroundings don't render the particles into their reflections?

Thanks for the help.
Reply
#4
(27-05-2019, 06:04 PM)Josterday Wrote: We applied the DielectricFluidShader to the Emitter in the "FluidViscosity" demo scene for testing, but were unable to see anything render. The only particles that seemed to be visible were the standard "ParticleShader". 

We applied a texture to the Dielectric Material, but still couldn't see it. We then replaced the "Obi Particle Renderer" with "Obi Fluid Renderer" and added the DielectricFluid Material as the Color (left the ClearFluid material as is?) but couldn't see any difference. It does add a 2D camera, which is why we were thinking it would only render in orthographic.

The other part of this is having Obi fluids appear in environment/object reflections and interact with lighting. It looks like the particles reflect into themselves but the surroundings don't render the particles into their reflections?

Thanks for the help.

Hi,

Can you see the fluid in the included sample scenes? Pretty much all of them use dielectric fluid. Note that fluids do not render in the scene view, as the scene camera cannot have any components attached to it.

You cannot apply a texture to the dielectric material. You see, fluid rendering operates in screen space (similar to post-processing effects), so uv coordinates do not have any meaning for them. They expect to receive specific render buffers via the ObiFluidRenderer. They do not work like standard surface shaders.

Adding a fluid renderer does not add a 2D camera by itself, unless you add it on an object that does not have any camera (because they use Unity's RequireComponent attribute, so Unity will add a camera automatically). Fluid renderers operate in screen space, so they require a camera to work and should generally be added to the camera you wish to be able to see the fluid.

Again, being a screen-space method they cannot appear in environment/object reflections of other objects. This would require generating a 3D fluid mesh in realtime which is prohibitively expensive.

PD: since you're using this for cinematics, why not using Unity's built-in Alembic support instead? that way you would not be constrained by what a realtime fluid simulator can do.
Reply