Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Assets diamond Visual Scripting

Discussion in 'Works In Progress - Archive' started by maz_dev, Jun 17, 2017.

  1. dba999

    dba999

    Joined:
    Oct 3, 2014
    Posts:
    19
    Ok. Many thanks for the quick and detailed answer. I'll take time to test this solutions.
    (merci aussi pour le mail)
     
    maz_dev likes this.
  2. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    I will probably be adding diamond into 1 or more larger projects that are being shared on gitlab. We have a system for Sharing Large assets and external code via a bitorrent share. in order to do this we need to move the plugins install folder or ignore and share it separately (which is just extra work) i thought i`d just ask if moving the original install folder for diamond is possible or advisable.
     
  3. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261

    Hi Barada,
    diamond should always be in the path

    Assets / Mezanix

    Otherwise, he will not find paths that he use to save information about graphs, to ensure their names uniqueness, last paths, and other info.
     
  4. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    I`m trying to make a gradient editor. i`m considering various ways of doing it. the most obvious to me is allowing the user to add points on a 2d grid (i will be extending this to 3d in the future) with a colour attached, getting the distances between each point and using an animation curve to blend between the two. i`ll probably change this to writing the texture per pixel per colour point and blending between the target texture colour and the new colour point, so that multiple points will blend together.

    To do this i`m using a int loop, to get the x position. then using an int/multiply with float out float to get the curve animation time. i am trying different ways to get a trigger bool from the int loop. i think it either needs an additional bool output from this node. a pulse for each loop, or maybe an "int\float\vec has changed" node.
     
  5. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    at the moment i have this
     
  6. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi Barada,
    I noticed that you want to compute a changing position between 2 space points (like a lerp) and give this position as an input to an animated curve to blend between 2 colors.

    For each variable (float, int, color etc ..) there are 2 types of animation curves nodes. the "Animation Curve" like you use in your screenshot, and the "Animation Curve Pick Value" like in the following image:

    Image 1.png

    You can use the float input as an information about your points positions, you have to normalize the information between 0 and 1, so the node will blend for you between the 2 colors.

    With this node you don't need to trigger the animation because this node doesn't animate the curve, it only takes a float between 0 and 1 as input and gives an output color as curve based interpolation of the two inputs colors. So you can put the "do it" of this node as "always do it" and give it a changing value between 0 and 1 corresponding to your 2 space positions.
     
    sngdan likes this.
  7. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    ok. It seems to be a language thing again. i think they need different names. animate (for values that change over time) and interpolate (for a lerp). "Pick curve value of this time" needs to be descriptive of the expected input , maybe "interpolation (0-1)"

    what i`m trying to do is the user sets the points and then each pixel is calculated and written to the texture. this means that every value needs to be calculated and then written to the output texture. this is a long process and i dont think every frame is a good option. basically i just want a loop that triggers with a key press and loops the set number of times. Does the int loop need to receive the correct number of trigger pulses? surely thats what it is supposed to do? what happens when it reaches the maximum? maybe if it loops this can be a triggerable state (loop bool on the node) cus i do not need it to start again, just zero itself. As you can probably tell i`m getting a bit exasperated as so far i havent got any project to work. i`m sure this is my fault, but i think it may mean there are some problems.
     
  8. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    i think what is quite hard to get ones head around is the mix between logics and the FSM process. they are very separated. I think having simpler ways to connect and link fsm nodes will help considerably
     
  9. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    We think it is never your fault, and we thank you to be honest, when you can't go to a final project, it is one of 2 things,

    a) Some features need to be added to diamond

    b) or features that you need are in diamond but not noticed well in the documentation.

    So we will read the email you send to us and see the graph you have sent, and we will try to help you by telling you what features to use, or in the other case what features we need to add to diamond.

    Finally, for connecting FSM nodes quickly, we will add your previous old suggestion about creating 'theoretical' links between states, to have the design of the gameplay visually before affection these links to these corresponding logics.
     
    Barada and eggeuk like this.
  10. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    I am having a simple problem, but am confused on how to do this as there are a few ways that
    it would do the same thing. All i want to do it like a light switch .. light goes on, light goes off.

    You could a: set intensity like say to 0 or to 1
    or you can b: activate / deactivate also ..

    the real problem I am having is how do you turn a bool to true or false by using a key input ?
    It seems no matter what i try, I can not use a key to make a bool go false or true .. :(

    Also just for clarity how does the Invert At Pulse work ? I had thought you could make it pulse with a key input ?

    For me i'd like if possible both examples .. since some times with lights you will want to set intensity etc ..
    but the are many times i simply want to activate / deactivate a game object .. and this could be done with tags too,
    I would imagine. Thanks for any and all suggestions.
     

    Attached Files:

    Last edited: Sep 5, 2017
  11. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    Also just had a thought for more time saving.. When you go to add a Logic is it possible to
    have a default Add Logic, name .. Logic, that way you can rename the logic after you
    are in the second level ? if it is easy and a good idea to add.
     
  12. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261

    Hi Kennth, try doing this, if you want we can send you the graph ;)

    ActivateDeactivate (1).png
     
    Last edited: Sep 5, 2017
    Kennth likes this.
  13. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi @Barada , we got a look at your graph, we think we can make it working, as demanded by @Emerald_Eel_Entertainment for his need to animate zoom in/out camera by animated curves, both demands need a new bool node: 'Start At state Begin' to get a one true impulse when we switch into a state.

    @Barada we apologize, it is another language confusion, you have used the bool node 'Start Event', when seeing your graph we understood that you had the intention to get a true pulse at your state beginning, but the 'Start Event' give a true pulse only at the game beginning, it is not your fault, the name is confusing, we will change it to 'At game start' and will add a new node to get pulse 'At state start'. When it is done we will try to do your graph with this new node and send it to you with the latest diamonds version (1.1.3) that will be sent to the Unity asset store, but we will send it to you so you will have it without waiting for the asset store reviewing delay.

    @Emerald_Eel_Entertainment , same for you Emerald, when it is done I will send you the latest version with a graph of animated zooming

    And for you all, if someone wants to test the 1.1.3 version, send us an email to
    mezanixissa@gmail.com
    and we will send you the version.

    Happy diamond scripting :)
     
    Kennth and Barada like this.
  14. eggeuk

    eggeuk

    Joined:
    Sep 1, 2013
    Posts:
    88
    Hi everybody,
    one question within the topic of toggeling a boolean.
    If I use an inputkey node and press the key, shouln't it at once show it's current state?
    Here is a picture about it. As you can see Diamond is in execution state.
    OnOff_SpaceKey.PNG
    - Output false, when not pressing the key. --> that's shown
    - Output true, when pressing the key. --> that doesn't work, the node doesn't change to true
    Is there something wrong in my thoughts?
     
  15. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261

    Hi eggeuk, to show this node acting, you have to play the scene in the unity editor and be sure to be in the game window and press space bar, you have also to change the field 'Trigger When' to 'Hold', because down means, go to true at key down, and it is very fast to see it in the graph.

    Image 6.png

    Some nodes (especially input nodes) needs that unity editor be in play mode to act in the graph, I have to notice it by a message in this kind of nodes.
     
    Kennth likes this.
  16. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    Ahhh okay so simple :) user error I had it in the wrong order :oops:

    Edit: Can you please send the graph to my email , I am still having problems with
    the key bindings
     
    Last edited: Sep 5, 2017
  17. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    I made one for light intensity using " L " it does work, once you click the mouse in the
    game window, and there are delay's when pressing the key. Version 5.6.3 win 10
     
    maz_dev likes this.
  18. eggeuk

    eggeuk

    Joined:
    Sep 1, 2013
    Posts:
    88
    Hi maz_dev, it's working as you said!
    I changed to 'hold'-Trigger, putted the generated Csharp-Base-File to a gameobject, pressed play-button in Unity Editor and clicked the Unity Game Window.
    By pressing the spacebar the node output changed to 'true'.
    What a great step!!
     
    maz_dev likes this.
  19. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    If you have activated or deactivated a game object in the hierarchy, it can have delay when testing it in the unity editor, to be sure that this delay it is not related to other things, do a little built and test the game, deactivating and activating game object in a built game must be faster than doing it in the unity editor.
     
  20. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi everybody,

    We are on a little trip and we will return to the mezanix center tomorrow night, so sorry for today and tomorrow if we will be less responsive.

    Happy diamond scripting :)
     
  21. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Diamond 1.1.3 is coming soon
    With the following new features:
    1. Data transfer, like any C# script written by an experienced developer, scripts generated by diamond can transfer and communicate data between them letting any objects in your scene communicating with others.
    2. Colors for variable types. Each field has a color related to its variable type. Links are also colored according to variable types colors.
    3. Links shape enhancement to enhance graphs readability.
    4. Inventory list actions (add, remove, make the object of this index ready) for all lists types.
    5. At State Start, a new function in the bool logic node. Trigger one or more true pulses when the program switch to your state.
    6. Expose in the inspector (make variable public) in the get nodes.
     
  22. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Diamond is free now, to let it still so, we need your vital help

    mezanix donation page


    We are not native English speakers, so it's kind from you to help us correcting our announcements.
     
    red2blue likes this.
  23. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
  24. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi guys,

    Working now on diamond 1.1.4 on new features like:

    string manipulations,
    one simple node to click on an object

    and others ...

    To make the logic node more compact, we developed in diamond the ability to draw multiple UI fields in a one line
    HorizontalUI.png

    for example, we have here 5 entities, each one is a label and its value, all are drawn in the same line
     
    Barada and Kennth like this.
  25. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
  26. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Sorry been away for a while. very busy. great to see a new update. new node layout looks good. sometimes the right column looks a bit cramped when the drop down list text is wide. Maybe if each line was left aligned so that row description (compute, data name,radius, variable type etc) was aligned to the left with a small space after, and the input field or drop down list it relates to on the right fill the whole rest of the line, rather than being a fixed width from the center of the node.
    The updated zoom is welcome but as i`m sure your aware, no use at the moment due to nodes only scaling on the grid not in position, and then ending up intersecting and destroying the users layout. maybe it would be better to not zoom, bit have a mini map overlay in the corner of the window that shows the relative node positions on a fixed grid. another alternate would be to not scale anything and make the window a render texture of the actual diamond editor window, and scale it that way. so everything get smaller as your zooming out of the image data, not redrawing the nodes. uv coordinates can be used to get the interaction from the textured window to the diamond buttons and fields.

    glad to see the send data system being advanced. this does feel more like setting and using variables like "real" programming. maybe these "sent" variables can be listed in a separate extension of the project variable side bar?
     
  27. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Hi Barada, thank you for suggestions,

    We like your ideas and remarque about the new layout and the zooming mechanics, we have planned to do a big UI changing later, and we will try to take into account your ideas, zooming by referring to kind of UV mapping is a good idea to enhance zooming.

    About listing the "sent" variables, they are listed in the inspector of the gameobject "MezanixDiamondDataTransfer"
    and organized according to their types.
    The gameobject "MezanixDiamondDataTransfer" is automatically created by diamond in your scene, it has only one mission: hold the sent variables and their names.
     
  28. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    The gui uv system i mentioned is actually a system i came up with for a 3D ui implementation that can use standard unity ui`s on unique 3D geometry. if you like i am happy for you not only to use it as inspiration for the diamond editor, but also as an advanced Diamond feature. Let me know and i can supply more details.
    I think the send/receive data is going to be a highly used feature, just like setting and reading variables is at the core of programming. Making this process as quick as possible i think will be a very worthwhile "quality of life" feature. I would also consider making the terminology more like the real process. Set/get variable? a bool box can also be added to this node to "make global", and replacing the left side panel with not only a variable list (as mentioned above) but maybe a unique node that can be "torn off" or created with a button from this list. this would be ONLY for variable. Colour coded and visually different to normal nodes it only has option for variable type and name, but has input and output connections. the list on the left panel could also have a number on it for the number of times the variable has been connected, so the user can see if variables are actually being used. the left panel wouldn't need any connections as it does now.
     
  29. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Also it may need to be stated if variables dont show on the nodes then hitting the doit button on the send node will register it to the system. If the data name is changed it seems to remain on the list. probably not a problem, but could become messy if the user is regularly undecided when building the graph.
     
  30. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    we are interested in more detail about uv technic to have a global logic view, I think the most difficult part is to have a global image (like a screen shot) of all the graph when part of it is out of the screen, you may have ideas for that.

    For the terminology, get / set, is good as is a standard programming word, but as long as diamonds users can be from any kind of disciplines (art, programming, etc..) we try to use a familiar language, so send and listen to variable describe what happening exactly, it is like a broadcasting system that can be also used in lines written "classical programming".

    About changing the variable name, once the variable is sent to the system it remains in it even if its sender node has changed the name. when the sender node changes the name it means it is preparing to send a new variable. the only way to clear a variable from the system is to listen to it with the option "consume variable" turned on.
    The transfer data is like a spreading the word action, when someone wants to spread a word he tells it to the radio to diffuse it, so everyone can listen to the message.
    The only difference in diamond, is the capacity that listener has to delete the message, otherwise, if the message is not deleted by one of the listeners, everyone can relisten to it again when he wants.
     
  31. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    I didn't understand well, did you talk about "Project Variables"? if so, "Data Transfer" has any relation with project variables, otherwise, explain to me please, I didn't understand what do you mean by, the left side panel
     
  32. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    By left side panel i mean the project variables box (pictured). This is largely wasted space i think. also when things are connected to this things become very messy.
    combining the way project variables and the data transfer system (which is realy just named local variables isnt it?) i think would just simplify it for the user. from the users point of view theres no difference apart from the project variables being usable in all graphs. Of course a Project variable cant be "consumed".
    I understand that users can come from various areas of expertise, but introducing an entirely unique way of looking at what is a very standard concept of "variables", doesnt help anybody who has previous knowledge, or uses diamond as a stepping stone to understanding actual scripting concepts.



    I would say the one of your initial goals of simplifying things by having a single adaptable node is being lost due to the complexity of this node now. This is why i introduced the idea of a separate variable node. so the user can add them very easily from the side bar, and its obvious where they are in the logic.

    would using these variable allow for writing self updating loops? if an "always doing it" logic has data sent at the end, that is also read at the start of the logic, would it update itself? could this cause technical problems?
    sorry. sometimes i think as i type and it spills out :)
     
    eggeuk, maz_dev and Kennth like this.
  33. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Did you suggest that variables been separated from nodes so graph can be more clear to the user because it helps him to distinguish between "computational nodes" and variable nodes? It is a good idea, or I can simply demand to diamond to color differently a node when it is a variable node (actually a get node).

    To make the use of the nodes simpler, there are 2 actions we are working on:
    1. trying to do games using diamond by ourself, detect the developers needs and do high level nodes. for example, in diamond actually if you want to trigger when clicking on a 3D object, you have to make a node drawing a ray from camera to world, another node to cast this ray, another to detect tag etc.. in this case we will compact all these actions in one node called for example: 'click 3d object'.

    2. add a search engine for a long list selector, that search the names, later I will also try to add keywords related to selectors names, for example, if we have a compute type called "Camera Ray" and it is "hidden" in a long list of things , I can add to it the following keywords (camera, ray, physics, detections, etc..) and it is practical to let the user adding his own keywords.
    if google can explain to me how their search algorithm works, I can be the happier man on earth, we can call that the search keywords happiness ;)
     
    eggeuk, Barada and Kennth like this.
  34. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    In the elevator example that you kindly did for me there was 2 problems that i remember ,,

    first was it worked but the block moved when ever i clicked the mouse, like any where
    on the screen, not just clicking on the block. The second thing was that the block re-set it self to position 0 0 0 origin .. ( yes I should have keyed in the position where I wanted the elevator ) But it would be much easier to just be able to say " this object "

    Playmaker has a separate instructions also that are " universal " like Mouse down / mouse up / mouse over / ect ..

    So an addition to Diamond , that simply has on mouse click " this object " then " do something " makes sense.

    I do not not C# but i do know from reading forums , people seem to complain when there is a lot of ray casting , since
    I think it slows things down. If we are talking about the same thing .. being able to just specify the " object " on click ..
    do something would be a lot better. Since you have a lot of clicking on things when you make a game .. so setting
    up raycast for every object .. might not be optimal. like as an example .. you have a house with a lot of
    lights / lamps ... that when you click on one lamp / light you do not want all the lights turning off and on at the same time.

    Hope that made sense.

    I agree with Barada last post, The " project variables box (pictured) " Tab is wasted space, there has to be a better setup for that. There is nothing wrong with copying or emulating similar set ups, of other software that is similar
    in its purpose. Maybe there could be just a small " click box " like a second upper layer, that when you click it ,,
    it opens up another screen that you can put all the Variables in and when you click " back " you go back the the
    main screen " then one more click to get back to the main screen .. or any other idea that makes sense.

    As the developer you get to say how you want to make diamond better we all agree that is ultimately your say.
    But how ever, As I am sure you have heard the saying that " Art is subjective " So what we see as the best and only way... really is only one way of seeing things.

    The point Barada makes about calling things what they are normally called I have to agree with 100 % .
    " I understand that users can come from various areas of expertise, but introducing an entirely unique way of looking at what is a very standard concept of "variables", doesn't help anybody who has previous knowledge, or uses diamond as a stepping stone to understanding actual scripting concepts. "

    Me not wanting to learn C# aside :) The idea is that IF* I have to learn coding " words " and what they mean , then logically it should be what Unity calls It to start off with.


    This is kind of what happened when software first started ( yes i am that old .. LOL ) developers were making their software with the UI that They wanted ... people in the end had a harder time learning since there was no
    rhyme or reason to some software UI'S ... so as a result , software has certain " conventions " like
    file Open/ close / save .. ect we always find it top left bar ...

    So this is kind of what I think may hold Diamond back in the long run.. while new comers might find it makes more sense for a time.. you won't be doing them any favors in the long run.... and i feel it will hurt more then help
    Diamond in the long run. But as i said this is just my opinion that Barada makes the point well. Also him being
    more skilled in playmaker then I, can explain how things in diamond could be similar in some of its set up.
     
    Last edited: Oct 7, 2017
    maz_dev likes this.
  35. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    In the elevator, I wanted to do a simple example that moves the elevator on the mouse click, we can evolve this by sending a ray from the camera that hit the object at a click , so it acts only when I click the object.

    Hitting 3D object by click is done by a ray, a mouse click is in screen space, we need a ray to express this click in 3D space and try to hit an object. Don"t worry about performance because in this case, you can send the ray only once (when you click).
    For other situations, when you have to use rays in all frames, you can enhance the performance by 2 ways:
    1) put a small distance of your ray (just what the game need),
    2) group your objects in layers and tell the ray to hit objects that layered under your wanted layer, for example, objects layered as water don't need to be hit by a ray that wants to hit solid objects.

    In our upcoming versions we will do high-level nodes, for example, one node called 'click 3D object', so no need to do all the stuff I explained above, diamond will do it.

    I agree with you and Barada that project variables panel should be minimizable, I wanted to deprecate it as long as the transfer data system can perform the same goal, but if you (Kennth Barada and others ..) want it to still, we will preserve it.

    For language, the words I used (send, listen) in the transfer data system, are exactly the words used in programming when someone code a transfer data system (called also broadcasting), the get and set words are used in other situations, they are used when you have a class with properties (variables) and want to set or get (read ) a property.
    If you want more details, take a look at books and tutorials done by Alan Thorn, when he explains how to do a broadcasting and data transfer system, he uses the words send and listen. By the way, he made very good resources to learn Unity.

    About UI and learning from other software, I am totally agree, like I said to Barada, we will do later a big changing of the UI and user interaction, in which we will be inspired by many software, in this process we highly appreciate your contribution (you, Barada and all users) because UI is crucial to the success of a software and we have to satisfy as much as we can the users in this aspect.
    Yes, all opinions are subjective, for example I started learning 3D modelling with Blender, so when I tried to learn Maya, it was hard because the 2 software don't have the same UI logic, and I still for now more comfortable with Blender maybe because it is the first 3D modeler I have learned.
     
    Kennth likes this.
  36. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Another idea would be to have some level of separation between the high level node functions, and the lower functions that are available. Maybe a Standard and an Expert mode? for each node, or the graph default. This may help beginners by reducing what is becoming quite a long and complex structure of functions.
    I think ultimately the side bar is far too obtrusive, and should either be done away with or hideable. My suggestions about using it for other things was mainly for simplicity. After using the send/listen system as it is at the moment (even though i dont actually have anything to show yet) it seems to work ok. (once i worked out to hit doit to register the variable) and maybe all that is needed are the usability features (UI, etc) that your already planning.

    I intend to continue testing Diamond but, my time may be limited if i need to find alternative ways of interaction with shaders and procedural materials. implementation of set procedural float/int/vector/color property and the same for material.set, would allow me to utilize more of my "work" time.
     
    maz_dev and Kennth like this.
  37. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    Thank you for your thoughtful and through reply. I knew the elevator was a fast example you did for me,
    I think it was the day before you were going on a trip, so I appreciate a lot! I only mentioned it in part to
    kind of try to explain my thinking. Real world examples of common things of " how would i do this in Diamond "
    To my way of thinking might be best to think about, then do in Diamond. Like elevator, On click this object ..
    on player enter / exit ... turning off and on scripts. I am drawing a blink now for examples. HAHA.

    The side bar is " too obtrusive " How you want to handle that is for you. I think if you wanted to " deprecate " it, then by all means , how ever you think about doing this is your decision , even making it hide-able or minimizable also is good..
    for how much it is used, being able to minimize it after or do a separate tab, lots of options.

    It is safe to say this, if you find something that to you is a PIA ( irritating / irritant ) then assume others will find it the same.

    On the wording please take no offense , since i do not know coding at all.. I would have no idea what are the proper words and are not. Safe to say though if you use the terms Unity uses for something, then really you can't go wrong.

    for the rest I would say anything i would test would be beginners level at best, So if you have a choice and it fits with
    what your general plans are , then what ever Barada would find useful to me, pay more attention to him then me.
    Since what he is doing is real world and in the long run it will be beneficial the Diamond VS in the long run.

    Send/listen Get/Set is universal, so since he needs it in a special way for procedural materials and his skill set is above anything that i could suggest.

    Diamond VS holds great promise and is at its core a very good idea! A lot of good things take time and
    different approaches sometimes. I have no hesitation at all to say Diamond VS will be great, its just a matter of time.
     
    maz_dev likes this.
  38. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    @Barada it seems like you heard my head's waves, because I started coding new section in each node called "High-Level Nodes" completely separated from the rest that you all already know which we can call the "Low-Level Nodes". Here I explain to you all how I proceed to do the "High-Level Nodes", yesterday I watched the first beginner's official Unity tutorial, the "Rol a ball". First thing done in this tutorial is moving an object, so I tried to think like a beginner, and I said, oh yeah, a beginner doesn't know that an object needs a rigidbody to be able to receive force, the beginner want just a simple node saying "Add Force", it is up to this node to check if the object has a rigidbody and tell the user to add one if it is missing.
    This is different from "older low-level nodes", in low-level nodes, the user needs to know that he/she has de deal with a rigidbody, so he/she has to choose "rigidbody" from the variable list. However, In the "High-Level Nodes" things are straightforward, the user said I want to move the object, or I want to do whatever with this object, and if this decision needs more components or other considerations to be taken, diamond will do this automatically or at least tell the user what to do.

    @Barada , @Kennth and everyone who likes to tell his opinion:
    Tell me please what do you think about this method of constructing diamond.

    About project variables (the sidebar), yes, me too I find it intrusive and when testing I use mostly the send/listen transfer data system, If you want to deprecate it, I agree because after testing, the send/listen system is faster and robust.

    @Barada tell me what you think about get/set procedural properties and the set material that is already available. And for next versions, I begin to find a way to get/set variables in shaders according to their properties names, is it your need?

    @Kennth I have to take into account everyone ideas, all ideas are useful, the experimented user help us to do more polished product, the beginner helps us to do more user-friendly and more widely appreciated product. And about words, they are only words ;) no matter if we use the word one or the word two as long as everyone is agreed about its meaning.
     
    Last edited: Oct 9, 2017
    Kennth likes this.
  39. Kennth

    Kennth

    Joined:
    Aug 11, 2017
    Posts:
    116
    100 % agree on the words. I think it is a great idea going through the Unity tutorials and
    being able to do the same thing in Diamond!! To me that makes great sense in giving direction
    to possible use cases for Diamond. Great idea :)
     
    Last edited: Oct 10, 2017
    maz_dev likes this.
  40. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    Appologies, i had totally forgotten that you had implemented the procedural material settings already. they seem to work fine. is it possible to have a set int value? they are used more often in procedural materials. i think only shader global variables are changeable in a script.
    if it help i have a simple shader with a global float.

    Code (shader):
    1. // Made with Amplify Shader Editor
    2. // Available at the Unity Asset Store - http://u3d.as/y3X
    3. Shader "Startest"
    4. {
    5.     Properties
    6.     {
    7.         [HideInInspector] __dirty( "", Int ) = 1
    8.         _Star("Star", 2D) = "white" {}
    9.     }
    10.  
    11.     SubShader
    12.     {
    13.         Tags{ "RenderType" = "Opaque"  "Queue" = "Geometry+0" "IsEmissive" = "true"  }
    14.         Cull Off
    15.         CGPROGRAM
    16.         #pragma target 3.0
    17.         #pragma surface surf Standard keepalpha noshadow vertex:vertexDataFunc
    18.         struct Input
    19.         {
    20.             float2 texcoord_0;
    21.         };
    22.  
    23.         uniform sampler2D _Star;
    24.         uniform float _BGlobal;
    25.  
    26.         void vertexDataFunc( inout appdata_full v, out Input o )
    27.         {
    28.             UNITY_INITIALIZE_OUTPUT( Input, o );
    29.             o.texcoord_0.xy = v.texcoord.xy * float2( 1,1 ) + float2( 0,0 );
    30.         }
    31.  
    32.         void surf( Input i , inout SurfaceOutputStandard o )
    33.         {
    34.             float4 temp_output_9_0 = ( tex2D( _Star, i.texcoord_0 ) * _BGlobal );
    35.             o.Albedo = temp_output_9_0.rgb;
    36.             o.Emission = temp_output_9_0.rgb;
    37.             o.Alpha = 1;
    38.         }
    39.  
    40.         ENDCG
    41.     }
    42.     CustomEditor "ASEMaterialInspector"
    43. }
    44. /*ASEBEGIN
    45. Version=13201
    46. 9;-679;1266;661;1531.347;777.4002;1.561659;True;False
    47. Node;AmplifyShaderEditor.TextureCoordinatesNode;2;-1020.843,-369.0287;Float;False;0;-1;2;3;2;SAMPLER2D;;False;0;FLOAT2;1,1;False;1;FLOAT2;0,0;False;5;FLOAT2;FLOAT;FLOAT;FLOAT;FLOAT
    48. Node;AmplifyShaderEditor.SamplerNode;1;-760.42,-444.9084;Float;True;Property;_Star;Star;0;0;None;True;0;False;white;Auto;False;Object;-1;Auto;Texture2D;6;0;SAMPLER2D;;False;1;FLOAT2;0,0;False;2;FLOAT;0.0;False;3;FLOAT2;0,0;False;4;FLOAT2;0,0;False;5;FLOAT;1.0;False;5;COLOR;FLOAT;FLOAT;FLOAT;FLOAT
    49. Node;AmplifyShaderEditor.RangedFloatNode;10;-834.845,-247.9981;Float;False;Global;_BGlobal;_BGlobal;1;0;1;0;0;0;1;FLOAT
    50. Node;AmplifyShaderEditor.SimpleMultiplyOpNode;9;-392.8973,-354.1901;Float;False;2;2;0;COLOR;0,0,0,0;False;1;FLOAT;0,0,0,0;False;1;COLOR
    51. Node;AmplifyShaderEditor.StandardSurfaceOutputNode;0;-186.3432,-379.2458;Float;False;True;2;Float;ASEMaterialInspector;0;0;Standard;Startest;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;False;Off;0;0;False;0;0;Opaque;0.5;True;False;0;False;Opaque;Geometry;All;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;True;False;0;255;255;0;0;0;0;False;0;4;10;25;False;0.5;False;0;Zero;Zero;0;Zero;Zero;Add;Add;0;False;0;0,0,0,0;VertexOffset;False;Spherical;True;Relative;0;;-1;-1;-1;-1;0;0;0;15;0;FLOAT3;0,0,0;False;1;FLOAT3;0,0,0;False;2;FLOAT3;0,0,0;False;3;FLOAT;0.0;False;4;FLOAT;0.0;False;5;FLOAT;0.0;False;6;FLOAT3;0,0,0;False;7;FLOAT3;0,0,0;False;8;FLOAT;0.0;False;9;FLOAT;0.0;False;10;OBJECT;0.0;False;11;FLOAT3;0,0,0;False;12;FLOAT3;0,0,0;False;14;FLOAT4;0,0,0,0;False;15;FLOAT3;0,0,0;False;0
    52. WireConnection;1;1;2;0
    53. WireConnection;9;0;1;0
    54. WireConnection;9;1;10;0
    55. WireConnection;0;0;9;0
    56. WireConnection;0;2;9;0
    57. ASEEND*/
    58. //CHKSM=BEC1B00E55950A67E8DD3BD9C4138A6ABC55605B
     
  41. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    when you have a material, unity offers the possibility to access its shader, after that you can access the properties of this shader. unity offer also a good function that tells you if a property exists or not, you enter the name and the function tell you if the property exists.

    I think I will do a node with a string field and a material field, in the string field the user enters the name of the property he wants to get or set, if the property does not exist the node will tell him, however, if the property exists, the node will be expanded with other parts letting the user get or set the property.
     
    Kennth likes this.
  42. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    thats sounds like it would be great. looking forward to using it. i`m going to be working on some procedural material implementation this week so hopefully i will get you some good feedback on ease of use and implementation.

    Another question. would it be possible to have a setting or node to allow some scripts to function in the editor? so some functions are available when not in play mode. A great deal of the scripting i will be doing is just setting multiple materials and shaders with consistent values, and it would be very useful to be able to do this without having to run the whole project
     
    Last edited: Oct 11, 2017
  43. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    I am currently trying to find a way to find what material is on the game object the diamond script is on. the get material node seems entirely redundant as it has a material as the input. surely it needs a game object as an input.


    also i am trying to get some data from the name of the object the script is on. this in numeric data, i can isolate the string of numbers using the string functions, but i cant convert them to a number float or integer.
     
    Last edited: Oct 11, 2017
  44. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Most of the nodes are designed to run in editor to be able to test them. Some nodes aren't because they hold functions that are play mode only. Play your logic and click 'do it' to know immediately if the node is playable in editor.

    Here is how you can get and set material and shared material of an object, is by using the component renderer node:
    ComponentRendererGetMaterial.png

    This kind of things I was talking about when making high-level nodes, in high-level nodes you don't need to search the component renderer to get or set your material, you will just use a gameobject and tell to diamond, I want to get its material, and diamond will search itself for the component renderer, and if he didn't find it he will ask you to add one.

    transform a string to a number isn't available yet in diamond, but I can suggest a solution for your case, If I understood, you want to identify your objects, you can do that by creating a little graph and attach its generated script to your objects. This graph holds the id of your object (this id can be integer or string) that you can send whenever you want by the transfer data system and listen to it whenever and wherever in your project. If you don't consume the data you have to send it only once.
    Maybe my suggestion will not work because I don't know exactly the logic of your project.
     
    Kennth and Barada like this.
  45. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    my point was being able to write scripts that run in the editor, not nodes.

    maybe just making some things easier to find would be enough. I knew what i wanted to do, just didnt know the naming structure to find it. i assumed there would be a "get material" somewhere, but its the two part structure for finding things that is the problem. your planned search function would fix this of course.

    Is the send data and listen function available in code? would it be possible to get a sample of code that i could give to our programmers to allow them to set data variables in diamond scripts? at the moment i have said we can use globals, but we will also be using instanced prefabs that would need local variables setting.
     
  46. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    doing editor scripts is not available for now in diamond.

    you have right, the 2 stages structure make finding things difficult, so we began to think about high-level nodes where the user think what he wants to do and diamond will adapt itself. In the upcoming high-level nodes, we can have multistage naming structures, but organized by functionality and theme subjects, for example, if you want to move an object, the first thing to select will be "physics" and the sub-selection will be "move". for your case it will be like following, firstly you chose "rendering" and in sub-selection you choose "set / get material".

    listen and send data are available in code, in the editor, they communicate between graphs, in code, they communicate between scripts generated by these graphs.
    Scripts generated by diamond are fully compatible with unity projects, you can use them in another project that doesn't have diamond in it,
    when you copy past your diamond scripts, make sure to copy all scripts generated by a graph, and when your diamond scripts are passed in the new project, they may ask you for another premade scripts that they need, and these premade scripts are here:
    scriptsOutWithDiamondScripts.png
     
  47. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    you started off right. the adaptable node setup by function rather than structure is so much easier, but then talking about still selecting 2 elements in the naming structure makes that redundant. infact that just sounds like changing the names. From the users point of view, if they can think what function they are after, they dont want to have to think about finding it. all that is needed is having all actual commands unique and searchable. the best process being something like : the user thinks of what command they want. Add a node. auto selected search box on the node. user starts to type " s e t m a" the drop down list continuously auto sorts the commands. click set material on the drop down list. the node sets itself to that command. most of the time the user will entirely ignore the main group the command is in. they dont care if its a transform or render component. No new type of node, no dual system (high, low level nodes) just self setting nodes with search boxes.

    sorry this doesnt answer my question. this may be a language problem. It realy is just is there a something special that needs to be written in the unity script for it to set a diamond script variable that is being listened for?
     
  48. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    Yes, a search feature will help well, put things in categories prevent from having long popup lists in the node. I like your idea to apply the search word on anything that can be used and let diamond propose to the user the version of the node that feet the search.

    I think that I haven't understood your question yet, could you please explain your need to me with a little example.
     
  49. Barada

    Barada

    Joined:
    Apr 27, 2015
    Posts:
    99
    one of our programmers is generating some complex data using a compute shader. I`m hoping to use diamond to set some values in a procedural material based on this data, and also some shader variables when thats available. i need to do some conversion of these settings. some of these values are shared, and i believe can be set as global variables in any script, but others are unique to the specific instance of the prefab the diamond script is on. it realy is just passing a variable from a c# script to a compiled diamond script.
     
  50. maz_dev

    maz_dev

    Joined:
    Sep 23, 2012
    Posts:
    261
    there are no diamond scripts, diamond generates C# scripts, if a programmer takes a look at the generated scripts he will understand quickly what they do and how to deal with them (don't hesitate to ask me questions about the generated scripts and their structure). So he can expand these scripts by adding in them any kind of variables (static, dynamic, local, global, public, private), he can also access shader variables by using the class Material which contains methods to access the corresponding shader properties (the shader used by the material):

    https://docs.unity3d.com/ScriptReference/Material.html

    this is for surface shaders (like the standard one of unity) these shaders are attached to a material, so we can access their properties via the Material class.

    For compute shaders things are different, the developer needs to organize his variables in data structures (buffers, etc..) to communicate between C# (CPU) and DirectCompute program (GPU).
    Dealing with DirectCompute will come later in damond.

    For now, in diamond, I am working on accessing properties in surface shaders, I am also working on accessing the enum property in procedural materials, these two features will come soon with the next diamond 1.1.6