FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

How to deal with transparent objects?

3 posters

Go down

How to deal with transparent objects? Empty How to deal with transparent objects?

Post  Hector_2009 Mon Sep 14, 2009 4:34 pm

Currently solid object disables alpha tests. Is there a good way to have some objects with alpha test enabled?


Thanks

Hector_2009

Posts : 9
Join date : 2009-06-20

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  Francescu Mon Sep 14, 2009 4:54 pm

Have you checked tutorial04 (video & code)?

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  Hector_2009 Mon Sep 14, 2009 7:06 pm

Yes. The problem is in the following function:

//================================
//================================
//================================
void sio2ObjectUpdateType( SIO2object *_SIO2object )
{
unsigned int i = 0;

SIO2object *tmp = _SIO2object->_SIO2instance ? ( SIO2object * )_SIO2object->_SIO2instance : _SIO2object;

_SIO2object->type = SIO2_OBJECT_SOLID;

while( i != tmp->n_vgroup )
{
if( tmp->_SIO2vertexgroup[ i ]->_SIO2material )
{
if( tmp->_SIO2vertexgroup[ i ]->_SIO2material->blend &&
!tmp->_SIO2vertexgroup[ i ]->_SIO2material->alvl )
{
sio2DisableState( &_SIO2object->type, SIO2_OBJECT_SOLID );
sio2EnableState ( &_SIO2object->type, SIO2_OBJECT_TRANSPARENT );
}

else if( tmp->_SIO2vertexgroup[ i ]->_SIO2material->alvl )
{
//sio2DisableState( &_SIO2object->type, SIO2_OBJECT_SOLID );
sio2EnableState( &_SIO2object->type, SIO2_OBJECT_ALPHA_TESTED );
}
}

++i;
}
}
//================================
//================================
//================================

Had to comment out the line as indicated above to have stuff shown. (//sio2DisableState( &_SIO2object->type, SIO2_OBJECT_SOLID )Wink
After that the screen flicking sometimes, especially when scenes change.

Hector_2009

Posts : 9
Join date : 2009-06-20

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  sio2interactive Mon Sep 14, 2009 7:23 pm

Check the source code of tutorial04 you are definetly missing the point... you shoudn't change that function AT ALL... there's 3 type of object


solid
transparent
and alpha tested...

Check the sio2ResourceRender masks...
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  Hector_2009 Wed Sep 16, 2009 4:01 pm

Tutorial 4 does work. However when I test my character, which has transparent parts, in tuturial 15, nothing shows. After I comment out the line

//sio2DisableState( &_SIO2object->type, SIO2_OBJECT_SOLID );

the scene does showup.
Also tried sio2ResourceRender with SIO2_RENDER_ALPHA_TESTED_OBJECT in tutorial 15 and the display is totally black ...

Hector_2009

Posts : 9
Join date : 2009-06-20

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  sio2interactive Wed Sep 16, 2009 5:05 pm

First of all do you understand the difference between the 3? Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  Hector_2009 Wed Sep 16, 2009 5:23 pm

solid : No alpha
transparent : Alpha blend
and alpha tested... : alpha test

rt?

Hector_2009

Posts : 9
Join date : 2009-06-20

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  sio2interactive Wed Sep 16, 2009 5:44 pm

Ok now do you understand the rendering order of these? Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  Hector_2009 Thu Sep 17, 2009 1:29 am

solid : No alpha, no sorting necessary
transparent : Alpha blend, sorted by distance (usually)
and alpha tested... : alpha test, no sorting necessary if using the same alpha test value

Hector_2009

Posts : 9
Join date : 2009-06-20

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  sio2interactive Thu Sep 17, 2009 4:08 am

Ok then you're all set Wink

Make sure that you're objects have the good properties and render them Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

How to deal with transparent objects? Empty Re: How to deal with transparent objects?

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum