Adam Frisby

Ideas for Scene Graph Optimisation

with 2 comments

Authors note: I use terms such as ‘disadvantage’ when refering to Second Life’s building tools as a comparison to professional tools with professional artists, naturally user generated content tends to lean towards less efficient building techniques. This is not a slight on the content creators themselves, just that the tools make lots more work for people writing renderers and dealing with efficiency.

Second Note: Like my previous post, a large deal of this is speculation. I plan on confirming or denying a large number of my suspicious with the Xenki viewer’s design, but at this point should be just ramblings on the authors blog rather than any authorative statement.

As a sidenote from my previous post - I have some more ideas I’d like to try put into practice directly with rendering Second Life(tm)-style scenes faster for Xenki. The mainline SL client achieves it as far as I can tell through a combination of utter brute force (equivilent to sending an entire dam through a garden hose every minute - It’s pretty impressive.) and lots and lots and lots of caching.

This is not going to play well with WPF at all (I can see that much already), first we dont have access to low level hardware, and second I dont want to debug a thousand graphics glitches with every nuanced bit of hardware. Thanks, but no thanks, I’d rather let MS worry about that part.

So, if brute force is out of the question, what options exist for making things render faster.

First is the obvious one - let’s cache better.

One of the things that has been lamented previously has been the fact that Second Life has dynamic content, ergo we cannot cache the scene - I suspect this isnt the whole deal, while it is true that every object in the scene can potentially be moved (scripted or avatar building) at any moment, we can evaluate a lot of them on probabilities and discount swathes as likely to move.

Objects

Objects can be pretty easily split between “Likely to move” and “Unlikely to move.” Likely to move objects were either recently created, marked temporary or physical, or contain scripts. While it is true the others could still move, the probability is significantly lower, and therefor we can more readily cache them. If they get moved, then we’ll need to rebuild that cache (without the object that moved), but for now - it’s acceptable.

This cache could take the form of rendering the entire ’static’ portion of the scene to a single massive vertex buffer, and then rendering the dynamic elements individually (or in smaller caches). This is very similar to how modern games work - however in that case you have the advantage of being able to build a BSP tree in the editor. I am uncertain as to whether we are capable of doing BSP generation fast enough to make this dynamic cache feasible, but it is an interesting idea nontheless (Insert additional concerns about wide open spaces and BSP trees here).

A potential downside here is that we’ll need to change how LOD works for this to be effective - rather than having LOD calculated “on the fly” as your camera navigates, we will need to force the scene, then only update LOD periodically as the cache refreshes. In this case, LOD may become a function of the size of the object in absolute terms rather than relative to screen space.

Maintaining this cache on an idle processor

One of the great things about processors lately has been the abundance of cores added, this means chances are there is a piece of hardware sitting on this machine without much to do. We can leverage this by doing the cache building and maintainence on a seperate thread which runs on another processor, because the cache is not a prerequisite to rendering - we can optimise the cache in the background, then use it when it is availible.

Handling Textures Better

Second Life has the disadvantage of not using professionally created textures on every surface - this means that it’s possible for a microscopic object that you cannot really see having a massive 1024×1024 sized texture attached to it, increasing both bandwidth usage - and the amount of texture memory that is consumed in displaying your scene.

An idea for fixing this problem could be to measure the surface area each texture is applied to, then using this surface area to approximate what resolution we should render each texture as. (Converting that 1024×1024 texture down to a 32×32 texture if it is only used once, on that object).

By doing this, in combination with careful management of the amount of texture memory availible (downsampling to fit memory and applicability together) this may get around at least part of the “huge texture memory consumption problem”.

Written by Adam Frisby

August 6th, 2008 at 4:43 pm

Posted in Xenki

Tagged with , , , ,

2 Responses to 'Ideas for Scene Graph Optimisation'

Subscribe to comments with RSS or TrackBack to 'Ideas for Scene Graph Optimisation'.

  1. Wow! You’re alive and busy it looks like! ^_^

    Some good stuff there. I saw you mentioning boolean operators a bit further down, as someone who had been using PovRay/3DMax and several other programs long before I booted up SL booleans are something I’ve been begging for in Second Life since I first installed it, started building, then was like, “Uh…hey, um…where’s the boolean operators?” Most people were like “What? Boolean whatamahjiggers?” Then I cried. T_T

    Tormented Twilight

    6 Aug 08 at 8:42 pm

  2. When you speak about handling textures better, SL seems to be handling textures and the way it displays them in a different way compared to normal video games. I noticed that regular games seem to be using very small textures to cover large surfaces in games where the quality of the texture still remains sharp and detailed.
    If you would try to cover a similar surface in SL with the same texture size it would have a blur look and would be very unsharp. On most objects it’s out of the question to use 32 by 32 or 128×128 textures. Of course it would be smarter to use these as everything would load a lot faster but SL seems to demand for usage of 512×512 in many cases or even higher.

    This is unless you can come up with something similar what games or using or maybe regular games show these smaller texture sizes in a better quality because they are baked on real 3D models.

    When you look at these factors there is need for a more professional approach in tools, options, technology and techniques. When you put these together I’m sure they will help to solve bandwidth usage and increase general load times for sims.

    On the other hand, what would also be a big step and improvement for the current sim infrastructre would be the draw distance for prims and objects. The current model seems to only load prims within a certain range of your avatar. Ofthen they only start to load when you enter a particular sim. So things like far view distance, admiring landscapes etc…. is currently out of the question. The only thing you can admire from a distance is bare land. It would be nice to see a change, even if it was only grass and trees that would load from a distance, it would certainly makes things more realistic. There is a lot to work on to further build out Opensim as a platform.

    Things like shaders, improved particle effects, meshes, seamless crossing of regions.
    Maybe game oriented scripting languages like Lua, in world terrain painting, a robust terrain generation module which allows terraforming, terrain texturing and painting.

    There are very talented people in SL but they can only squeeze something out of a prim what the prim allows them. So there is a need for better techniques and tools. Lego land is lego land, it’s not the standard for a virtual world.

    Virtual

    6 Aug 08 at 11:06 pm

Leave a Reply