Second Life and OpenGL

A question by Loki got me looking at the state of DirectX/Direct3D and OpenGL. We hear Windows runs games faster on Direct3D than on OpenGL. That is supposedly why Second Life™ viewers run slower, fewer Frames Per Second (FPS), than other games using Direct3D. But, some people say otherwise. One of those people is Steam or more accurately the online gaming company Valve.

Valve makes the Source Engine that runs Half Life 2Left 4 Dead, and Dota 2. Valve is not a Microsoft fan, which I don’t find surprising as Microsoft is known for trying to make Windows a closed shop that keeps other gaming systems at a disadvantage. In testing in August 2012 Valve reported that OpenGL on Ubuntu ran faster than DirectX/Direct3D did on Windows. You can read more about that in: OpenGL is Faster.

This tells us it is not just OpenGL and Direct3D that solely control performance. The OS has quite a bit to do with it also.

There are celebrities in the gaming development world one of which is: John Carmack. John is a co-founder of id Software and well known gaming graphics programmer. So, it is a big deal that John develops games based on OpenGL. Since he is looking for the best performance for id’s games, the choice of OpenGL is remarkable and I think says a lot about OpenGL. It was stunning that he once spoke about changing to DirectX/Direct3D. However, it never happened. All the new stuff from id Software uses OpenGL.

In August of this year John made a 3.5 hour keynote speech at QuakeCon, August 2012. Look at time mark 2:45:00± for comments on Windows 8.

The speech is geeky and shows where tech is, if you have the patience to listen to the WHOLE thing. Some quick takes for getting a sense of OpenGL are:

00:46:00 Valve – Steam and what they are doing.

00:57:00 Mobile Gaming and where it is… or isn’t.

2:27:00 OpenGL – WebGL

2:30:00 – John says Direct3D is probably better than OpenGL – This is tricky to explain. John says Direct3D by MS is well documented and the API’s well described and the API’s work well together. John has described it as cleaner than OpenGL API’s. But, once OpenGL is learned and understood, it seems to do more things. Whatever the case, John is building his games using OpenGL. So, I am taking him to mean Direct3D better as in better organized and easier to learn than OpenGL.

2:33:00 – WebGL – It sucks – John’s opinions of WebGL dashed some of my hopes and certainly many of my expectations for WebGL being able to support games and platforms like Second Life.

2:40:00 – OpenGL complexity – John talks about the complexity of OpenGL. He is amazed at how well driver developers are doing supporting OpenGL. From what manuals I’ve read about using OpenGL I am not surprised that SL is slow. Even id’s Rage was laggy and suffered poor frame rates and it used OpenGL 3.2.  Some blogs reported: “…gamers are already lashing out (SteamNeoGAF), calling RAGE a “broken mess.” The biggest complaints describe intense screen-tearing, poor texture loading and numerous other glitches. Most of the problems reportedly revolve around AMD customers, but Nvidia patrons are also having their fair share of issues as well. Even Alec Meer from Rock, Paper, Shotgun says that he’s seeing quite a few technical problems on his PC to the point where he isn’t even sure he can keep playing.” Tom’s Hardware

But, OpenGL has allowed the addition of extensions. That has allowed id Software to do things they could not do with Direct3D… or at least not as they wanted to do them.

We see games with frame rates of 200+ that use OpenGL. So, what is happening with Second Life that so many see 15 FPS with some pretty high end equipment? It is hard to say. My guess is somewhere in the complexity of OpenGL and the SL Viewer’s render pipeline something is not quite right.

Some systems run SL extremely well. Some systems that are very similar if not identical run it poorly. Until someone figure out what’s up, things will probably stay that way.

But, the evidence is that OpenGL has the ability to perform very well. The people at Valve have been optimizing their game engine for it. The people at id Software have been optimizing their games for it. The staff at the Lab has worked on the pipeline to improve performance too. They all have had problems and successes. So, it is not just the Lab.

We can hope to see things improving this year as more of Second Life’s tasks are moved into separate threads, the communication channel is improved, the work the viewer and servers do is better coordinated to reduce communication traffic and work load, and only the things we can see get put into the render pipeline. But, in general I think SL will remain slower than most rendered 3D worlds. The SL viewer has so many things to do that most other games do not. SL would have to have a much higher performance video system to just match many other games that can concentrate only on rendering.

