Could use some help with shader mixer bricks - one texture fading to another

Hi, I'm having a bit of a problem of getting a shader to work.
Long story short; I'm trying to make a werewolf animation where a character turns into another creature.
Typical scenario; moon rises, transformation goes on, person turns into other creature.
I have 3 shaders that work with different areas of the body; I have a shader for the torso, limbs, and face.
Here's the issue; what I want to do is have the texture change based around the position of a single object in the scene, preferably one that is not the genesis figure that I'm loading this shader mixer onto.
Here's the overview (no I don't have a screenshot as I have nowhere to host said screenshot at the moment) :
There's a tiler brick that has its S and T values plugged into a pair of image map bricks. One contains the starting texture, and the other the ending texture. These go into a mix brick's base and layer values, respectively. The result of the mix brick then goes out to the default material brick, which then goes out to the surface brick.
In short:
tiler (S and T values) ---> imageMap 1 (initial texture) ---> mix brick(base)
---> imageMap 2 (final texture) ---> mix brick(layer)
mix brick (output) ---> default material brick ---> surface brick
now, as goes the alpha value of the mix brick, which actually controls the fade from one image into the other, I'm at a snag.
Previously I'd been using either a brick that returns the number of the current frame in the timeline (by using a fixed variable brick set to frame number) but this will only let the transition in texture go from one frame to another.
I also tried using an altitude brick. Issue is that this only returns the altitude of the figure or object that the shader is loaded onto, and only its altitude in relevance to either: A: another point on the figure, or B: the figure's relevant position to the rest of the scene, which means that if I try to, say, put the character in an elevator, or just elevate the character and scene simulatenously, the texture won't transition unless the character is the only figure in the scene, as the altitude brick only gets the figure's altitude relevant to all other objects in the scene, and not the scene environment itself (IE I could put the figure in an elevator and have the figure and elevator both move up, but because the figure moves up at the same rate as the elevator the figure's altitude in relevance to the elevator doesn't change, so the altitude brick doesn't return a different value).
I also know about the point brick and distance brick but the problem is that, again, the only way I know of to get any position data from a figure in the scene in the form of an integer or floating point value is the altitude brick, which still runs into the same problem as before; no change in altitude relevant to all other items in the scene == no changing value == static value to compare a point against == no change in texture.
I also know about the position brick, under "default modules ----> state", but I don't know how to use it. It's output is labelled "P", but it won't seem to plug into any other bricks, including the point brick or variable brick, I have no idea if the position brick has been depricated or not (whether it's still a usable brick) and the page for it on the support page won't load for me for some reason so I can't read the documentation on it either.
To sum this much up; I know what I need: a brick that will return a value that I can manipulate via an object in the scene. If I had an altitude brick that I could feed the altitude value of, say, a null or primitive object in the scene into (an object OTHER THAN the figure/object that the shader is being applied to) and then change said null or primitive's height, that'd do fine, but I don't know how to do this.
Comments
You could use maths bricks to combine the height or altitude with the frame number to give a value that depended on both.
I don't really see how this would work. I'm tryin to stay away from using the frame number as a means of controling the shader as it's not something I have control over via an object in the scene. Also altitude will not increment or decrement unless the actor with the shader applied to it changes altitude relevant to every other object in the entire scene. I don't see how having a variable that combines the two will help at all since effectively what it'll be doing is multiplying the frame number by zero; it'll take the frame number, which changes, multiplied by the altitude of the figure with the shader attached to it, which is measured relative to everything else in the scene. If the figure's altitude remains constant relative to the scene, and is not elevated in relation to the rest of the scene, it will remain at zero, as it is not at a higher position than some other object in the scene (altitude block is kinda useless unless you have a scene with only one object in it).
The only time the altitude brick will return values is if the figure with the shader applied to it is hovering above EVERYTHING else in the scene.
No, I was saying use the altitude (or whatever) to govern your transition but use the frame number to move the transition value so that the merge area moves from beginning to end. You could also paint a gradient to fit the UVs and use that as the mask, again shifting the transition value by frame.
I still don't get what you mean.
Also, I'd really like to stay away from using frame value and rely strictly on an object's position in the scene to change the texture.
Also, remember the altitude reading will not change unless the figure moves upward in relation to all other objects in the scene. That won't work. Even if I move the whole scene upward, the altitude brick gets distance in relation to everything else in the scene. If the figure and scene move together, the altitude brick will just keep at a constant value because the figure's altitude has not changed in relation to the rest of the scene, like in the elevator example I mentioned before.
The altitude brick's value doesn't change is the problem because even if I elevate the whole scene, the altitude of the figure relative to the scene stays constant and thus the value also stays constant. The altitude brick won't work in this case unless there's some way to have it measure the figure's altitude relative to the stage (the actual environment the scene is in; "world space" for lack of a better term) and not the other objects in the scene.
As goes using frames as the measure, I'd rather not do that as I want it to be controlable, and not strictly linear.
The only way I can think of to do this is to have a brick that passes a value of a figure or object in the scene to the brick which I can then give to another brick.
Perhaps I am not understanding your requirements? If you have the moon rising you presuambly know how long it will take, so you can just use the relevant values to decide where the mixing should occur by fame. However, it might well be possible to havea driver proeprty and use ERC code to link that to an object's y translation via scripting.
To be simplistic about it: texture fade percentage is, ideally, directly proportional to moon height.
This way I can raise the moon, have the transformation, have the moon set, the transformation reverse, and then raise the moon and have it go again.
It'd be so much easier to have this tied to the moon's height rather than have a bunch of timeline-related things that I'd have to constantly go back and double-check to make sure that it all lines up properly (render time will probably take all night anyway; I'd rather not spend all day fussing about with the timeline. I'm no stranger to debugging, but I'd like things to be a bit more expedient).
Also, whilst poking about in the brickyard, I was able to find the transform brick. This brick spits out the X, Y, and Z coordinates (as a point) that the object with the shader applied to it has, and can be toggled to find the distance between the object with the shader and the worldspace around it (native, I think, to world space point 0,0,0).
I'm going to see if I can find a way to make it spit out only the Y coordinate for height, and then also see if I can find a way to take the ID of an object in the scene with another brick, pass it into the the transformation brick, and then parent a null to the figure I want to transform which I can elevate or lower to control the transformation. The transformation brick is under Bricks(default) --> geometric --> transformation, and has its own drop-down menu (am using Daz Studio 4.9 Pro).
I'm now going to look around to see if there's anything that I can use to get the ID and positions of another object in the scene and pass it into the transform brick.