When camera is inside a geometry, it really makes application almost suspended...

Feb 19, 2011 at 12:23 PM

Hi, when I first time want to do some 3d things in Silverlight, I quickly found Balder. After looking at some tutorials, found your guys' work is really great to help all of us. Thanks!

My goal is to create a sphere with some photos as materials textured on the inside surface of it, and put the camera on the center point of the sphere. It looks much like Google StreetView.

I use the earth.ase (from HelloWorld project) to create a mesh as sphere and the cloudless.png file as the material, and just set the Doublesided property to True, so the material can render on the inside surface. Then I put the camera at the center of the sphere by setting its Position to (0,0,0), which is same as the position of the sphere, and the camera's Target is set to somewhere else.

public MainPage()
        {
            InitializeComponent();

            //AddMaterialedBox();
            AddEarth();
        }

        private void AddEarth()
        {
            _game = new Game()
            {
                Width = 600,
                Height = 600,
                Background=new SolidColorBrush(Colors.Black),
            };
            _game.Camera = new Camera() { Name = "camera1", };
            _game.Camera.Position = new Coordinate(0, 0, 0);
            _game.Camera.Target = new Coordinate(150, 150, 150);
            _game.Scene.AddNode(new OmniLight()
            {
                Position = new Coordinate(0, 0, 0),
            });

            Balder.Imaging.Image image = Runtime.Instance.ContentManager.Load<Balder.Imaging.Image>("/BalderTest;component/Assets/cloudless.png");
            Material material = new Material()
            {
                DiffuseMap = new ImageMap(image),
                DiffuseMapOpacity = 1,
                Opacity = 1,
                DoubleSided = true,
            };
            Mesh sphere = new Mesh();
            sphere.Position = new Coordinate(0, 0, 0);
            sphere.InteractionEnabled = true;
            sphere.AssetName = new Uri("/BalderTest;component/Assets/Earth.ASE", UriKind.Relative);
            sphere.Material = material;

            Balder.Objects.Geometries.Geometry group = new Balder.Objects.Geometries.Geometry()
            {
                Name = "MeshGourp",
                InteractionEnabled = true,
            };                      

            group.Children.Add(sphere);
            _game.Scene.AddNode(group);

            LayoutRoot.Children.Add(_game);
        }

But when the application starts, it looks like it's just suspended...almost can't interaction with the sphere. However, if I pull the camera out of the mesh, by setting its position out of the sphere, the app works just find and smooth.
I just wonder if is it correct to put the camera inside a sphere by this way? Or there is something else I must pay attention to if I want to achieve my goal?
Here is an example which can show my problem if you setting the Camera's Position in side the mesh and target somewhere else:http://www.cnblogs.com/nowpaper/archive/2010/12/16/1908289.html
Thanks.

Feb 19, 2011 at 12:34 PM

PS: If I use a Balder.Objects.Geometries.Box as the geometry, and put the camera in the center of it, the app looks a little better than the sphere, but still like suspended...

Coordinator
Feb 19, 2011 at 12:39 PM

Hi and thanks,

I fixed a bug today regarding clipping that could cause this problem. If you download the latest source and open up the SampleBrowser_Silverlight solution file in the Solutions folder and build, you should get the binaries you need.
Hopefully that will fix things for you.  

Feb 21, 2011 at 2:39 AM

Thanks for your reply, adept.

I download the 4a3f48101a60(default tip Fixed release build of Balder for WPF) version of source code, and build the Balder library(Balder.Silverlight project) in SampleBrowser_Silverlight solution, then add the Balder.dll into my app.

However, found no luck. The issue remains the same.

Here is my sample, http://dl.dropbox.com/u/4298379/sl/Balder/index.html, using the builded dll from 4a3f48101a60 source code. Just try to set the camera postion at (0,0,0) and point the target somewhere else, the problem occrus.

Coordinator
Feb 21, 2011 at 9:38 PM

I'm seeing your problem. 

I'll investigate this more closely. Clipping has been a re-occuring issue, time to nail it once and for all. Sorry for the trouble!

Feb 21, 2011 at 11:55 PM

Thanks adept! Glad you'll get hands on it.

Hope this won't waste you much time and effort, and looking forward to your reply if this is resolved :)

Coordinator
Feb 22, 2011 at 9:57 AM

Sure, no problem and it won't waste my time. :)

 Clipping has been a returning issue - needs to get full attention.

Jul 5, 2011 at 9:59 AM

Hey there, this is Keith.

I have messaged you both regarding this project to which you both have been very helpful in helping me understand Balder, and more.

I have managed now to finally recreate diligentpig's project through being sent the most updated version and understanding how it works through my own means of learning the C# coding used, and via 'green code'.

Upon realising that referencing both the Balder/Ninject dll's directly, the project compiles with errors and hangs on my browser.

So upon referencing the Balder.Silverlight project as suggested by diligentpig, via adding it firstly as an existing project using the '6f3490081e94' source 'Balder' folder, and then as a reference to current project.

I can now build the project successfully to the point as how diligentpig's appears, aside from the panorama image - 'para.jpg' - not displaying but only presenting on my browser as a Black screen.

How do I know that the project is porting correctly? Because diligentpig has been working on something which visually looks like a pyramid-shaped object which overlays the panorama. What its functionality does, I am not sure yet.

And noticing its movement from altering xaml controls, e.g. X, Y, Z positions, that suggests the Silverlight project is working perfectly.

I have been trying to functionate a working panorama of my own to sample with to gain an understanding on how to progress my project further. What is majorly preventing me from progressing is this lock stopping the image from presenting.

Thank you guys, for whatever help you can provide.

Keith.