Skip to content

Apply Fluid Shader FX as reflective plane material #62

Closed
@nhtoby311

Description

@nhtoby311

I'm trying to apply useFluid and useBlending FX to a custom <MeshReflectorMaterial/> from drei, to create a reflective water with ripple as you move the mouse along the surface, and I encounter some issues with it:

  • The mouse positions are set to viewport by default, while I want to map it to the plane UV coordinates. Is this possible?
  • In <MeshReflectorMaterial/> fragment shader, it output color as vec4 diffuseColor, so I can not "morph" the UV using the usual ways "texture2D(diffuseColor, uv)". I wonder if it is possible to morph the UV of diffuseColor in this case?
  • Render the whole scene into createPortal to use it as texture of full-screen FX plane will disable the mouse movement of scene, leads to any prior mouse event in the scene will stop working.

I wonder if everything mention above is possible with this package? I have ported and created CustomMeshReflectorMaterial, linked it with useFluid and useBlending to apply the FX to the material in this codesandbox!

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions