object positioning. 
Author Message
 object positioning.

Two queries here...

The easy one : how would you reflect where the mouse was
clicked in reference to the matrix world.  For instance a
point and click interface to place an object at a specific
location.  I haven't been able to find any commands that
do this So if anyone has figured it out great
;-)

The not so easy one : Say if I wanted to generate
thousands of objects of the same type.  I am currently
using a mesh class and creating 100 instances of it and
positioning them in random locations using the GetFVF and
GetVertexBuffer routines to allow vertex positioning.  It
works but takes so long it doesn't seem feasible for the
same piece of code   Any ideas on speeding this up?

Thanks in advance
Tina



Wed, 10 Nov 2004 06:11:10 GMT  
 object positioning.
Hi, Tina

This is  not a managed newsgroup.  If you are looking for a Microsoft
response, you should post in microsoft.public.win32.programmer.directx.

HTH,

John Eikanger
Microsoft Visual Basic Developer Support

This posting is provided AS IS with no warranties, and confers no rights.
(c) 2002 Microsoft Corporation.  All rights reserved.
--------------------
| Content-Class: urn:content-classes:message


| Subject: object positioning.
| Date: Fri, 24 May 2002 15:11:10 -0700
| Lines: 19

| MIME-Version: 1.0
| Content-Type: text/plain;
|       charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcIDb+ktbRvXh9V+Rq2V3uiwmrmI0A==
| Newsgroups: microsoft.public.vb.directx
| Path: cpmsftngxa08
| Xref: cpmsftngxa08 microsoft.public.vb.directx:3841
| NNTP-Posting-Host: TKMSFTNGXA08 10.201.226.36
| X-Tomcat-NG: microsoft.public.vb.directx
|
| Two queries here...
|
| The easy one : how would you reflect where the mouse was
| clicked in reference to the matrix world.  For instance a
| point and click interface to place an object at a specific
| location.  I haven't been able to find any commands that
| do this So if anyone has figured it out great
| ;-)
|
| The not so easy one : Say if I wanted to generate
| thousands of objects of the same type.  I am currently
| using a mesh class and creating 100 instances of it and
| positioning them in random locations using the GetFVF and
| GetVertexBuffer routines to allow vertex positioning.  It
| works but takes so long it doesn't seem feasible for the
| same piece of code   Any ideas on speeding this up?
|
| Thanks in advance
| Tina
|



Sun, 14 Nov 2004 06:51:29 GMT  
 object positioning.
Hi John,

I would surely not say the contrary, mainly if you confirm it,... but isn't is that
win32.programmer.directx  would be  C / C++  ? rather than VBish ?     :-)

Vanderghast, Access MVP


Quote:
> Hi, Tina

> This is  not a managed newsgroup.  If you are looking for a Microsoft
> response, you should post in microsoft.public.win32.programmer.directx.

> HTH,

> John Eikanger
> Microsoft Visual Basic Developer Support



Fri, 19 Nov 2004 19:37:40 GMT  
 object positioning.
Hi,

Q1.  You click on a surface, on a 2D surface which "project" (on a screen, like a film is projected
on a screen) the 3dWorld.  The position of the observer and the point on the 2D screen you clicked
on define a line (more or less perpendicular to the screen) and any 3D object INTERSEPTED by that
RAY  (a ray is half a line, a semi-infinite line, we do not want an object "behind" the observer)
may have been clicked on. DirectX supplies you with primitive that allows you to see if an object
is intercepted by a ray, or not, and you have to manage the tests (which are the objects to be
tested), or just test them all if they are few in number, to see which ones are the possible
candidates. Sure, the next step would be to say that only the one with the smallest z value is the
one the observer see, so, only this one is the one on which we click.

Q2.  Interesting, that is the question with an easy answer (Q1 was not... :-)   ). Do not change
the objects if they are perfect clones, just change the world transform matrix.  Pseudo code:

            Begin the scene rendering
            Set world transform matrix to  W1
            Draw object1
            Set world transform matrix to W2
            Draw object1,  AGAIN.
            End The scene rendering

If the W2 matrix is just a Z translation, with respect to W1, then, the second time we draw
Object1, it would appear at a different localisation than at the first time, and so, the observer
will SEE TWO objects, at different localisations.

Hoping it may help,
Vanderghast, Access MVP


Quote:
> Two queries here...

> The easy one : how would you reflect where the mouse was
> clicked in reference to the matrix world.  For instance a
> point and click interface to place an object at a specific
> location.  I haven't been able to find any commands that
> do this So if anyone has figured it out great
> ;-)

