A Question about using Formula Variables in Carrara 8 Pro

Turk_WLFTurk_WLF Posts: 177
edited December 1969 in Carrara Discussion

I'm just wondering if the formula variables are global to the shader or local to the formula?

Because I have to synchronize two formulas.

I know it's not that detailed at this moment because I misplaced my flash drive that all of my formulas & notes, I'll be posting more details when I can.

Thanks,

Comments

  • TerritanTerritan Posts: 76
    edited December 1969

    Turk_WLF said:
    I'm just wondering if the formula variables are global to the shader or local to the formula?

    Because I have to synchronize two formulas.

    I know it's not that detailed at this moment because I misplaced my flash drive that all of my formulas & notes, I'll be posting more details when I can.

    Thanks,

    I may have to research this a little, but I believe formulas are almost wholly self-contained. Their scripting language is frighteningly simple, to the point that there's not even a way to define global variables, much less constants. (e.g. Want a constant? Create a variable, and then don't change it!)

    I say almost because there's one point of contact that any formula, whether object, shader, or something else, has with the outside world: The p-parameters, which can be key-framed in the Sequencer and manipulated in the Graph Editor.

    If you can synchronize the p-parameters, so moving one parameter will effect the correct changes in a whole series of formula widgets, then it should be possible to then pin the p-param in one timeline, and then copy that snippet of timeline to the p-param tracks of the other formulas.

  • DiomedeDiomede Posts: 15,165

    Has anyone been able to confirm if this use of the p-param with the timeline is able to synchronize with other p-params to create a global shader network?  Is there another way?  I thought the u and v values might be useful?  Would one of the shader plugins from Fenric or Inagoni help?  What about the plugin for the replicators?  Is there another solution?

  • TerritanTerritan Posts: 76

    Sadly, I was woolgathering on the research, and finally I had a "disk event" that necessitated a near-clean wipe. Kept much of the data, but the apps were wiped and all had to be reinstalled. And I have yet to reinstall Carrara or any of its content. I still check the boards to see if a more recent bug fix has come out, but until that does, I might not. Also I'm more than a little worried how Daz's implementation of Postgres SQL will interfere with the Postgres SQL installed by Apple Server. However, I still know formulas, and might be able to guide you.

    The u and v variables are special ones. For any given formula that uses them, it's helpful to think of that formula in terms of:

    for u = [min u] to [max u] step 0.05

    for v = [min v] to [max v] step 0.05

    (your formula)

    next v

    next u

    They're values iterated over within Carrara itself in order to generate the whole picture of whatever it is you're contemplating. If it's an object, u and v range from 0 to 1 and are mathed out to determine where to put the points of whatever mesh the formula defines in 3d space. If it's a gel on a spotlight, u and v range from -1 to 1 (0 in each axis happens to be centered precisely at where the spotlight is focused) and get mathed to determine the color at each point. Other formulas may use other variables. And the formula ultimately receives all values of u and v. Or t. Or whatever variable Carrara supplies.

    Variables like u, v, and t that Carrara supplies come only from Carrara, and variables like red, green, blue, x, y, z, and such that Carrara expects from a formula go only to Carrara. The only things that are user-adjustable from outside the formula editor are p1, p2, p3, and p4, and those unfortunately tend to be independent. That's why I suggested copying and pasting the timeline segments. But if you have 20 or 30 of them to coordinate, C&P would not be the way to go.

    I don't know if PyCarrara provides any extra access to formulas, or if any other plug-in (that I didn't have even when I had Carrara installed) provides extra access to the formula environment. Even as powerful as the formula items are, the formula editor is pretty bare-bones, and I don't think anyone considered external programmability when the feature was first conceived.

  • DiomedeDiomede Posts: 15,165

    Very helpful.  Thank you.

Sign In or Register to comment.