Paged Geometry in Mogre (alpha)

DirtyHippy

22-12-2011 17:53:24

Hey guys -

I built Mogre 1.73 from scratch using a version derived from Cygon's he posted (with MyStoke's terrain wrapper). I then extended the autowrapper around PagedGeometry 1.1.3.

I have wrapped almost all of the methods with a few minor exceptions that I will look at after the holiday. All of the functionality from the demos (grassloaders, treeloaders (2D/3D), impostors, batches, wind batches) is working.

I need to do some more cleanup and then I can release the binaries. I had to add PagedGeometry to Ogre core to get this to work so OgreMain for this distribution will include the PagedGeometry sources. I made very minor changes to PagedGeometry 1.1.3 (some call declarations, etc.) in order to support the autowrapping process.

I am using the new Terrain component in this screenshot. The baked lightmaps that autogenerate do not seem to generate correctly (at least compared to the Ogre demo for terrain). I am using code ported from tutorial 3. As a side note, has anyone gotten this to work correctly with the wrapped terrain component? I am assuming that the problem is with my code rather than the wrapping, but I have looked at the example code a million times and cannot find any differences :-).

andyhebear1

29-12-2011 09:49:13

good! what time can see you source? it's great use it in outdoor terrain

DirtyHippy

29-12-2011 18:29:56

Well I can certainly post the source code, but I am not sure how useful it is unless you know how to build Mogre with the auto-wrapping process. The C++ source is available with the PagedGeometry engine - although I had to modify it slightly. I did refactor a bit and make PagedGeometry a component - ala terrain and paging - so this is now not part of OgreMain but instead a separate DLL.

I have the binaries built for both debug/release (1.7.3 Mogre/Ogre). I'd be more than happy to release them. Anyone have any suggestions on a good place to upload files like this?

Oh, also, I do not have any samples or anything. You can download the C++ source at http://code.google.com/p/ogre-paged/ and look at the examples there. Those examples translate almost exactly over to the wrapped version except in some minor cases - e.g. some getters/setters are properties in C#.

Beauty

15-01-2012 17:32:37

Great news!! :D

Yes, sharing in a public repository would be the best.
Either in you own one or possibly directly in the "official" Mogre account on bitbucket.

If in the Mogre account, maybe it's useful to add it to the terrain/paging fork (inside the Mogre repository)?
Or maybe in an extra repository which also contains the sample?
Or the core code to the Mogre repository and the demo code somewhere else (e.g. in your private repository)?
I'm not shure which way is better for sharing. I just wrote ideas.

If you need write access to the Mogre repository, just tell me. (send your e-mail address to me by PM)

Beauty

17-01-2012 22:59:05

The baked lightmaps that autogenerate do not seem to generate correctly
As first step for beautification you could change the background colour of the ViewPort to blue. 8)



I built Mogre 1.73 from scratch using a version derived from Cygon's he posted (with MyStoke's terrain wrapper). I then extended the autowrapper around PagedGeometry 1.1.3.