15 thoughts on “Second Life and OpenGL

  1. Isn’t it important, at least to a certain degree, that SL is built on an extremely outdated version of OpenGL, as some people say? Both AMD and NVidia graphic card drivers do get optimized for current versions, though, and have actually dropped support for versions as old as SL.

    Besides the basic setup, how can an open sandbox like SL compare to a closed environment like any ordinary retail game? Most of the time, you have a group of artists and coders who optimize a game for performance. If you look at really bad console ports of a game, you how miserably those can fail as well and may end up literally unplayable, just like GTA 4 in its early days.

    In SL, everyone can build as complex and as resource waisiting as they like, starting with slapping 1024×1024 textures on tiny poseballs, bringing sim performance down to its knees with script usage or stuffing as many high-poly objects as one can find into a spot. And then go crying, “I’m lagging so horribly!”. And as a final touch, it might come from a user who has been using the same computer for the past six years, without any upgrades, even though it was barely more than a better typewriter by the time they bought it on sale.

    • You are correct. The quality of the stuff put in SL does make a difference. But, there are parts of SL that are made by professionals.

  2. It is a well known *fact* that OpenGL runs faster on Linux than on Windows (the SL viewers will run typically 15% faster under Linux than they do under Windows).
    DirectX is about just as fast as OpenGL under Windows, but it won’t run under Linux (unless you use Wine, but despite its developers claims Wine is still an emulator and therefore runs programs slower than they would run under Windows).

    Now, there’s also the graphics driver quality, and here I must say that NVIDIA does a way better job at supporting OpenGL than ATI/AMD ever did !

    My advice is therefore: whether you are running your games under Windows or Linux, choose NVIDIA for your graphics card (you will also gain a life-time support for your drivers: NVIDIA keeps providing updated legacy drivers for its ancient GPUs when ATI drops support only a couple of years after your GPU is declared deprecated by them !).

    • Thanks Henri.

      nVidia support was a surprise to me when I got my first nVidia card. I been a fan ever since.

  3. OpenGL would seem to have the better hand atm, with cross-platform support and Microsoft (and hence DrectX) risking death with the poorly received Windows 8.

    The downside is that both nVidia and AMD cripple their graphic drivers to disable OpenGL 3D-stereo on consumer-grade graphic cards, making SL and other OpenGL “games” flat-only. 5 years ago, A short-sighted and greedy action to sell $1000+ pro-cards at the expense of open standards.

    I wouldn’t say WebGL is lame however, try an ex-Linden’s Cloud Party in Google Chrome on moderate hardware with ultra-settings (shadows etc) and then think of the performance of an SL viewer on the same! 🙂

    http://www.cloudparty.com/

    • Win8 is going to be good for mobile devices. But, it seems to be a Vista type thing. With luck Win9 will be a second generation that is better. I do think Apple has opportunities because of Win8. But, both Apple and MS have problems remaining in touch with users. Without Steve Jobs I’m not sure how well Apple will do. Jobs could be daring and innovate. I’m not sure the corporate managers will all that much better than MS.

      Cloud Party is Beta. So, that is not a completely fair comparison. But, it does well make your point on WebGL. I think WebGL must be so generic to run in a browser on any kind of hardware it is unlikely to ever seriously compete with more hardware specific video drivers.

  4. thank you for your cool techish article!
    maybe an other point why SL struggles in compare is that atm we do mostly have not to follow hard render-budget with inWorld builds. Sure LL is trying to governance this on a smooth and from my prospective, well acceptable way with us.

    • I think your right, as an earlier comment, now approved, points out.

      I think the problems from amateur builds is part of the price for creative freedom. I can live with lag from amateur builds to have the freedom.

    • Indeed. The abstraction of “prims” and “sculpties” have numbed a lot of people to the reality that our GPU’s have to evaluate and operate on each individual vertex in draw distance. It’s too late for Linden Lab to set hard triangle limits on both world and attached objects, but I imagine Second Life would run a lot better if we didn’t wear in our jewelry as many triangles as there are in some game scenes.

  5. Carmack’s problem wasn’t with WebGL. WebGL is just an implementation of OpenGL ES 2 that speaks directly to our video cards the same way any software would. It’s why Cloud Party can render so well.

    Carmack’s problem was with Javascript. More specifically he has a problem with compiling to bytecode and having a VM interpret that. This means he has a problem with Java and C# as well, the former he mentioned.

    Carmack is in the business of building the most cutting-edge engines and tools he can think of though. WebGL can render a Rage scene with MegaTexturing just fine, but of course there’s issues with loading a 10gig game in the browser and performance implications, when compared to C++, for dicing up the gigabytes dataset that makes up a MegaTexture before a GL call is even made.

    But for small games with megabytes instead of gigabytes install/download sizes and applications like Second Life or Cloud Party that stream assets, WebGL and the browser is nearing a perfect solution. I’d say the browser and WebGL is advantageous right now but certainly not perfect.

    The Second Life viewer itself has become more like a browser over time, not less like. There’s been further reliance of HTTP for networking, in addition to the invention of the secondlife:// protocol Viewer 2 came with a URL bar to handle SLURLs. Web profiles, web search, direct delivery. Second Life would probably benefit greatly if it was Google and Mozilla working on the wheels Linden Lab is having to reinvent. Definitely so in the future when there’s nothing Linden Lab can accomplish with C++ for Second Life that can’t be accomplished with Javascript in the browser.

    • I disagree. Carmack does have problems with WebGL. Because it does go directly to the hardware it is a major security risk. In addition computer history recorded the problems we had when most gaming software by-passed the OS to directly manipulate the hardware. There are reasons we gave up doing that. I don’t see that those reasons have changed.

      The SL viewer has become more browser like only in the sense of the user interface. The Lab directly copied the UI style to get people a familiar reference to ease learning. I don’t see browser makers moving to build in 3D engines as the primary render pipeline. Nor do I see the Lab abandoning the 3D render engine it has built for simpler engines. In fact more complex 3D render processes are being added.

      Cloud Party and the world may prove me wrong on whether WebGL will be come dominant as the engine or ‘driver’ for 3D web graphics rendering. But I can’t see a generic browser ever having 3D quality like a PC or Mac, at least not any time soon.

      • “I disagree. Carmack does have problems with WebGL. Because it does go directly to the hardware it is a major security risk.”

        Carmack only complained about Javascript and other managed language’s performance vs. native languages, not WebGL itself. Unless I missed a specific complaint against WebGL.

        As far as that “major security risk” that popped up from Microsoft in 2011, it hasn’t slowed the advancement of WebGL at all. There’s no “bypassing the OS to directly manipulate the hardware”. WebGL is again, just another well-vetted OpenGL implementation.

        To keep current with WebGL security, refer to: http://www.khronos.org/webgl/security/

        It’s worth repeating also that it’s much, much more than just a small bonus that it’s the likes of Google and Mozilla providing WebGL. I think a lot of us would be elated if starting tomorrow Google or Mozilla for whatever reason took over engineering Second Life’s rendering layer.

        “The SL viewer has become more browser like only in the sense of the user interface.”

        Depends on what you mean. More browser like only in design for user experience purposes? I wouldn’t say that. Functionally it’s really browser-like considering the Viewer embeds and depends on libraries like Mozilla’s Gecko and Qt/WebKit for it’s HTML rendering. The viewer is literally part web browser and has only become moreso over time.

        There’s a trend in software where desktop applications aren’t embedding HTML renderers the way Second Life does anymore. Instead, applications are being embedded in HTML. If our productivity apps, books, movies and music are increasingly consumed in the browser, it’s no wonder games and other 3D applications are starting to crop up as well.

        Certainly, Second Life as it is today can’t be entirely transplanted into the browser, as well as a lot of sotware. There’s no Havok physics library in Javascript (and wouldn’t be as fast as C++ anyway), and cross-origin media policies prevent all-important features like using media streams, and less important features like embedding video on faces/materials of 3D models for the same reason. There’s no present joystick support for those that use Space Navigators..There’s quite a few issues.

        But, time and momentum is on the browser’s side. Javascript engines only get faster. Cross-origin resource issues like mentioned above are being sorted. More APIs are being opened to the web like gamepad, microphone and webcam support. It probably won’t be very long until a complete replica of Second Life is possible in the browser. And I personally think deficiencies of the browser at present aside, there’s many advantages to building a virtual world on the web right now that Cloud Party excellently demonstrates.

        “I don’t see browser makers moving to build in 3D engines as the primary render pipeline.”

        Well, operating systems aren’t built primarily for games and other 3D applications either, but that hasn’t stopped them from being great platforms for them.

        For Google and Mozilla, the web browser IS the operating system, evidenced by Google’s push of Chromebook (which is surprisingly the top selling laptop on Amazon right now), and Mozilla’s development of their Firefox OS (which relatedly there’s a cool demo of on Raspberry PI running a WebGL demo http://www.raspberrypi.org/archives/1787)

        WebGL is more than a side experiment to those two companies. It wouldn’t simply be a nicety if the future of WebGL is bright, it’s a must if they’re going to compete with Apple.

        “Nor do I see the Lab abandoning the 3D render engine it has built for simpler engines. In fact more complex 3D render processes are being added.”

        They certainly don’t have to, but it doesn’t change the fact there’s a lot of up sides in building a virtual world in the browser vs. desktop. I can’t help but think there’s a lot of redundant work in things like “Project Shining” where “HTTP Library” and “Object Caching” are listed as the hugest investments plopped into Second Life ever. Client-side, these are things Google and Mozilla have their engineers on in the browser along with the large open source communities, and server-side there’s no shortage open-source and proprietary software built with the browser as a client in mind.

        “Cloud Party and the world may prove me wrong on whether WebGL will be come dominant as the engine or ‘driver’ for 3D web graphics rendering. But I can’t see a generic browser ever having 3D quality like a PC or Mac, at least not any time soon.”

        We’re definitely a long way off from games like Call of Duty being in the browser. But there’s little virtual worlds like Second Life do that can’t be done, many things better, in the browser. So there’s pros and cons to weigh and the pros will only get better for the browser and WebGL.

  6. As 3D designer and entusiast, I have been answered this question many times:
    Why does SL runs so slow while others games with better graphics runs a way faster?

    Well, the answer is not so simple. I must say, that LL is improving the performance a lot on new hardware. But there is other side, and is what users does with SL and their builds.

    You may notice that when a viewer runs slower is when avatars jumps in your screen.
    You may see people wearing 200+ sculpts hairs (I include myself :P). If you do numbers, just multiply those 200 sculpts by 2048 triangles of each piece have on its highest LOD and you will see how a single hair have more polygons than a very detailed scene made on ZBrush.

    Truly, is hard now to fix the problems of the past. But we still can give advice and good guidance on how to make better things. LL should give a way more benefits to those that build things with low poly, making them even more cheaper to upload and less LI. And punish a way harder those that exceds some common limits. Even making texture upload cheaper for those who use 512×512 textures would be a great idea to improve performance.

    Thanksfully, nowday is more and more common to see people wearing mesh hairs and clothes that have a way better performance than sculpts. So now I can stand with my friends in some places and dont see any huge performance drop since most of them wear mesh.

    Anyway, people still wants more and more detailed things. This may looks exagerated, but I have one customer for what I have to make shoes and he wants them divided in pieces. And each piece must be near 45K polygons because he wants them as much detailed as possible. Those kind of shoes can be used even for official adds of brands, since they are so high poly that doesnt need bake any detail on textures at all. And doesnt matter how much I try to convince him, he wants the most detailed shoes in SL even if that makes a computer lag everytime that someone is around you is wearing one. So I hope we jump quickly into the materials project before the world is filled with ZBrush meshes that people imports directly without any kind of retopology.

    • I expect we will see more things move into the ‘New Accounting’ model. I doubt that we will see much change in pricing for uploads. But… with the Materials System coming we may see an image size factor added to upload costs and possible Land Impact/Prim Count costs.

Leave a Reply to Henri Beauchamp Cancel reply

Your email address will not be published. Required fields are marked *