Coming up against a limit for textures…

Software: Away3D 4.x

Mr Margaret Scratcher, Sr. Member
Posted: 14 September 2011 03:40 AM   Total Posts: 344

Error: Error #3691: Resource limit for this resource type exceeded.
at flash.display3D::Context3D/createTexture()

After creating a few hundred cubes with different textures… Any easy way around this? At the moment the textures are 512x512 each, any lowar and they’re going to start looking poor…

I guess I could dynamically resize the textures depending on how near to the camera they are, but then that means keeping smaller versions in membery somewhere, or re-loading, them, right?

   

Avatar
theMightyAtom, Sr. Member
Posted: 14 September 2011 06:52 AM   Total Posts: 669   [ # 1 ]

Yeh, you should probably use some kind of LOD algorithm. The textures in Flash aren’t limited in the same way, only what can be on the GPU at one time. I can see that’s a bummer when you’re making a 3D video store.
Being lazy I would make them all low res until you “picked one up” and it flies out of the shelf in full 2048 glory. But that’s me.

   

John Brookes, Moderator
Posted: 14 September 2011 10:46 AM   Total Posts: 732   [ # 2 ]

What atom said and
Combine 8 textures in to a single 2048 map. And adjust the UVs to match.

   

Mr Margaret Scratcher, Sr. Member
Posted: 14 September 2011 12:49 PM   Total Posts: 344   [ # 3 ]

Yeah, that was the way I had it working in papervision - when I clicked on a DVD to flip it over and have a proper look, it was swapped for a cube with more segments, and then loaded a hi resversion of the cover..


Doing it in one massive, or not so massive bitmap might also solve the problem of performance with 5,000 or so cubes being generated in the back catalogue room - I could merge them and only split them up when the mouse is over their parent shelfset…

Quite a bit of work but it would mean what I’m trying to do would become feasible…

   

Avatar
theMightyAtom, Sr. Member
Posted: 14 September 2011 01:09 PM   Total Posts: 669   [ # 4 ]

Sure, the large bitmaps worth a try (thanks John, I’ll try that myself smile,
but your users are still going to be downloading wacking great chunks of data, most of which they will never look at (for example any film involving chipmunks).

Minimum data to start, extra info when needed.
‘Tis the way of the web jedi…

   

Mr Margaret Scratcher, Sr. Member
Posted: 14 September 2011 01:41 PM   Total Posts: 344   [ # 5 ]

Well, that’s pretty much what is happening at the moment, a low quality version is loaded, then the spine. The back face is loaded if you click on a DVD, ready to be flipped over, and then another click moves it out to a close up zoo, where it loads the high quality version of all of the textures…

The next hurdle is to only load the imagges for those cases which are visible, rather than cycling through all the shelves.

Previously, I did this in PV3D, but checking the .culled attribute after making one render pass, and if ‘false’ then the texture replacement would happen.

Not sure how I’m going to do the same thing with away3d, I guess I need to investigate how to find out if an object is visible by the camera… Hmmm…

   

Avatar
ddddesigns, Jr. Member
Posted: 14 September 2011 11:00 PM   Total Posts: 37   [ # 6 ]

Are you generating the cubes using away3d or are you importing a model?  I was reaching the limit by creating a bunch of cubes in away3d.  I resolved it by creating an model with the cubes (exported to OBJ).  Seems to load much easier for me.  However since each of your cubes are going to have a different texture on them, I don’t know if loading multiple DVD cases in a single model will work for you.  It still may be quicker to load the OBJ several times though and apply different textures to each.  Good luck on this as loading a bunch of high res images will be a problem.  You may be better off doing what you are already doing or loading the images dynamically as they get closer to the camera.  Kind of a combination of what you are doing now (assuming that you are creating cubes are runtime).

   

Mr Margaret Scratcher, Sr. Member
Posted: 14 September 2011 11:06 PM   Total Posts: 344   [ # 7 ]

Yep, all the cubes are generated at runtime… I’ll figure a way round it I’m sure…

   

Avatar
Alejandro Santander, Administrator
Posted: 15 September 2011 06:00 PM   Total Posts: 414   [ # 8 ]

This limitation is caused by the Flash Player leveling from GPU standards, downward. Adobe intends the users to manage this resource with the techniques you guys have mentioned above. Although I don’t understand the topic very much, I would suggest researching TLF textures as well. I have the impression they are more optimized… or are my just saying pure nonsense?

   

Mr Margaret Scratcher, Sr. Member
Posted: 15 September 2011 06:57 PM   Total Posts: 344   [ # 9 ]

Googled “TLF textures” with no success…

Hmmmmm…

 

   

Avatar
Alejandro Santander, Administrator
Posted: 15 September 2011 10:08 PM   Total Posts: 414   [ # 10 ]

Hah! That was an interesting brainfart and evidence that I do indeed not know about this topic.

I mean “ATF” not TLF.

TLF is Flash CS5’s new text thingy.

   

Mr Margaret Scratcher, Sr. Member
Posted: 15 September 2011 10:35 PM   Total Posts: 344   [ # 11 ]

Ha! I had a quick look, couldn’t find out much, although admittedly it was a really really quick look…

   

John Brookes, Moderator
Posted: 16 September 2011 01:10 PM   Total Posts: 732   [ # 12 ]

Previously, I did this in PV3D, but checking the .culled attribute after making one render pass, and if ‘false’ then the texture replacement would happen.

Just been poking around this seems to do just that.

trace(Entity(plane).getEntityPartitionNode().isInFrustum(view.camera)); 

No idea how good/bad, just messing around, trying to learn stuff.


ATF
Yeah theres not much on the web about it. Noticed ALternativa use it in one of the demos.

   

Mr Margaret Scratcher, Sr. Member
Posted: 16 September 2011 01:15 PM   Total Posts: 344   [ # 13 ]

Oooh, that looks like it should do what I’m after…


I’ll give it a play and report back… Ta!

   

Mr Margaret Scratcher, Sr. Member
Posted: 16 September 2011 04:55 PM   Total Posts: 344   [ # 14 ]

Yep, seems to work!

if ((Entity(p).getEntityPartitionNode().isInFrustum(view.camera)) == true)
     
{
    
var frontCoverloader:Loader = new Loader()
    
//var frontCoverRequest:URLRequest = new URLRequest("http://videoemporium.co.uk/movie_title_covers/covers/LQ/fLQ/4700/4759fLQ.jpg");
    
var frontCoverRequest:URLRequest = new URLRequest(p.extra.fLQ)
    
//trace ("p,extra,fLQ = " + p.extra.fLQ);
    
frontCoverloader.load(frontCoverRequest)
    
frontCoverloader.contentLoaderInfo.addEventListener(Event.COMPLETEfLQLoaded);
     

And as expected, the items out of view have not had their covers loaded when I turn around..

Sweet! Thanks!

   

Mr Margaret Scratcher, Sr. Member
Posted: 17 September 2011 03:23 AM   Total Posts: 344   [ # 15 ]

EDIT:

Doesn’t work for ObjectContainer3D… Maybe because they are never actually ‘visible’ ...

var crSection:ObjectContainer3D = (crDVDs.getChildAt(crSectionIndex))
    
    
//TODO: figure out how to check if an ObjectContainer3D is In Frustrum View...
    
if ((Entity(crSection).getEntityPartitionNode().isInFrustum(view.camera)) == true

[Fault] exception, information=TypeError: Error #1034: Type Coercion failed: cannot convert away3d.containers::ObjectContainer3D@82343d1 to away3d.entities.Entity.


Perhaps I can hack around this by drawing an invisible plane in front of the ObjectContainer and testing for that..

 

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X