Material sharing

View previous topic View next topic Go down

Material sharing

Post  william on Fri Sep 11, 2009 2:05 am

Hi,

I'd like to have just one material with one texture atlas and share it with my models on scene to save texture bandwidth. If I do this with blender, does sio2 optimize the rendering flow setting only that material once for all the objects that uses it?

william

Posts : 15
Join date : 2009-09-09

View user profile

Back to top Go down

Re: Material sharing

Post  sio2interactive on Fri Sep 11, 2009 2:55 am

Just name your object alphabetically... like lets say that box1, tree1, house1 are using the same material simply name your objects like:

a_box1
a_tree1
a_house1

So you can manually sort the rendering state... its just more convenient for the device...

_________________
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: Material sharing

Post  william on Fri Sep 11, 2009 3:14 am

So instead of calling sio2ResourceRender(...), I've got to set the material by myself and then render the objects one by one with sio2ObjectRender?

william

Posts : 15
Join date : 2009-09-09

View user profile

Back to top Go down

Re: Material sharing

Post  sio2interactive on Fri Sep 11, 2009 3:19 am

No the exporter will sort the object alphabetically and they will also be loaded alphabetically... the only thing you have to do is set your object name in blender that's it and render with sio2ResourceRender...

I know its not ideal, but at least its better than to sort all the rendering list everytime a frame is rendered... and like that you can have control on the order which is kinda cool and can really optimize the rendering loop this way... cause all the object will be rendered (if visible) in the alphabetical order that you specify which apply to the proper type: solid, transparent, alpha.

_________________
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: Material sharing

Post  william on Fri Sep 11, 2009 3:36 am

This is cool! the objects get sorted, Anyway i've taken a look at your sources and I've seen that the material and texture is set everytime an object is rendered: maybe I'm wrong but doing so, doesn't we have a state change every time an object gets rendered?

It would be nice if the renderer sorts the objects per material, then set material+texture and then loop through objects and render them without the state change. What do you think about this?

william

Posts : 15
Join date : 2009-09-09

View user profile

Back to top Go down

Re: Material sharing

Post  sio2interactive on Fri Sep 11, 2009 4:01 am

Like everything else in SIO2 structures will be binded once as long as they are needed... for the machine state they are only changed if needed... nothing is binded twice and nothing no state change will be changed twice... basically the name trick is just to give access to the user to create its own customized rendering list... instead SIO2 will take care of the machine states and rendering optimization...

Check sio2_state.cc for more info, as well as all the rendering functions...

_________________
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: Material sharing

Post  william on Fri Sep 11, 2009 4:05 am

Sweet.

Thank you sio2 and keep up the good work Wink

william

Posts : 15
Join date : 2009-09-09

View user profile

Back to top Go down

Re: Material sharing

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