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.

Material sharing

2 posters

Go down

Material sharing Empty Material sharing

Post  william 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

Back to top Go down

Material sharing Empty Re: Material sharing

Post  sio2interactive 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...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Material sharing Empty Re: Material sharing

Post  william 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

Back to top Go down

Material sharing Empty Re: Material sharing

Post  sio2interactive 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.
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Material sharing Empty Re: Material sharing

Post  william 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

Back to top Go down

Material sharing Empty Re: Material sharing

Post  sio2interactive 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...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Material sharing Empty Re: Material sharing

Post  william 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

Back to top Go down

Material sharing Empty Re: Material sharing

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