Yay, OgreSpeedTree 2.0b is done

Business, Development, OGRE 9 Comments

I’ve been pushing quite hard to get this done before I head off to Qt DevDays next week, and luckily it all came together in the last few days:

Some of the notable back-of-the-box (if there was a box) items:

  • Upgrade to SpeedTree v5 – supporting all the great new features. See the SpeedTree site for more details on this release.
  • More lighting options – Ambient Occlusion, Ambient Contrast, Specular Lighting, Transmission Lighting, Global Light Scalar, HDR.
  • Improved LOD fading – LOD transitions are now implemented via less perceptible techniques thanks to SpeedTree v5.
  • Dynamic soft self-shadowing via depth shadowmaps – (was also demonstrated on SpeedTree 4.2 in OgreSpeedTree 1.1.0)
  • Improved alpha to coverage support – alpha to coverage rendering has been significantly improved and is now enabled by default (you must render with at least 2xMSAA to see the effect), resulting in significantly smoother foliage edges and smoother fade transitions.

I’m just really, really glad to have got this done. SpeedTree v5 was quite a big change to handle, but hugely worthwhile, the guys at IDV have done a great job. I made the choice from v1 to do a ‘deep’ integration (ie all objects are first-party Ogre objects, everything uses Materials and RenderQueues properly, etc), which made the transition considerably more time consuming than using the higher level pass-through interfaces, so this took some effort. I like it this way though, it means it’s a ‘real’ integration as far as I’m concerned, not just a simplistic bolt-on.

There’s still more to do, not least of which a demo that’s more interesting than just a technical performance test :) But at least I can tick off one of the major things on my TODO now. I’d been putting in quite a few extra hours to try to handle this, and my Qt presentation preparation, and Ogre, and consultancy, and it has taken its toll a bit – I’ve been spending more time at the desk and think that was a contributing factor to me straining my back at the gym last weekend. Hopefully that’s just temporary, I’ve been a lot better these last few months.

Hope you like the shots anyway. I know, I’m pimping them all over the place in my Twitter, here and on the Ogre site, but a guys gotta make a living, right? ;)

OgreSpeedTree featured at www.speedtree.com, press release

Business, OGRE No Comments

IDV yesterday issued a press release on speedtree.com announcing OgreSpeedTree :) We’re also in their gallery and (currently) also on their front page. I’m rather pleased! I do however feel the pressing need to come up with some better screenshots, including HDR and some more interesting terrain.

As always my thanks go to Kevin Meridith from IDV for his assistance throughout this whole process.

New OgreSpeedTree media up

Business, OGRE 11 Comments

A few people asked for an OgreSpeedTree video with more varied scenes, and I’ve now uploaded one to the OgreSpeedTree section of the Torus Knot site. Just scroll down below the screenshots if you want to view the video.

I have a higher resolution & better quality version (this one is H.264 at 1Kb/s) but I’ve kept this one small for now to keep my bandwidth under control. Places like Vimeo don’t allow commercial advertising, and while before I could get away with claiming it was just in-development test output shared with enthusiasts only, this is really an advertisement video so I’m hosting it myself. I have enough bandwidth to spare unless something really goes bonkers (I think) – in case it does, does anyone know of any reasonably priced business media hosts (UK only), should I need something more than just upping my bandwidth allowance? I’ve seen a few dedicated streaming media hosts around but don’t have a view on how good they are.

OgreSpeedTree 1.0 entered RC1 a week ago and I haven’t had any reports of any issues, so I’m pretty much ready to stick a fork in it & declare it done for now. I’ve been improving OgreSpeedGrass this week, such as making the grass paging re-entrant so that new cells can be filled gradually to spread the buffer update overhead over many frames, that seems to have helped in busier scenes. That just needs a couple more utility functions for loading in grass distributions from tools, then that will be done too. Then, it’ll be time to get the marketing wheels moving…

8000 trees and 2.5M blades of grass? No problem.

Business, Development, OGRE 12 Comments

I’ve been crazily busy lately trying to get OgreSpeedTree to a fit state for a 1.0 release alongside other projects (such as Ogre of course), so I can really start promoting it. Being the kind of person I am, I find it hard to stop tinkering and perfecting and I can’t let something go out the door without being totally happy with it. The screenshots and videos so far have been good I think, but I’ve been polishing away and making it all just that bit better, and one element of that has been some additional optimisation.

Thanks to some improved batching, OgreSpeedTree is now running even faster than before, and most importantly it scales to larger forests even better than before too. Here’s a short video where I tested adding over 8,000 trees (from 5 different models, and each with different rotations / scales) to the scene, together with over 2.5 million blades of grass, each of which can  be placed individually (I procedurally generated the distribution, but it could be done manually). Actually some of those tree models have multiple trees in them (the very close ‘clusters’ of 3/4 are actually one model), so in reality there are actually 12,000+ trees as far as the viewer is concerned.

Note that all the trees here are dynamically lit including normal mapping, and dynamic shadows are being cast through 3 shadow textures (PSSM). The LOD transitions are extremely hard to spot IMO too.

On my 9800 GX2 with a 2.66 dual-core, it runs consistently over 60fps (actually about 75fps most of the time). This is with a quite dense  clustering of the trees too; If you spread the trees out a bit more you can easily double that. The LOD settings are quite high too; reign those in and your lower class cards should be able to easily handle this, and of course you have the option of dropping or scaling back the dynamic shadows if you’re pushed.

