If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.
![]() |
|
|
#1 |
|
Junior Member
Join Date: Feb 2006
Location: galaxy
Posts: 25
|
trying to render multiple aplha maps ONE_MINUS_SRC.... but
blending seems to only works with object rendered from back to top eg: A is rendered before B , but B is lower (on depth_test) ![]() /////////////////////////////// Render tree (stock) ///////////////////////////////// Code:
vtx_smap(){
extern m_cnt,m_start;
extern f_cnt,f_start;
struct vtx_flg *rend;
struct vtx_map *midx;
struct vtx *vec;
uint x,i,j;
rend= f_start;
midx= m_start;
vec= v_start;
//----------------------------------------- LAYER
for( x=0; x < activl ; x++){
////// texture
if( rend->flg&VL_TEX){
activtex( rend->rsd, rend->tex);
glEnable( GL_TEXTURE_2D);
}
///////////////////////////////
if( rend->flg&VL_RS) glDepthMask( GL_FALSE);
//////////////////////////////
////////// blend
if( rend->flg&VL_MASK ){
glEnable( GL_BLEND);
/* high_light */
if( rend->flg&VL_LONL) glBlendFunc( GL_SRC_ALPHA, GL_ONE);
/* alpha channel */
if( rend->flg&VL_AC) glBlendFunc( GL_SRC_ALPHA , GL_ONE_MINUS_SRC_ALPHA);
/* overlay */
if( rend->flg&VL_OL) glBlendFunc( GL_DST_COLOR, GL_DST_COLOR);
}
glBegin( GL_TRIANGLE_STRIP);
for( i= 0; i < rend->idxL; i++){ //IDXL
for( j= 1; j < midx->idx ;j++)
if( j < v_cnt)
vec= vec->next;
if( rend->flg&VL_SUV)
glTexCoord2f( midx->s, midx->t);
else
glTexCoord2f( vec->s, vec->t);
if( rend->flg&VL_SRGB)
glColor4ub( midx->r, midx->g, midx->b, midx->a);
else
glColor4ub( vec->r, vec->g, vec->b, vec->a);
glVertex3f( vec->x, vec->y, vec->z);
vec= v_start;
midx= midx->next;
}//--------------------------- IDXL
glEnd();
////////////////////////////
if( rend->flg&VL_TEX) glDisable( GL_TEXTURE_2D);
///////////////////////////////
if( rend->flg&VL_RS) glDepthMask( GL_TRUE);
//////////////////////////////
if( rend->flg&VL_MASK) glDisable( GL_BLEND);
rend= rend->next;
}//f_cnt -----------------------LAYER
}
init() ---------------------------------------------------------------------------- glClearColor( r, g, b, a); //default bg //default matrix is on modelview //glMatrixMode( GL_MODELVIEW); //default //glLoadIdentity(); glPerspecv( view); //NEHE set_vpos( v_pos); //set cam glCullFace( GL_BACK); glPointSize( 1.5); glEnable( GL_CULL_FACE); -------------------------------------------------------------------------------- render() -------------------------------------------------------------------------------------------- glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT ); extern float v_pos[3]; //view pos (z) glPushMatrix(); ////////////////////// view dist set_vpos( v_pos); //////////////////////////////// glRotatef( rt[0], 1.0,.0,.0); glRotatef( rt[1], .0,1.0,.0); glTranslatef( wt[0], wt[1], wt[2]); glPushMatrix(); /////////////////////////////////////////////////////// glEnable( GL_DEPTH_TEST); vtx_smap(); //<---------------------- render tree + enable/disable Blend glDisable( GL_DEPTH_TEST); /////////////////////////////////////////////////////// glPopMatrix(); glPopMatrix(); vtx_menu( -0.55,0.12,1,28); cursor( tool); ================================================= is there any way you can correctly blend surfaces regardless of rendering order Last edited by nv_dv; 14-Oct-2012 at 03:11. |
|
|
|
|
|
#2 |
|
Senior Member
Join Date: Feb 2002
Posts: 2,019
|
Look for a method titled order independent transparency with linked lists. AMD published details about a method and Intel has as well.
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Feb 2006
Location: galaxy
Posts: 25
|
Thanks, good thing i wont have to worry about the other platform
|
|
|
|
|
|
#4 |
|
Darlek ******
Join Date: Jun 2004
Posts: 9,497
|
That reply makes it sound like you think the above solutions will not work on nv hardware
__________________
Guardian of the Most holy Two Terabytes of Gaming Goodness™ |
|
|
|
|
|
#5 |
|
Member
Join Date: Nov 2002
Location: In transit
Posts: 604
|
As 3dcgi says, both AMD and intel have papers on this, with slightly different approaches.
Here is a nice presentation, with informative pictures, of AMDs solution. And here you can find Intels GDC presentation and source code. But I recommend that you look at what Cyril Crassin has done, since he too is using OpenGL. You should be able to re-implement it with standard OpenGL, and if you want to save space you can use intels AT approach with it.
__________________
"Artificial Intelligence can never replace Human Stupidity" |
|
|
|
|
|
#6 | |
|
Junior Member
Join Date: Feb 2006
Location: galaxy
Posts: 25
|
Quote:
, i was reffering the other platform as an old embded system using a PVR gpuapparently there's automatic OIT support in hardware @MrGaribaldi thanks Last edited by nv_dv; 15-Oct-2012 at 13:01. |
|
|
|
|
|
|
#7 |
|
a.k.a. Ingenu
Join Date: Feb 2002
Location: Apsley, U.K.
Posts: 2,729
|
That would be a Dreamcast or a Naomi arcade board, as they are the only ones featuring that capability. (AFAIK)
__________________
So many things to do, and yet so little time to spend... |
|
|
|
|
|
#8 |
|
Member
Join Date: Mar 2007
Location: Wroclaw, Poland
Posts: 578
|
OIT is supported on SGX as long as depth writes are disabled. (AFAIK)
__________________
Shifty Geezer: I don't think the guy really understands the subject. PARANOiA: To be honest, Shifty, what you've described is 95% of Beyond3D - armchair experts spouting fact based on the low-level knowledge of a few. This posting is provided "AS IS" with no warranties, and confers no rights. |
|
|
|
|
|
#9 | |
|
Junior Member
Join Date: Apr 2008
Posts: 76
|
Quote:
Current Imagination devices will always blend strictly in submission order, just like every other GPU (and like OGL/D3D mandate). |
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|