alpha clipping

i have two issues.

a) is there no simple way to overwrite depth values based on the alpha component of the pixel? i figured this would be a main stay functionality, but i can’t find it anywhere in opengl on first glance. basicly what i would like to be able to do, is not write a pixel to the depth buffer if its alpha channel would render it invisible.

b) i don’t think this is possible, but would it not be reasonable for hardware to be able to cull a triangle if all of its vertices would be invisible with respect to alpha?

finally, provided functionality(a) does not exist, is there any effecient way to use a pixel shader to to impliment functionality(a)?

and if the features are unsupported? would they not be worth considering for future hardware development. culling a triangle with any invisible vertices would also be a very useful option for stripped soft shaded models, where it could avoid feathering.

sincerely,

michael

found glAlphaFunc… i remembered there was something for this, but i couldn’t come up with any names for the life of me.

is this ever carried over into triangle culling if all vertices have failing alpha values? if so, are there any provisions to be taken in shaders to get this result?

>> culling a triangle with any invisible vertices would also be a very useful option for stripped soft shaded models, where it could avoid feathering.

What do you mean ? By ‘feathering’, do you mean alpha blending ? Simple, desactivate alpha blending. Use only alpha testing, it will be a hard cut.

is this ever carried over into triangle culling if all vertices have failing alpha values?
That would have to be a very specific case: You know the alpha values are all failing after the vertex program, and your fragment program does not modify alpha. This is not exactly a common case.

Originally posted by ZbuffeR:
[b]>> culling a triangle with any invisible vertices would also be a very useful option for stripped soft shaded models, where it could avoid feathering.

What do you mean ? By ‘feathering’, do you mean alpha blending ? Simple, desactivate alpha blending. Use only alpha testing, it will be a hard cut.[/b]
yes, that is what i’m thinking, but unfortunately for what i would like to do, alpha blending is also desirable in the unculled triangles.

i’m basicly thinking about rendering clod clouds on the gpu, by using a few height maps and two passes to fluff the clouds up on the first pass and down on the second pass. the third height map would define the central plane, so that some clouds can be higher than others, or large clouds central plane could vary locally.

the final vertices produced, will also do alpha blending based on the distance of a ray projected through the vertex from the camera too the first exit of the cloud. precomputed and aproximated of course.

space between the clouds (empty space) would produce an alpha saturated vertex. the only remaining problem is vertices along the silhouette will ‘feather’ into the empty space. this effect might be negligible, but the only thing i can think of so far, is to use the unused map data in empty space to offset those vertices so that they will form degenerate triangles… but that in itself is tricky, and subtracts from the robusteness of the method.

to be honest though, i’ve only worked with pixel shaders once, and that was more of a ‘copy paste’ job than anything else. i really don’t fully understand how they work, i’ve been putting off a review. i reviewed them before a long time ago, but i imagine a lot has changed.

is it possible to get the values of the triangle vertices out of pixel programs? or is everything pre-interpolated? if it is possible to access the vertices alpha value, then removing this feathering would be trivial conceptually.

Originally posted by al_bob:
[quote]is this ever carried over into triangle culling if all vertices have failing alpha values?
That would have to be a very specific case: You know the alpha values are all failing after the vertex program, and your fragment program does not modify alpha. This is not exactly a common case.
[/QUOTE]yeah, that is what i figured, but it should be easy for the static pipeline (vertex colour is alpha saturated) … but for shaders it would probably require some set up. the option if implimented would almost definately be a manual option anyhow so to avoid running the test all the time.

Can’t you make drawings/sketchs of your ideas, along with structured explanations, on a website ? Most of your posts are so complex that it is actually very hard to understand you…

Or I am not enough of a ‘native english speaker’ :stuck_out_tongue:

About how shaders work, go play with Shader Designer , there is a bunch of them to test end edit.

Originally posted by ZbuffeR:
[b]Can’t you make drawings/sketchs of your ideas, along with structured explanations, on a website ? Most of your posts are so complex that it is actually very hard to understand you…

Or I am not enough of a ‘native english speaker’ :stuck_out_tongue:

About how shaders work, go play with Shader Designer , there is a bunch of them to test end edit.[/b]
sorry, you feel that way. i actually felt like this post would’ve made more sense in the beginner forum after i thought about it. truth is i should’ve thought about it more first.

i actually downloaded shader designer the other night… haven’t got around to pulling it off the network onto a development machine though.

i just finished reviewing an older Cg manual… i doubt it has changed much though. i couldn’t find anything useful… basicly what i expected. would be nice if you could have vertex attributes passed to shaders available as constants though.