I’m happy :) Not that I’ve quite finished of course, I have a couple of things still to polish for 1.0, but it shouldn’t be long now.

OgreSpeedGrass

Business, OGRE 12 Comments

Next in the line of OgreSpeed* products, here’s a shot of OgreSpeedGrass.

It’s based on IDV’s SpeedGrass but I’ve rewritten a fair amount to make it work conveniently with Ogre, and also improved it somewhat – such as better wind effects and the completely dynamic lighting and shadowing you see there, which I think looks rather nice.

OgreSpeedGrass will be bundled with a yearly support agreement for OgreSpeedTree, in the same way that the original SpeedGrass is licensed. I’m not looking for any additional beta testers right now, but there will be an official 1.0 release of both these libraries by the end of the month; if you’d like to be notified when that happens, please email enquiries at torusknot dot com.

More shots are available in the Ogre gallery.

Edit: and here’s a video, for those who asked:

Parallel-split Shadow Maps are cool

Development, OGRE, OS X, Uncategorized 3 Comments

OgreSpeedTree with PSSMWe’re on the final home straight for Ogre 1.6 (aka Shoggoth), which should hit RC1 next week. One of the final features I wanted to squeeze in was support for Parallel-split Shadow Maps (PSSM), which uses multiple shadow maps per light in a hierarchical fashion to improve the quality while keeping the size down, particularly in outdoor scenes using global directional light. If you’ve played Assassin’s Creed, you will have seen this technique in action already.

For example, the screenshot on the right there is using 3 shadow maps for the single directional light, the closest one being 1024×1024, and the other two being 512×512 – together they are 38% of the size of a single 2048×2048 shadow map and yet provide greater detail. The 3 shadow textures are displayed for debug purposes on the right – notice that all 3 are using LiSPSM projection to bias the texture precision toward the camera which also helps. If you look really closely on the full resolution shot, you can see the transition from the highest resolution shadow map to the second shadow map about halfway up the screen, it changes near the top of the closest tree shadow. It’s quite hard to see though, which is kinda the point :)

One of the challenges with supporting PSSM is that Ogre had previously assumed that there is a 1:1 mapping between lights and shadow maps, which clearly had to be overcome – this limitation also prevented easy use of dual parabaloid and full cubic shadow maps for point lights of course. It was one of those things that had been languishing on my TODO for a while, begging me to find some time for it, and that’s where it still was until Pang Lih-Hern (aka lf3thn4d) from Malaysia came along and did it for me :) What a star! His initial patch allowed multiple shadow textures per light in a very sensible way, and he then implemented a PSSM facility on top of that, via our pluggable ShadowCameraSetup system (which he also extended in the patch to be aware of shadow map iteration). I adapted the PSSM code from his demo to be a little more flexible (it now handles any number of splits, and a more flexible split configuration) , so that setting it up goes something like this (simple projected shadows here, depth shadowmaps are also possible of course but let’s not overcomplicate it):


float shadowFarDistance = 3000;
mSceneMgr->setShadowTechnique(SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED);
mSceneMgr->setShadowTextureCountPerLightType(Light::LT_DIRECTIONAL, 3);
mSceneMgr->setShadowTextureCount(3);
mSceneMgr->setShadowTextureConfig(0, 1024, 1024, PF_X8R8G8B8);
mSceneMgr->setShadowTextureConfig(1, 512, 512, PF_X8R8G8B8);
mSceneMgr->setShadowTextureConfig(2, 512, 512, PF_X8R8G8B8);
PSSMShadowCameraSetup* pssm = new PSSMShadowCameraSetup();
pssm->calculateSplitPoints(3, mCamera->getNearClipDistance(), shadowFarDistance);
pssm->setSplitPadding(mCamera->getNearClipDistance());
pssm->setOptimalAdjustFactor(0, 2);
pssm->setOptimalAdjustFactor(1, 1);
pssm->setOptimalAdjustFactor(2, 0.5);
mSceneMgr->setShadowCameraSetup(ShadowCameraSetupPtr(pssm));
mSceneMgr->setShadowFarDistance(shadowFarDistance);

Notice that I used Integrated Shadows, this is a requirement of PSSM since only shaders with integrated shadow support can decide on the fly which shadowmap to sample from.

My sincere thanks to lf3thn4d for helping us get this feature in to Ogre 1.6 (and to all those who send us patches in fact). If you want to see it and OgreSpeedTree in motion, there is a video available; that’s the low-quality streamed version but you can also download the higher resolution version if you want.

OgreSpeedTree

Business, Development, OGRE 10 Comments

Yes, this is the extra library project I’ve been working on recently:

There are more details in my OGRE Forum post, but I’m pretty sure you can guess what it does :) I’m pretty pleased with the shots & speed so far, although I’m refining it more all the time. I’m currently in a closed beta phase with a client, so no demos yet.

I’ve written this in partnership with IDV (creators of SpeedTree), who have been very helpful. I’ve spent quite a bit of time on doing this ‘right’, choosing to take the high road of writing a completely native Ogre implementation from scratch rather than adapting the reference application, and I hope that over time, SpeedTree and OgreSpeedTree will become components of choice for those Ogre users who are looking for top-quality foliage rendering.

I’ll have this with me at Siggraph if you want to see it running, just drop me an email at steve at torusknot dot com.

SpeedTree® is a registered trademark of Interactive Data Visualisation, Inc. All rights reserved.