Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8469287
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:11:06+00:00 2026-06-10T16:11:06+00:00

Can someone tell me whats the difference between these 2 fragment shaders: // Adobe’s

  • 0

Can someone tell me whats the difference between these 2 fragment shaders:

// Adobe's GPUSprite Fragment Shader 
"tex ft0, v0, fs0 <2d,clamp,linear,mipnearest> \n" + 
"mul ft0, ft0, v0.zzzz\n" +  // multiply with alpha?? 
"mov oc, ft0 \n"

// Node2D Fragment Shader 
"tex ft0, v0, fs0 <2d,clamp,linear,mipnearest> \n" + 
"mul ft0, ft0, fc0\n" + // this line is different
"mov oc, ft0 \n" 

Only the second line is different, where we multiply it with alpha.
As a result, the second shader(Node2D) allows you to pass in a master alpha value via a setProgramConstantsFromVector(Context3DProgramType.FRAGMENT, 0, [1,1,1,1]); call, which will result in all triangles to be drawn with that alpha.

1) Can someone tell me whats happening in that 2nd line?

2) What the above does in practice, is that it Overrides the individual alpha settings of each triange. What I would like instead is to Multiply its own alpha with the shader’s, so that the final alpha value would be = Triangle_alpha * Shader_alpha.

(as it is now I cannot set a separate alpha value for specific triangles with the second shader. What I would like is to be able to set an alpha value for each triangle separately and also another for the entire drawTriangles call )

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:11:08+00:00Added an answer on June 10, 2026 at 4:11 pm

    I would like to revise my answer, because the original was not correct.

    "mul ft0, ft0, v0.zzzz\n"
    

    is multiplying the fragment RGBA by the third component of the value stored in Varying Register 0. This is probably the vertex coordinates, passed to the Fragment Shader from the Vertex Shader. This line should cause the the color to lighten, the farther away it is from the camera.

    "mul ft0, ft0, fc0\n"
    

    is multiplying the fragment RGBA by a RGBA value uploaded into the Fragment Constant 0. The lighter/more transparent the color in the constant is, the lighter/more transparent your final value will be.

    If you only want to change the alpha, you could try:

    "mul ft0.a, ft0.a, fc0.a\n"
    

    If you want to just combine the alphas you could try adding instead of multiplying.

    "add ft0.a, ft0.a, fc0.a\n"
    

    You can specify separate alpha values for each triangle by putting an alpha component in each vertex. You could combine these values with the “global” alpha which you could store in a constant, before combining them with the Fragment Alpha. The only problem, is that you will have to duplicate vertices, if they have different alpha values.

    So your vertices for an example triangle would go from:

    var vertices:Vector.<Number> = Vector.<Number>([
        //x, y, z, w,
        0, 0, 0, 0,
        1, 0, 0, 0,
        0, 1, 0, 0,
    ]);
    
    vertexBuffer:VertexBuffer3D = context3D.createVertexBuffer(3, 4);
    vertexBuffer.uploadFromVector(vertices, 0, 3);
    

    to:

    var vertices:Vector.<Number> = Vector.<Number>([
        //x, y, z, w, a
        0, 0, 0, 0, 0.5,
        1, 0, 0, 0, 0.5,
        0, 1, 0, 0, 0.5,
    ]);
    
    vertexBuffer:VertexBuffer3D = context3D.createVertexBuffer(3, 5);
    vertexBuffer.uploadFromVector(vertices, 0, 3);
    

    Then you would pass the alpha value from your Vertex Shader to your Fragment Shader through a Varying Register, where you can make use of it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can someone tell me what the difference is between these two conventions for getting
Can someone tell me what is the difference between these two: ALTER TABLE x1
Can someone tell me the difference between these two versions of a declaration of
Can someone tell me what's the difference between a .profile and a .make file
Can someone tell me what is the difference between active and passive FTP? Which
Can someone tell me the exact difference between node() and element() types in XQuery?
can someone tell me what the difference between assigning event handlers using bind(): $(function
I am wondering if someone can tell me the difference between Z3 and coq?
Can someone tell me what the difference is between the 2 JSON parsers? https://github.com/douglascrockford/JSON-js/blob/master/json.js
can someone tell me what the difference is between [(id)Object class] and object_getClassName(id Object)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.