as for drawings or sketches… my thoughts aren’t really worth such effort. they are fairly simple though… or at least i don’t know how to make anything simpler. assuming you are really interested that is and not just being ruthless.

were you that interested in something i said?


here is another crazy idea for anyone who likes puzzles. i’m trying to work out a static SSE sequence to fully subdivide a right triangle tesselation down to about the 6th level. the idea is to do it while only overwriting xmm registers as necesarry while keeping you hands out of the cookie jar ( memory – hopefuly cached )… basicly you start with a triangle, and proceed through a sequence of interdependant midpoint operations. might make a classic futuristic game of mahjong.

The explainations are just not good enough, michael. It doesn’t matter how simple your idea is, if you haven’t the ability to succinctly communicate it to other individuals then it will remain your idea, and any chance of developing the idea in parallel with other people (called team-thinking, or brain-storming) will be impossible. Unless you’re willing to put more effort into your explainations (more effort!=more words), I for one really don’t see the point in you posting here.
However, your cloud idea was not the purpose of your post - your purpose was that you didn’t know about the popular alpha test functionality that’s existed in graphics hardware for a great number of years, since IGL…even Glide. Your mouse pointer hovered over the ‘beginners forum’ button for a fleeting second, before thinking “no goddam it, I’ve got fancy cloud stuff in my head that would spoil stephen hawkings enjoyment of eastenders, I’m no beginner, I’m a genius.”. So here you are again, asking another beginners question in the advanced forum…simply because the project you’re working on could be described as advanced. But the OpenGL question is not advanced.

Originally posted by knackered:
The explainations are just not good enough, michael. It doesn’t matter how simple your idea is, if you haven’t the ability to succinctly communicate it to other individuals then it will remain your idea, and any chance of developing the idea in parallel with other people (called team-thinking, or brain-storming) will be impossible. Unless you’re willing to put more effort into your explainations (more effort!=more words), I for one really don’t see the point in you posting here.
However, your cloud idea was not the purpose of your post - your purpose was that you didn’t know about the popular alpha test functionality that’s existed in graphics hardware for a great number of years, since IGL…even Glide. Your mouse pointer hovered over the ‘beginners forum’ button for a fleeting second, before thinking “no goddam it, I’ve got fancy cloud stuff in my head that would spoil stephen hawkings enjoyment of eastenders, I’m no beginner, I’m a genius.”. So here you are again, asking another beginners question in the advanced forum…simply because the project you’re working on could be described as advanced. But the OpenGL question is not advanced.

yeah you are right about glAlphaFunc… i’ve never needed that sort of functionality, and the only time i saw it before was once when i read straight through all the opengl commands just to see if i might get any ideas. i don’t know why i didn’t do a search for ‘alpha’… i guess i approached the idea from the perspective of the depth buffer api. i really can’t quote gl specifications like a bible. and no i never thought about putting it in the beginner forum. its also nice to get the deeper perspective of more committed users as well.

but in the end i admit, my disposition is pretty casual. if that bothers people so much i will just take a bow and make my exit before any reformation.

no succinct definition does not mean more words… i actually have an internet prescence where most of my work suitable for public consumption can be read about… within the scope of my best attempt at plane spoken concision. but writing like that for me is so difficult and time consuming, that very little can motivate me to do it. i would post a link to that material here. but this forum is too big, and i don’t want that sort of attention right now.

if you really want to find it, go to the domain i referenced in another thread, and look in the ‘users’ directory… but it won’t be that simple. just one more step.

but there is nothing too new there.

and this ‘cloud stuff’ is just an after thought… and no i had no intention of sticking that in here, but some one asked for a better explanation, so i gave some context.

finally i would’ve posted in teh beginner forum, but i was also curious about other matters, like whether triangles might be culled by alpha testing, and shader behavior… and maybe deeper insight into the general domain.

the cloud shader still has a fair flaw where the clouds meet empty sky. if you or anyone really wants to help work through this problem, i would be happy to try to explain it in detail, because i would really like to see it happen.

the shader is actually pretty interesting, and if you are willing to do it without clod, it doesn’t suffer from its only remaining flaw.

anyhow, i am a pretty casual, ‘stream of conscious’ sort… so if you don’t want my type polluting the board, just cast your vote.
sincerely,

michael

PS: just for the hell of saying so, today i’m programming the aformentioned SSE triangle mahjong game. its an interesting puzzler in itself. but too messy to do on paper.