screen door transparency

Hi ,
I have to simulate the screen door transparency with Opengl ES i don’t know how i can do it.
Can i help me ?

You can use projective texturing from the view position and alpha test. Then you need a single channel two-level alpha texture with a dither pattern corresponding to the desired transparency level. And you need to give each vertex a set of texture coordinates identical to its position (since there is no texgen functionality in OpenGL ES).

Of course if you have vertex shader functionality (e.g. PowerVR MBX with VGP) you can derive the required texture coordinates directly from the x/y clip space coordinates of the transformed vertices.
With OpenGL ES 2.0 you could do dithering entirely based on gl_FragCoord in the fragment shader.

I find a command with OpenGL ES glSampleCoverage . In the guide I read that this command simulate the screendoor transparency? What do you think about? thanks
Matteo

That only works when you’re rendering to a surface with multisampling enabled.

If you use two textures you can load your diffuse texture in texture unit 0, and a alpha only texture in texture unit 1.

The alpha texture contains a dither pattern, for example a 16*16 pixel block. This texture will be so small that it will render fast (hopefully - that depends on your GL/ES implementation). Setup a texture matrix that maps screen pixels to uv coordinates for this texture (or use the texgen if you have one).

Then just enable alpha test, and use the alpha-reference value to set your desired transparency. This gives you 256 distinct screen door transparency levels.

For a start, you can try this table as a texture. That gives a nice pseudo Floyed-Steinberg diffusion pattern. Usually that’s good enough.


unsigned char transparencytable[256] =
{ // 16*16 alpha only texture
 192, 11,183,125, 26,145, 44,244,  8,168,139, 38,174, 27,141, 43,
 115,211,150, 68,194, 88,177,131, 61,222, 87,238, 74,224,100,235,
  59, 33, 96,239, 51,232, 16,210,117, 32,187,  1,157,121, 14,165,
 248,128,217,  2,163,105,154, 81,247,149, 97,205, 52,182,209, 84,
  20,172, 80,140,202, 41,185, 55, 24,197, 65,129,252, 35, 70,147,
 201, 63,189, 28, 90,254,116,219,137,107,231, 17,144,119,228,109,
  46,245,103,229,134, 13, 67,162,  6,170, 47,178, 76,193,  4,167,
 133,  9,159, 54,175,124,225, 93,242, 79,214, 99,241, 56,221, 92,
 186,218, 78,208, 37,196, 25,188, 42,142, 29,158, 21,130,156, 40,
 102, 31,148,111,234, 85,151,120,207,113,255, 86,184,212, 69,236,
 176, 73,253,  0,138, 58,249, 71, 10,173, 62,200, 50,114, 12,123,
  23,204,118,191, 91,181, 19,164,216,101,233,  3,135,169,246,152,
 223, 60,143, 48,240, 34,220, 82,132, 36,146,106,227, 30, 95, 49,
  83,166, 18,199, 98,155,122, 53,237,179, 57,190, 77,195,127,180,
 230,108,215, 64,171,  5,206,161, 22, 94,251, 15,153, 45,243,  7,
  72,136, 39,250,104,226, 75,112,198,126, 66,213,110,203, 89,160
};

I have in input the x3d files that draw
Shape{
Material{
transparency

How can i simulate screen door without texture?
I have a attribute added at Shape nodes , an boolean attrbute isTRansparency that mark the nodes during the graph visit.
Can i use the multisampling?

Thank a lot
Matteo

Sorry, I don’t know about the x3d stuff… As far as I know GL/ES you need a second texture to simulate screen door transparency. Threre is no built in feature that does the same.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.