Welcome, Unregistered.

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.

Reply
Old 13-Oct-2012, 19:08   #1
nv_dv
Junior Member
 
Join Date: Feb 2006
Location: galaxy
Posts: 25
Default blending /depth_test

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.
nv_dv is offline   Reply With Quote
Old 13-Oct-2012, 20:04   #2
3dcgi
Senior Member
 
Join Date: Feb 2002
Posts: 2,019
Default

Look for a method titled order independent transparency with linked lists. AMD published details about a method and Intel has as well.
3dcgi is offline   Reply With Quote
Old 14-Oct-2012, 03:12   #3
nv_dv
Junior Member
 
Join Date: Feb 2006
Location: galaxy
Posts: 25
Default

Thanks, good thing i wont have to worry about the other platform
nv_dv is offline   Reply With Quote
Old 14-Oct-2012, 23:46   #4
Davros
Darlek ******
 
Join Date: Jun 2004
Posts: 9,497
Default

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™
Davros is offline   Reply With Quote
Old 15-Oct-2012, 12:35   #5
MrGaribaldi
Member
 
Join Date: Nov 2002
Location: In transit
Posts: 604
Default

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"
MrGaribaldi is offline   Reply With Quote
Old 15-Oct-2012, 12:54   #6
nv_dv
Junior Member
 
Join Date: Feb 2006
Location: galaxy
Posts: 25
Default

Quote:
Originally Posted by Davros View Post
That reply makes it sound like you think the above solutions will not work on nv hardware
not at all , i was reffering the other platform as an old embded system using a PVR gpu
apparently there's automatic OIT support in hardware

@MrGaribaldi
thanks

Last edited by nv_dv; 15-Oct-2012 at 13:01.
nv_dv is offline   Reply With Quote
Old 15-Oct-2012, 13:03   #7
Rodéric
a.k.a. Ingenu
 
Join Date: Feb 2002
Location: Apsley, U.K.
Posts: 2,729
Default

Quote:
Originally Posted by nv_dv View Post
not at all , i was reffering the other platform as an old embded system using a PVR gpu
apparently there's automatic OIT support in hardware

@MrGaribaldi
thanks
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...
Rodéric is offline   Reply With Quote
Old 12-Nov-2012, 16:57   #8
Dominik D
Member
 
Join Date: Mar 2007
Location: Wroclaw, Poland
Posts: 578
Default

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.
Dominik D is offline   Reply With Quote
Old 12-Nov-2012, 17:42   #9
frogblast
Junior Member
 
Join Date: Apr 2008
Posts: 76
Default

Quote:
Originally Posted by Dominik D View Post
OIT is supported on SGX as long as depth writes are disabled. (AFAIK)
Nope. I think Imagination stopped doing OIT way back sometime in the dreamcast timeframe.

Current Imagination devices will always blend strictly in submission order, just like every other GPU (and like OGL/D3D mandate).
frogblast is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:21.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.