# Thread: Vertex alpha 0.0 - 4.0 ?

1. ## Vertex alpha 0.0 - 4.0 ?

Hi gurus

Is it possibe to mulitply alpha values with a constant (4)?
The range 0.0 to 1.0 is too small.

In the end alpha values must be clamped 0.0-1.0 (of course).

A vertex program? a fragment shader?

2. ## Re: Vertex alpha 0.0 - 4.0 ?

A vertex program or a fragment program, maybe something else. It depends...

3. ## Re: Vertex alpha 0.0 - 4.0 ?

Is the range between 1.0 and 0.0 to small? Are you using floats or doubles or what? By increasing 0.00001 to 0.0 you'll get a decent ( :-) ) range of numbers between 0.0 and 1.0.
Perhaps I dind't get the question. ;-)

4. ## Re: Vertex alpha 0.0 - 4.0 ?

Where in the fragment pipe do you want to multiply?

With register combiners, you can scale input values; this can be used to expand given data.

With ARB_fragment_program, multiplication is trivial.

You can use a look-up texture, that takes a value in the range [0,1] and returns whatever you want; for example you could have a Luminance texture where the range [0,0.25] maps to [0,1] and [0.25,1] maps to 1.

You can also pass in data in almost arbitrary ranges as texture coordinates, depending on what you want to do with it.

5. ## Re: Vertex alpha 0.0 - 4.0 ?

Hi
I want the formula:
final_alpha_to_clamp=diffuse_alpha*texture_alpha*4 ;

If I have two verteces, one with diffuse alpha=1.0 and the other diffuse alpha=0.0.
I want the final alpha to span 0.0-1.0 range almost from one vertex to the other.

6. ## Re: Vertex alpha 0.0 - 4.0 ?

All the methods I suggested will achieve that. Including the ramp look-up.

7. ## Re: Vertex alpha 0.0 - 4.0 ?

Thank you very much

This "look-up texture" How does it work?

About the other two methods is it possibe to get some examples ? (I am not an advanced programmer)

(I have some old work at "home.bip.net/frl_linder")

8. ## Re: Vertex alpha 0.0 - 4.0 ?

Baron3D, I'm still not quite sure what y ou mean by "The range 0.0 to 1.0 is too small."

As for look-up texture, people are talking about dependent texture fetches (I think). Essentially it's the fragment program equivalent of foo[bar[x]] where foo and bar are textures.

9. ## Re: Vertex alpha 0.0 - 4.0 ?

Hi
In a triangle I have two verteces, one with diffuse alpha=1.0 and the other diffuse alpha=0.0
If I use a texture with alpha values 0.25 to 1.0 :
At the first vert. ALL alpha values should be clamped to 1.0
At the second vert. ALL alpha values should be clamped to 0.0
In between the two verteces alpha values should be in range 0.0 to 1.0

I'm trying to do a more realistic transission between different textures in my landscape.
Using some sort of "texture splatting"

10. ## Re: Vertex alpha 0.0 - 4.0 ?

Baron3D, looking at page 403 of the red book (table 9-4), It looks like a base internal format of GL_RGBA with modulate texture function, if you set the vertices in question to (1,1,1,4*a), where a is the alpha you want, you'd get a resultant color of C_t, the texture color, and a resultant alpha of 4*a*A_t, which is what you describe above. It would then be clamped.

Does that sound right?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•