How to deal with transparent objects?
3 posters
How to deal with transparent objects?
Currently solid object disables alpha tests. Is there a good way to have some objects with alpha test enabled?
Thanks
Thanks
Hector_2009- Posts : 9
Join date : 2009-06-20
Re: How to deal with transparent objects?
Have you checked tutorial04 (video & code)?
Francescu- Posts : 136
Join date : 2009-03-18
Re: How to deal with transparent objects?
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 )
After that the screen flicking sometimes, especially when scenes change.
//================================
//================================
//================================
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 )
After that the screen flicking sometimes, especially when scenes change.
Hector_2009- Posts : 9
Join date : 2009-06-20
Re: How to deal with transparent objects?
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...
solid
transparent
and alpha tested...
Check the sio2ResourceRender masks...
Re: How to deal with transparent objects?
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 ...
//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
Re: How to deal with transparent objects?
First of all do you understand the difference between the 3?
Re: How to deal with transparent objects?
solid : No alpha
transparent : Alpha blend
and alpha tested... : alpha test
rt?
transparent : Alpha blend
and alpha tested... : alpha test
rt?
Hector_2009- Posts : 9
Join date : 2009-06-20
Re: How to deal with transparent objects?
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
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
Re: How to deal with transparent objects?
Ok then you're all set
Make sure that you're objects have the good properties and render them
Make sure that you're objects have the good properties and render them
Similar topics
» SIO2widgets with transparent backgrounds
» Transparent Objects
» Proper z-ordering of transparent objects without texture
» duplicating objects at runtime and changing textures on the duplicated objects
» Why md2 can not do a transparent texture?
» Transparent Objects
» Proper z-ordering of transparent objects without texture
» duplicating objects at runtime and changing textures on the duplicated objects
» Why md2 can not do a transparent texture?
Permissions in this forum:
You cannot reply to topics in this forum