> The not so easy one : Say if I wanted to generate
> thousands of objects of the same type.  I am currently
> using a mesh class and creating 100 instances of it and
> positioning them in random locations using the GetFVF and
> GetVertexBuffer routines to allow vertex positioning.  It
> works but takes so long it doesn't seem feasible for the
> same piece of code   Any ideas on speeding this up?

> Thanks in advance
> Tina



Fri, 19 Nov 2004 19:50:58 GMT  
 object positioning.
Hi, Michel

win32.programmer.directx is >supposed< to be language neutral.  More people
do DirectX in C than VB, so both newsgroups are appropriate.  The
difference is that Tina, as an MSDN subscriber, has priority access to help
from Microsoft if she posts in a managed newsgroup.  If you have questions
about the program, you should send Rita an email.

HTH,

John Eikanger
Microsoft Visual Basic Developer Support

This posting is provided AS IS with no warranties, and confers no rights.
(c) 2002 Microsoft Corporation.  All rights reserved.
--------------------



| Subject: Re: object positioning.
| Date: Mon, 3 Jun 2002 07:37:40 -0400
| Lines: 25
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

| Newsgroups: microsoft.public.vb.directx
| NNTP-Posting-Host: mon-pq50-162.netcom.ca 216.123.143.2
| Path: cpmsftngxa07!tkmsftngxs01!tkmsftngxs02!tkmsftngp01!tkmsftngp05
| Xref: cpmsftngxa07 microsoft.public.vb.directx:3923
| X-Tomcat-NG: microsoft.public.vb.directx
|
| Hi John,
|
|
| I would surely not say the contrary, mainly if you confirm it,... but
isn't is that
| win32.programmer.directx  would be  C / C++  ? rather than VBish ?     :-)
|
|
| Vanderghast, Access MVP
|
|


| > Hi, Tina
| >
| > This is  not a managed newsgroup.  If you are looking for a Microsoft
| > response, you should post in microsoft.public.win32.programmer.directx.
| >
| > HTH,
| >
| > John Eikanger
| > Microsoft Visual Basic Developer Support
| >
|
|
|
|



Sat, 20 Nov 2004 00:05:47 GMT  
 object positioning.

Quote:
>-----Original Message-----
>Hi,

>Q1.  You click on a surface, on a 2D surface

which "project" (on a screen, like a film is projected
Quote:
>on a screen) the 3dWorld.  The position of the observer

and the point on the 2D screen you clicked
Quote:
>on define a line (more or less perpendicular to the

screen) and any 3D object INTERSEPTED by that
Quote:
>RAY  (a ray is half a line, a semi-infinite line, we do

not want an object "behind" the observer)
Quote:
>may have been clicked on. DirectX supplies you with

primitive that allows you to see if an object
Quote:
>is intercepted by a ray, or not, and you have to manage

the tests (which are the objects to be
Quote:
>tested), or just test them all if they are few in number,

to see which ones are the possible
Quote:
>candidates. Sure, the next step would be to say that only

the one with the smallest z value is the

Quote:
>one the observer see, so, only this one is the one on
which we click.

... erm.. I think that can wait until a bit later on but
thanks nonetheless..

Quote:

>Q2.  Interesting, that is the question with an easy

answer (Q1 was not... :-)   ). Do not change
Quote:
>the objects if they are perfect clones, just change the

world transform matrix.  Pseudo code:
Quote:

>            Begin the scene rendering
>            Set world transform matrix to  W1
>            Draw object1
>            Set world transform matrix to W2
>            Draw object1,  AGAIN.
>            End The scene rendering

>If the W2 matrix is just a Z translation, with respect to

W1, then, the second time we draw
Quote:
>Object1, it would appear at a different localisation than

at the first time, and so, the observer

Quote:
>will SEE TWO objects, at different localisations.

yes, that does seem a lot easier but I'll try it out and
see if it is any faster than the current routine I am
using.  Thanks, this does indeed position them separately
but methinks VB DirectX was not designed to be as multi-
Object based as I am using it for... we were hoping to be
able to display 1000s of ships on the screen at the same
time.. say for a battle simulation.

Quote:

>Hoping it may help,
>Vanderghast, Access MVP



>> Two queries here...

>> The easy one : how would you reflect where the mouse was
>> clicked in reference to the matrix world.  For instance
a
>> point and click interface to place an object at a
specific
>> location.  I haven't been able to find any commands that
>> do this So if anyone has figured it out great
>> ;-)

>> The not so easy one : Say if I wanted to generate
>> thousands of objects of the same type.  I am currently
>> using a mesh class and creating 100 instances of it and
>> positioning them in random locations using the GetFVF
and
>> GetVertexBuffer routines to allow vertex positioning.  
It
>> works but takes so long it doesn't seem feasible for the
>> same piece of code   Any ideas on speeding this up?

