Search Unity

Question Sample Texture3D

Discussion in 'Visual Effect Graph' started by OuroborosDraconis, Nov 2, 2022.

  1. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    Hi, can anybody tell me how the output of the sample texture3D node looks like in its structure?

    upload_2022-11-2_14-0-45.png

    To use it for setting the color it works like I expect its doing.

    But when I use the same value to also adjust the alpha value, then it seems to work not as I expect. Red Color seems to be less effected then Blue.

    Any Idea whats happening here?
     
  2. OrsonFavrel

    OrsonFavrel

    Unity Technologies

    Joined:
    Jul 25, 2022
    Posts:
    194
    Hello.
    From what I can see, you

    Hello.
    I don’t really understand why you’re trying to achieve so don’t hesitate to give more information
    So that I can help you further.
    What I can say regarding the “alpha” by looking at your graph is that you are multiplying the “Output Color” of the Text3D by itself.
    By doing so, each component of your color is Multiply by itself.

    Example with a color “a”:
    a = {0.33, 0.6 ,0.75 ,1} ;
    a*a = {a.x * a.x, a.y * a.y , a.z * a.z, a.w * a;w } ;
    a*a = {0.33*0.33 , 0.6*0.66 ,0.75*0.75 ,1*1};
    a*a = {0.1089, 0.36, 0.5625, 1};

    So when you plug the output of your “Text3d” which is a Vector4 in the “Color” only the first three components are being kept as “Color”.
    But when plugging your “Text3d” in the “Alpha '' that is a Float, only the first component is being kept when doing the conversion from vector4 to float.
    So only the Red/X component of the Texture3d is kept.

    Don’t really know if my explanation will help you, but as said earlier don’t hesitate to give us more context about what you want to achieve.
    Have a great day.
     
  3. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    Yes it partly explains my problem I think. When I have my texture in Filter Mode: "Bilinear", It somehow seems to work with all 3 colors. While the red color seems to be less affected by the alpha channel and blue is stronger affected.
    When I am using the Filter Mode: "Point" then yes, the other colors are completely gone and I only have red.
    But thanks, I think with that Input I get further.

    (The reason why I square it = multiply by itself, is that I wanted to make the impact of the the alpha value stronger for lower values then for higher. For example a color value of 0.5 gets reduced stronger and becomes like that 0.25, while a higher value of 0.9, nearly stays the same and becomes 0.81, so the Idea was to set the alpha channel corresponding to the ?intensity?)

    An other question:
    I just realized that by using the example code from: https://docs.unity3d.com/Manual/class-Texture3D.html
    the generated Texture says it has the format RGBA8 and not RGBA32. How comes?

    Unity Manual:
    upload_2022-11-3_12-14-22.png

    My received Tex3D:
    upload_2022-11-3_12-15-47.png
    My Code:
    I'm aware that my if-statements are not solved in the most efficient way, but I think they are not causing the problem I have. And the "..." is just a longer comment for myself that has no influence on the code itself.
    upload_2022-11-3_14-1-59.png

    And an other observation:
    Is it true that the the "Sample Texture3D node" is using RGB, while the "Set Color" component of the "Initialize Particle Box" is using CMY?
     
  4. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    Here a Picture of my Particle Effect when using the above mentioned method for the Alpha Channel:

    MyTex3DTexture Filter Mode: Point

    upload_2022-11-3_15-1-2.png


    MyTex3DTexture Filter Mode: Bilinear

    upload_2022-11-3_15-4-15.png
     
  5. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    I still could need some helpfull input regarding my above mentioned question:

    does anybody know why this happens?
     
  6. Qriva

    Qriva

    Joined:
    Jun 30, 2019
    Posts:
    1,314
    Maybe not exactly the answer as I am confused myself by all this (never done deeper research), but there are like 3 (or even 4?) different format types used for different things. One is texture format you used, the other one is used for render textures, there is also graphics format and possibly even one more. Anyway what you provided is not exactly what is displayed in the inspector. Long story short it says how your texture is stored, compressed, bla bla and if you check description of RGBA32 it clearly says it has 8 bits per channel (32 in total), so what you can see in the inspector actually matches.

    If you use texture only to color things it's totaly enough, but usually not enough to represent position - in this case signed float (or half) is way better and in TextureFormat it corresponds to RGBAFloat or R32G32B32A32_SFloat for GraphicsFormat.
     
  7. OuroborosDraconis

    OuroborosDraconis

    Joined:
    Oct 4, 2022
    Posts:
    49
    I understand why its confusing. But I take your explenation as it is. If I define the format of a texture3D as RGBA32 then it is shown in the Inspector as RGBA8.
    Thanks Qriva