Why md2 can not do a transparent texture?

View previous topic View next topic Go down

Why md2 can not do a transparent texture?

Post  LuisLee on Wed Sep 23, 2009 1:51 am

in my demo,there is a md2 model,
it have a transparent texture,Is his hair,
But the pictures can not be transparent, and black edges.
texture is hair.tga

How to set Md2 do a transparent texture? thank you!

Very Happy

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 30

View user profile

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  sio2interactive on Thu Sep 24, 2009 1:04 am

Just set the _SIO2material->blend = SIO2_MATERIAL_COLOR for the material where the SIO2image is attached.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  LuisLee on Thu Sep 24, 2009 1:28 am

sio2interactive wrote:Just set the _SIO2material->blend = SIO2_MATERIAL_COLOR for the material where the SIO2image is attached.
thank you!

I tried it, But like this:


There are still black,Black should be transparent,but it did not,I tried SIO2_MATERIAL_ADD, SIO2_MATERIAL_VALUE.......,can not work.
why?
this is my code:





Code:

SIO2Md2  m_pMd2;
m_pMd2 = sio2Md2Init( modelname );      
   m_pMd2->_SIO2material = sio2MaterialInit(texname);         
   sio2Md2Load( m_pMd2, _SIO2stream );      
   m_pMd2->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ] =sio2ImageInit(texname);
   sio2ImageLoad(m_pMd2->_SIO2material->_SIO2image[SIO2_MATERIAL_CHANNEL0],_SIO2stream1);               
               
   m_pMd2->_SIO2material->blend = SIO2_MATERIAL_COLOR;///////////////////////   
   sio2ImageGenId(m_pMd2->_SIO2material->_SIO2image[ SIO2_MATERIAL_CHANNEL0 ],
         NULL, 0.0f );      
      sio2Md2ClearAllAction( m_pMd2 );

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 30

View user profile

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  sio2interactive on Thu Sep 24, 2009 3:31 am

Humm that should work... trace the code to make sure that the necessary blend state are set by SIO2... I never try alpha with MD2 but the material should work the same way as on a SIO2object.

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  LuisLee on Thu Sep 24, 2009 4:04 am

sio2interactive wrote:Humm that should work... trace the code to make sure that the necessary blend state are set by SIO2... I never try alpha with MD2 but the material should work the same way as on a SIO2object.

Thank you for your Reply!I think some of the details wrong.


Very Happy

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 30

View user profile

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  Francescu on Thu Sep 24, 2009 7:32 am

Which rendering flags did you set as part of sio2ResourceRender()?

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  LuisLee on Thu Sep 24, 2009 7:13 pm

Francescu wrote:Which rendering flags did you set as part of sio2ResourceRender()?

Yes,I did.

Code:

sio2ResourceRender( sio2->_SIO2resource,
                    sio2->_SIO2window,
                    sio2->_SIO2camera,
                    SIO2_RENDER_SOLID_OBJECT
                    |SIO2_RENDER_TRANSPARENT_OBJECT                     
                    |SIO2_RENDER_ALPHA_TESTED_OBJECT/////Enable  transparent

LuisLee

Posts : 85
Join date : 2009-04-26
Age : 30

View user profile

Back to top Go down

Re: Why md2 can not do a transparent texture?

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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