>> Thanks in advance
>> Tina

>.



Sat, 20 Nov 2004 02:46:56 GMT  
 object positioning.
Hi Tina,

In fact, there is roughly only two choices:  you compute every thing (scaling and translations) or
you leave DirectX doing it. Basically, that would be the same amount of computation, so, indeed,
playing with the World transformation matrix is letting DirectX making the math (while you can do
it by your own program, too).

There are more. You can use adapatative mesh and textures, or if you prefer, define different
"precisions" for you boat. Assume, for illustration, we want to display ear of horses, or dogs. If
the horse is close, maybe we need 16 triangles, but if the horse is far, only one triangle is
enough to render one ear, since the fine details would be lost anyhow. So, indeed, you can loop
through the 1000 boats and, if the actual one is far, use a reduced representation, but if it is
close, use a highly defined representation. Also remember that textures may allow to use a very
rough triangulations:  for a wall brick, we generally use two triangles, one texture, for the whole
wall, not two triangles per brick in the wall.... :-)

            Begin Scene Rendering
                For each boat
                    Set World Transform Matrix for Boat "i"
                    If Boat Is far
                            Boat.RenderLooselyDetailled
                    Else
                            Boat.RenderWithMaximumDetails
                    End If
                Next boat
            End Scene

and I would not be surprised at all to see DirectX rendering those 1000 boats relatively fast.

Vanderghast, Access MVP


Quote:

> >-----Original Message-----
> >Hi,

> >Q1.  You click on a surface, on a 2D surface
> which "project" (on a screen, like a film is projected
> >on a screen) the 3dWorld.  The position of the observer
> and the point on the 2D screen you clicked
> >on define a line (more or less perpendicular to the
> screen) and any 3D object INTERSEPTED by that
> >RAY  (a ray is half a line, a semi-infinite line, we do
> not want an object "behind" the observer)
> >may have been clicked on. DirectX supplies you with
> primitive that allows you to see if an object
> >is intercepted by a ray, or not, and you have to manage
> the tests (which are the objects to be
> >tested), or just test them all if they are few in number,
> to see which ones are the possible
> >candidates. Sure, the next step would be to say that only
> the one with the smallest z value is the
> >one the observer see, so, only this one is the one on
> which we click.

> ... erm.. I think that can wait until a bit later on but
> thanks nonetheless..

> >Q2.  Interesting, that is the question with an easy
> answer (Q1 was not... :-)   ). Do not change
> >the objects if they are perfect clones, just change the
> world transform matrix.  Pseudo code:

> >            Begin the scene rendering
> >            Set world transform matrix to  W1
> >            Draw object1
> >            Set world transform matrix to W2
> >            Draw object1,  AGAIN.
> >            End The scene rendering

> >If the W2 matrix is just a Z translation, with respect to
> W1, then, the second time we draw
> >Object1, it would appear at a different localisation than
> at the first time, and so, the observer
> >will SEE TWO objects, at different localisations.

> yes, that does seem a lot easier but I'll try it out and
> see if it is any faster than the current routine I am
> using.  Thanks, this does indeed position them separately
> but methinks VB DirectX was not designed to be as multi-
> Object based as I am using it for... we were hoping to be
> able to display 1000s of ships on the screen at the same
> time.. say for a battle simulation.

> >Hoping it may help,
> >Vanderghast, Access MVP



> >> Two queries here...

> >> The easy one : how would you reflect where the mouse was
> >> clicked in reference to the matrix world.  For instance
> a
> >> point and click interface to place an object at a
> specific
> >> location.  I haven't been able to find any commands that
> >> do this So if anyone has figured it out great
> >> ;-)

> >> The not so easy one : Say if I wanted to generate
> >> thousands of objects of the same type.  I am currently
> >> using a mesh class and creating 100 instances of it and
> >> positioning them in random locations using the GetFVF
> and
> >> GetVertexBuffer routines to allow vertex positioning.
> It
> >> works but takes so long it doesn't seem feasible for the
> >> same piece of code   Any ideas on speeding this up?

> >> Thanks in advance
> >> Tina

> >.



Sat, 20 Nov 2004 19:42:16 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Managing object positions during a form-resize event

2. object position

3. Iterate through a hashtable, a get an object by Position

4. DirectX 9 help... positioning objects

5. Position of a datarow object?

6. finding position of chart objects?

7. Word Object Model : Find a position within a Range or Selection

8. Objects not positioning correctly

9. Tabstrip Control - Positioning Tab Object

10. Text positioning problems with VB5 printer object

11. How to get ABSOLUTE position of an Object?

12. Object aware of position??

 

 
Powered by phpBB® Forum Software