ssbucarlos / smash-ultimate-blender

Blender Plugin containing utilities for Smash Ultimate Models and Animations.
45 stars 9 forks source link

Implement UV Scaling #184

Closed ssbucarlos closed 1 year ago

ssbucarlos commented 1 year ago

Making this to checkout a topic branch. Need to update drivers + the sampler node, i will be using this partially REd vertex shader as reference. But basically the translate component is also affected by the scale component. partial_re_eye_compute_shader.zip

ScanMountGoat commented 1 year ago

The shader you linked looks like the correct vertex shader. Compute shaders are just used for vertex skinning and a few other specific tasks. Here's the relevant code that's already been analyzed and ported to ssbh_wgpu. The non obvious part is flipping twice for the y coordinate.

vec2 transformUv(vec2 uv, vec4 transform) {
    float x = transform.x * (uv.x - transform.z);
    float y = 1.0 - transform.y * (1.0 - uv.y - transform.w);
    return vec2(x, y);
}
ssbucarlos commented 1 year ago

oh i may mave messed up with my RE then lol let me double check

ssbucarlos commented 1 year ago

also idk why i said compute shader , edited the comment

ssbucarlos commented 1 year ago

image These are the blender shader nodes i ended up that seem to reflect the changes when i mess around with the cv31 input values in renderdoc

ScanMountGoat commented 1 year ago

Can you factor out the scale and move the multiply node after the add? You should be able to do scale * (a+b) instead of a*scale + b*scale.

ssbucarlos commented 1 year ago

oh wait ur so right i can do that. Im not sure what i did wrong, but i swear that was among the first things i randomly tried and i thought it didnt work and thats why i went to go look at the vertex shader stuff in render doc lol

ssbucarlos commented 1 year ago

image Ok this is what i got now

ssbucarlos commented 1 year ago

Just for future reference, class properties of a custom node don't call the 'update' function when updated by a driver. So while this was how i wanted the interface to look like for simpler code, i will need to make a slightly more complicated internal node/driver setup to use shading node inputs to control the values instead. image