Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename uv in vertex shader hooks to texCoord for consistency #7669

Merged
merged 1 commit into from
Mar 25, 2025

Conversation

davepagurek
Copy link
Contributor

@lukeplowden noticed that in fragment shader hooks, we call the texture coords vec2 texCoord, but in vertex shader hooks, they're vec2 uv. This renames them all to texCoord for consistency.

cc @perminder-17 in case this affects any docs/examples

@davepagurek davepagurek merged commit 7afe1ea into dev-2.0 Mar 25, 2025
2 checks passed
@davepagurek davepagurek deleted the fix/uv-name branch March 25, 2025 13:18
@perminder-17
Copy link
Contributor

perminder-17 commented Mar 25, 2025

Sure @davepagurek , I can have a look at it. Btw, I wanted to ask that when you created shader-hooks and also, when garima was working with shader defined what they are used for issue, I noticed the example-sketch you added for modify which was working perfectly. But now, I noticed some issues so I changed the example-sketch, but didn't got too deep on what's the issue actually was.

Before it looked something like this (which is not working now in 2.0 website)

  myShader = baseMaterialShader().modify({
    uniforms: {
      'float time': () => millis()
    },
    'vec3 getWorldPosition': `(vec3 pos) {
      pos.y += 20. * sin(time * 0.001 + pos.x * 0.05);
      return pos;
    }`
  });

Here's the PR : #7649 where I changed the example with working one which works excatly the same and also shows you how modify works but don't know why the above example doesn't works (might be a bigger issue) or (something might have been changed and I don't know).

@davepagurek
Copy link
Contributor Author

Thanks for taking a look @perminder-17! We've updated the vertex shader hooks to work a little more like the fragment shader ones, where you're given a struct as input with a bunch of properties, and you are then able to modify any property based on data from any other property. In the previous iteration of the vertex shader hooks, since e.g. the position hooks ran before the normal hooks, you couldn't use the normal to adjust the position, only the other way around.

So the fix in this case would be to switch to the new getWorldInputs hook.

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.

2 participants