Skip to content

FIX unnecessary uniform reprocessing when values are unchanged#279

Open
Manice18 wants to merge 1 commit into
paper-design:mainfrom
Manice18:fix/shadermount-reprocess
Open

FIX unnecessary uniform reprocessing when values are unchanged#279
Manice18 wants to merge 1 commit into
paper-design:mainfrom
Manice18:fix/shadermount-reprocess

Conversation

@Manice18

@Manice18 Manice18 commented Jul 12, 2026

Copy link
Copy Markdown

Closes #275

To Test Locally:

Create a simple nextjs repo and import the local build of this branch.
In package.json of the nextjs repo import in dependencies via:

"@paper-design/shaders-react": "file:../packages/shaders-react" // or your file path of the local build

In page.tsx of the nextjs repo add the following code:

'use client';

import { useEffect, useState } from 'react';
import { Water } from '@paper-design/shaders-react';

export default function Demo() {
  const [tick, setTick] = useState(0);

  // Parent re-renders every second; Water props stay the same
  useEffect(() => {
    const id = setInterval(() => setTick((t) => t + 1), 1000);
    return () => clearInterval(id);
  }, []);

  return (
    <div>
      <p>tick: {tick}</p>
      <Water image="/test.png" style={{ width: 400, height: 400 }} />
    </div>
  );
}

Make sure to add an image named test.png to the public folder. Then simply run the app.

Working proof:

papertest2.mp4

@vercel

vercel Bot commented Jul 12, 2026

Copy link
Copy Markdown

@Manice18 is attempting to deploy a commit to the Paper Design Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shaders-docs Ready Ready Preview, Comment Jul 13, 2026 4:43pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShaderMount re-processes uniforms on every render due to object identity, causing redundant image loads

1 participant