Trouble rendering with TBoundsphere

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Trouble rendering with TBoundsphere

Phua Khai Fong
Hi,

    I have a problem with the rendering of an object in the world. First, i create a cube and specify a TBoundSphere surrounding it. After having the TBoundSphere, the cube seems to have problems rendering itself, it becomes invisible at some angles to the avatar meaning, if i move around the cube, at some points, the cube will just disappear but it'll appear again at other points. It renders fine without the TBoundSphere. Has anyone encountered this problem? By the way, the cube can have different length, width and depth. The TBoundSphere is centered at the center point with a radius which is the maximum value between the length, width and depth.

Send instant messages to your online friends http://uk.messenger.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: Trouble rendering with TBoundsphere

Darius Clarke
Is it possible to send to us a copy or segment of the code where you use TBoundSphere?

Cheers,
Darius

On Tue, Mar 18, 2008 at 3:27 AM, Phua Khai Fong <[hidden email]> wrote:
Hi,

    I have a problem with the rendering of an object in the world. First, i create a cube and specify a TBoundSphere surrounding it. After having the TBoundSphere, the cube seems to have problems rendering itself, it becomes invisible at some angles to the avatar meaning, if i move around the cube, at some points, the cube will just disappear but it'll appear again at other points. It renders fine without the TBoundSphere. Has anyone encountered this problem? By the way, the cube can have different length, width and depth. The TBoundSphere is centered at the center point with a radius which is the maximum value between the length, width and depth.

Send instant messages to your online friends http://uk.messenger.yahoo.com

Reply | Threaded
Open this post in threaded view
|

Re: Trouble rendering with TBoundsphere

Phua Khai Fong
In reply to this post by Phua Khai Fong
initBounds

    | length x y z |
    length := xLength max: (yLength max: (zEnd - zStart)).

    x := xLength/2.
    y := yLength/2.
    z := (zEnd - zStart)/2.

    boundSphere := TBoundSphere localPosition: (self startingPoint + (x@y@z)) radius: length.
    boundSphere frame: self.

As requested, the above is the message that instantiates the TBoundSphere and places it in the center of the cube. The variable length stores the longest side among the width, length and height of the cube which will then be the radius for the boundSphere.


----- Original Message ----
From: Darius Clarke <[hidden email]>
To: [hidden email]; Phua Khai Fong <[hidden email]>
Sent: Wednesday, March 19, 2008 0:37:54
Subject: Re: [croquet-dev] Trouble rendering with TBoundsphere

Is it possible to send to us a copy or segment of the code where you use TBoundSphere?

Cheers,
Darius

On Tue, Mar 18, 2008 at 3:27 AM, Phua Khai Fong <[hidden email]> wrote:
Hi,

    I have a problem with the rendering of an object in the world. First, i create a cube and specify a TBoundSphere surrounding it. After having the TBoundSphere, the cube seems to have problems rendering itself, it becomes invisible at some angles to the avatar meaning, if i move around the cube, at some points, the cube will just disappear but it'll appear again at other points. It renders fine without the TBoundSphere. Has anyone encountered this problem? By the way, the cube can have different length, width and depth. The TBoundSphere is centered at the center point with a radius which is the maximum value between the length, width and depth.

Send instant messages to your online friends http://uk.messenger.yahoo.com



Send instant messages to your online friends http://uk.messenger.yahoo.com
Reply | Threaded
Open this post in threaded view
|

Re: Trouble rendering with TBoundsphere

Andreas.Raab
Phua Khai Fong wrote:

> initBounds
>
>     | length x y z |
>     length := xLength max: (yLength max: (zEnd - zStart)).
>
>     x := xLength/2.
>     y := yLength/2.
>     z := (zEnd - zStart)/2.
>
>     boundSphere := TBoundSphere localPosition: (self startingPoint +
> (x@y@z)) radius: length.
>     boundSphere frame: self.
>
> As requested, the above is the message that instantiates the
> TBoundSphere and places it in the center of the cube. The variable
> length stores the longest side among the width, length and height of the
> cube which will then be the radius for the boundSphere.

Did you subclass TCube or write your own? The code above is nothing like
in the SDK so if you've written your own TCube implementation you'll
have to post all of it or else it's impossible to say what the problem
is. By rough glancing over it it looks as if the problem might be
related to the "self startingPoint + (x@y@z)" which could be
inconsistent with the rendering of the cube. Impossible to say with just
the above code though.

Cheers,
   - Andreas
Reply | Threaded
Open this post in threaded view
|

Re: Trouble rendering with TBoundsphere

Phua Khai Fong
In reply to this post by Phua Khai Fong
I have attached together the class of the cube I have. The rendering part is done by me but the picking and pointer events are mostly copied from TDragCube with very slight modifications. To create the cube, you will need to assign values to the instance variable zEnd & endPoint. Try creating the cube at all 4 directions (north, south, east and west) and move around it and see if any of the cubes disappears on and off. Let me know if you need further information.

Thanks.


----- Original Message ----
From: Andreas Raab <[hidden email]>
To: [hidden email]; Phua Khai Fong <[hidden email]>
Cc: Darius Clarke <[hidden email]>
Sent: Wednesday, March 19, 2008 1:55:49
Subject: Re: [croquet-dev] Trouble rendering with TBoundsphere