Since months there is nobody who maintains the Mogre core code. (Or I didn't recognized it.)
In the meantime Cygon made improvements. He published it, but it wasn't included to the official repository. Now Cygon is inactive again for months.

So I think it would be useful when you add your improvements the official repository.
Good would be to do it in 2 steps:
  1. Add the unmodified Code of Cygon to the trunk[/*:m]
  2. Then add your extended version to the trunk[/*:m][/list:u]
    The result of 2 steps is a better overview and it's more easy to find bugs.


    If you add this to the Mogre repository there would be important benifits, because
    1. your code is based on Cygons code,[/*:m]
    2. Cygons code is based on mstoykes terrain/paging branch of the official repository[/*:m]
    3. and the terrain/paging branch is an improved version of the current Mogre trunk.[/*:m][/list:u]
      So it would be a good step for the further development if you check it in there.

      Well, perhaps the improvements contains bugs, but
      1. It's a good base for further development.[/*:m]
      2. Everybody find it quickly (instead of searching on less known private repositories)[/*:m]
      3. If a user has real problems, he still has the option to switch back to the previous Mogre 1.7 release.[/*:m]
      4. Bugs of the improved code can only be found and reported if people can test it.[/*:m]
      5. If somebody tries to autowrap Mogre agains Ogre 1.8, the improved code would be a better base than the current trunk.[/*:m]
      6. If somebody add improvements to the current trunk, then it's more hard to merge the different "forks".[/*:m][/list:u]
        This is my personal point of view.

        If you have specific problems, I'm shure that some other people here will try to help you.

        I don't want to force you to do anything you don't like to do.
        It's just as a suggestion. :wink:



        Important:
        It seems so that you know how to extend Mogre.
        I hope that you do it in a way that the code changes will not be killed (overwritten) when the mogre autowrapper tool re-wraps Ogre.
        This could happen, when you modify code files, which was autogenerated by the autowrapper tool.
        Unfortunately I don't know details about. (But there is a forum topic where we collect information about the autowrapper internals.)

        It's no critism to your improvements.
        I'm just afraid that they could be killed when they are added in the "wrong way".


        I had to add PagedGeometry to Ogre core to get this to work so OgreMain for this distribution will include the PagedGeometry sources.
        Is there a disadvantage to include terrain/paging support to Mogre in that way?

        Update:
        In your next post I saw that you did seperate it now.


        I did refactor a bit
        It would be very useful in the long-term when you add comments to the code or write a tiny documentation about the things you found out.
        So it's more easy for other users to understand the code. This is e.g. important for updates in the future.
        In the past our community had much trouble, because of undocumented code and workflows.


        -------------------------------
        Common bugfixing:
        -------------------------------

        An other point:
        Mogre has some bugs, which I added to the Mogre bugtracker.
        One of them is related to the Euler Angle properties of the Quaternion class.
        It should be easy to fix them. Unfortunately I don't have the needed knowledge.
        But I would help you and give you the needed code snippets.
        Then you could insert it into the Mogre source code.

        What do you think about?

        Details are in the topic Euler angles - current bugs + improved Euler Angle Class.
        There we have an intensive discussion.
        If you prefer, I will give you links to the related (important) posts.

zarfius

17-01-2012 23:11:28

I built Mogre 1.73 from scratch using a version derived from Cygon's he posted (with MyStoke's terrain wrapper). I then extended the autowrapper around PagedGeometry 1.1.3.

Congratulations! You've managed to do what many of us have tried and failed to do in the past. I think the most valuable gift you could give now is your knowledge. If you could document, even in bullet points, the steps you took to get there so we can reproduce it I'm sure many of us would be most greatful.

Also, if you're looking for hosting of binaries or whatever, I'm more than happy to put them up on my webhost permanantly along with a page about what they are.

Beauty

18-01-2012 09:15:31

In the case that you don't know:

The forum topic and discussion about the autowrapper details you find here:
Understanding the Mogre build process

DirtyHippy

18-01-2012 20:04:50

So I actually have PagedGeometry, OgreSpeedTree, and SkyX 0.21 wrapped right now.

In terms of wrapping - I have gotten pretty decent at it and have taken quite a few notes. However, there are quite a few elements about the wrapping that I can't figure out and honestly haven't impacted the methods I needed, so I haven't bothered to fix them.

All three of these are separate components in Ogre - but they are part of the main Mogre namespace. I can't figure out how to have different namespaces in Ogre/Mogre with the autowrapping. It appears there was some attempt at this in the auto-wrapper, but it definitely doesn't seem to like this. So I had to go old school and rename the class names in each library with a prefix (i.e. Skyx_) and then remove the skyx namespace. This is less than ideal - especially with the managed Mogre assembly since there are all kinds of classes floating around that should be separated by namespaces.

The process of doing the wrapping is painful - it involves a bit of trial and error - and coupled with the insane time it takes to build C++ code, it can be frustrating. I was able to wrap SkyX and OgreSpeedTree in about ten hours a piece. Paged Geometry probably took 3x that since it was my first time. I really, really hate C++. But, this has opened a lot of possibilities for me as I have been able to make small changes to these libraries as needed as well.

In terms of releasing the source code, I could do so but my environment is fairly custom. I am using Cygon's solutions/project files. I have not built the opengl renderer, simply because I do not use it and it didn't build out of the box (I think it wanted some headers I didn't have, so I figured it was looking for some SDK) and I only am building 32 bit. I have batch files that automate a lot of the bs you have to do with wrapping (copying files around, etc.). I'm not sure I can just replace what is out on some SVN repo with this. In addition, I would need to strip out the OgreSpeedTree code since that is IP of IDV.

Beauty

19-01-2012 01:56:02

Thanks for your detailed answer. :D

In terms of wrapping [...] I can't figure out how
I think it's a good idea to copy and paste your wrapper problems from here to a post in the forum topic Understanding the Mogre build process.
It's a more common place for such a discussion that hidden in this topic.
There are more people who follow it and others can learn from the increased knowledge. (because it's collected at one single place)

I don't hit you. It's just a suggestion for a higher benifit. :wink:

my environment is fairly custom [...]
I'm not sure I can just replace what is out on some SVN repo with this

Well, in this case I propose:
Upload your source code to your personal repository.
Then others can either use your version or grabb specific modifications for use with the "official" code.

zarfius

20-01-2012 23:57:42

I built Mogre 1.73 from scratch using a version derived from Cygon's he posted (with MyStoke's terrain wrapper). I then extended the autowrapper around PagedGeometry 1.1.3.

I've managed to build Mogre using the original MogreBuilder and documented my progress over in this thread. I would love to include the extensions you have made.

xinghang

20-02-2012 10:20:27

hi,i am a newer with paged geometry. i wrapped pagedgeometry1.1.1 with c++/cli. But with the compiled dll i can not see the trees which loaded. So ,i think i was wrong somewhere in wrapping. The "PagedGeometry::addDetail<>" function troubled me most. Here is my way to create it:

public ref class PagedGeometry: System::IDisposable
{
protected:
Forests::PagedGeometry *pagedGeometry;
public:
void addDetailLevelBatchPage(float maxRange, float transitionLength)
{
pagedGeometry->addDetailLevel<Forests::BatchPage>((Ogre::Real)maxRange,(Ogre::Real)transitionLength);
};

void addDetailLevelImpostorPage(float maxRange, float transitionLength)
{
pagedGeometry->addDetailLevel<Forests::ImpostorPage>((Ogre::Real)maxRange,(Ogre::Real)transitionLength);
};
}

Would you tell me if this is true or not? If not true,please tell me the right way. Thanks ..