Phua Khai Fong wrote:

> initBounds
>
>    | length x y z |
>    length := xLength max: (yLength max: (zEnd - zStart)).
>
>    x := xLength/2.
>    y := yLength/2.
>    z := (zEnd - zStart)/2.
>
>    boundSphere := TBoundSphere localPosition: (self startingPoint +
> (x@y@z)) radius: length.
>    boundSphere frame: self.
>
> As requested, the above is the message that instantiates the
> TBoundSphere and places it in the center of the cube. The variable
> length stores the longest side among the width, length and height of the
> cube which will then be the radius for the boundSphere.

Did you subclass TCube or write your own? The code above is nothing like
in the SDK so if you've written your own TCube implementation you'll
have to post all of it or else it's impossible to say what the problem
is. By rough glancing over it it looks as if the problem might be
related to the "self startingPoint + (x@y@z)" which could be
inconsistent with the rendering of the cube. Impossible to say with just
the above code though.

Cheers,
  - Andreas


Send instant messages to your online friends http://uk.messenger.yahoo.com

MyRectangle.st (15K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Trouble rendering with TBoundsphere

Tapple Gao
In reply to this post by Phua Khai Fong
On Tue, Mar 18, 2008 at 10:06:41AM -0700, Phua Khai Fong wrote:

>    initBounds
>
>        | length x y z |
>        length := xLength max: (yLength max: (zEnd - zStart)).
>
>        x := xLength/2.
>        y := yLength/2.
>        z := (zEnd - zStart)/2.
>
>        boundSphere := TBoundSphere localPosition: (self startingPoint +
>    (x@y@z)) radius: length.
>        boundSphere frame: self.

Dunno if this is the main problem, but I'm pretty sure tha
bounding sphere is too small, and the corners are outside the
sphere. the radius should be, by the pythagorean theorem:

length := (x squared + y squared + z squared) sqrt

where x, y, and z are as you defined them above: one half of the
rectangle edge lengths.

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

freeCAD port to Croquet progress

askoh
Administrator
In reply to this post by Phua Khai Fong
The video shows the progress made by two students of Multimedia
University, Malaysia on their final year project.
http://askoh.net//mmu/KhaiFong/Videos/GSoC%20Demo%20WMV/GSoC%20Demo%20WMV.html

For more infomation on freeCAD visit:
http://ar-cad.com.

All the best,
Aik-Siong Koh



Reply | Threaded
Open this post in threaded view
|

Re: freeCAD port to Croquet progress

Darius Clarke
Wonderful. Amazing. I can't believe your students have accomplished so much in so little time.
Is it the miracle of Smalltalk that helps or just perseverance?

Cheers,
Darius

On Wed, Mar 26, 2008 at 11:03 AM, Aik-Siong Koh <[hidden email]> wrote:
The video shows the progress made by two students of Multimedia
University, Malaysia on their final year project.
http://askoh.net//mmu/KhaiFong/Videos/GSoC%20Demo%20WMV/GSoC%20Demo%20WMV.html

For more infomation on freeCAD visit:
http://ar-cad.com.

All the best,
Aik-Siong Koh




Reply | Threaded
Open this post in threaded view
|

Re: freeCAD port to Croquet progress

Tapple Gao
In reply to this post by askoh
On Wed, Mar 26, 2008 at 11:03:35AM -0700, Aik-Siong Koh wrote:
> The video shows the progress made by two students of Multimedia
> University, Malaysia on their final year project.
> http://askoh.net//mmu/KhaiFong/Videos/GSoC%20Demo%20WMV/GSoC%20Demo%20WMV.html

I can't see the movie that (I presume) is supposed to be there.
Could you put it on YouTube or something?

--
Matthew Fulmer -- http://mtfulmer.wordpress.com/
Reply | Threaded
Open this post in threaded view
|

Re: freeCAD port to Croquet progress

askoh
Administrator
The youtube link is
http://www.youtube.com/watch?v=oG_bNp9raxc

Aik-Siong Koh

> On Wed, Mar 26, 2008 at 11:03:35AM -0700, Aik-Siong Koh wrote:
>> The video shows the progress made by two students of Multimedia
>> University, Malaysia on their final year project.
>> http://askoh.net//mmu/KhaiFong/Videos/GSoC%20Demo%20WMV/GSoC%20Demo%20WMV.html
>
> I can't see the movie that (I presume) is supposed to be there.
> Could you put it on YouTube or something?
>
> --
> Matthew Fulmer -- http://mtfulmer.wordpress.com/
>


Reply | Threaded
Open this post in threaded view
|

Re: freeCAD port to Croquet progress

askoh
Administrator
In reply to this post by Darius Clarke
Darius:

It is a combination of both. Smalltalk can make any programmer more
productive. But a lazy programmer cannot produce much even if he uses
Smalltalk.

The two students have been smart and hardworking. They took to Smalltalk
readily and were excited by Croquet and CAD. They will be applying for the
Google Summer of Code to continue their work. I continue to look for
sponsors to fund them after their graduation.

All the best,
Aik-Siong Koh

> Wonderful. Amazing. I can't believe your students have accomplished so
> much
> in so little time.
> Is it the miracle of Smalltalk that helps or just perseverance?
>
> Cheers,
> Darius
>