[gameprogrammer] Re: selection / picking on terrain geometry

For most graphics / rendering stuff I would agree, but when it comes to selection/feedback, thats on a different level I think (but who knows, im probably wrong)
Im not sure that the opengl picking./selection stuff is hardware supported either..


-Josh

Alan Wolfe wrote:
oh yeah, the reason i think that's true is that they both rely on the same hardware specs so at the core, they should have all the same functionality, so long as we aren't talking about software only extensions


On 4/1/06, *Alan Wolfe* <alan.wolfe@xxxxxxxxx <mailto:alan.wolfe@xxxxxxxxx>> wrote:


A total stab in the dark, I think DX must have the same picking
that GL can do. In my experience, I've seen everything in DX that
can be done in GL, just going by a different name and different
function calls to make it happen, but sometimes really really
close looking code otherwise (:
On 4/1/06, *Josh Stewart* <aek@xxxxxxxxx <mailto:aek@xxxxxxxxx>>
wrote:


        Thankyou everyone for your help,
        Out of curiosity, does DirectX support any kind of picking /
        selection
        like opengl ? (are there any directx buffs on this list? :)

        I am trying to write my graphics interface so that it is
        independant of
        API, but if I provide any support to OpenGL picking system, I
        am trying
        to think of the best way to make it generic enough so that a
        DirectX
        implementation of my abstract Graphics could plugged on
        without much fuss.

        From what I have read, directx favours "do it yourself" and
        doesnt
        provide this.. If thats so, has anyone compared/measured the
        opengl
        picking system vs their own implementation?

        -Josh

        >> From: Josh Stewart < aek@xxxxxxxxx <mailto:aek@xxxxxxxxx>>
        >> Reply-To: gameprogrammer@xxxxxxxxxxxxx
        <mailto:gameprogrammer@xxxxxxxxxxxxx>
        >> To: gameprogrammer@xxxxxxxxxxxxx
        <mailto:gameprogrammer@xxxxxxxxxxxxx>
        >> Subject: [gameprogrammer] Re: selection / picking on terrain
        geometry
        >> Date: Sat, 01 Apr 2006 10:13:24 +0800
        >>
        >> Hi Shaun,
        >> That sounds like a quick and effective way of doing it. My
        terrain is
        >> heightmap generated and stored in a grid also (for now
        anyway). I
        >> have figured out how to create the ray from the camera, but
        was still
        >> looking for an optimal solution for searching all of the
        polys in the
        >> terrain for an intersection. I was thinking I might need an
        octtree,
        >> but thats something else I havent done yet :)
        >> If you have some sample code that would be great.
        >>
        >> Much appreciated.
        >> Josh
        >>
        >> Shaun Simpson wrote:
        >>>
        >>> Hey Josh ..
        >>>
        >>> for a university project a friend and i divised a test for
        working
        >>> out terrain intersection for a 3d rts we were creating, our
        terrain
        >>> was in a grid format (stored in a 2d array) with each point
        >>> containing a height value, we worked out the intersection by
        >>> translating the camera's coordinates onto the terrain and then
        >>> firing a ray from the camera, by stepping forward along the
        ray at
        >>> grid sized intervals we would check to see if it was lower
        than the
        >>> height of the terrain if so that was our intersection
        tile., it is
        >>> fairly accurate as long as you have small size tiles.. i
        still have
        >>> have the code and can search out and forward the code if
        you wish,
        >>> im not sure how applicable it is but for ourselves it was the
        >>> simpliest solution and very cost effective.
        >>>
        >>> Shaun
        >>> shaun_simpson_@xxxxxxxxxxx <mailto:shaun_simpson_@xxxxxxxxxxx>
        >>>
        >>>
        >>>> From: Josh Stewart <aek@xxxxxxxxx <mailto:aek@xxxxxxxxx>>
        >>>> Reply-To: gameprogrammer@xxxxxxxxxxxxx
        <mailto:gameprogrammer@xxxxxxxxxxxxx>
        >>>> To: gameprogrammer@xxxxxxxxxxxxx
        <mailto:gameprogrammer@xxxxxxxxxxxxx>
        >>>> Subject: [gameprogrammer] Re: selection / picking on
        terrain geometry
        >>>> Date: Fri, 31 Mar 2006 00:18:39 +0800
        >>>>
        >>>> I think that I will do this method with the ray/poly
        intersection
        >>>> test.
        >>>> I will have to think of a way to limit the testing to only
        terrain
        >>>> polygons that are actually visible in the window (the
        terrain isn't
        >>>> split up so non visible terrain isnt being culled atm)
        >>>>
        >>>> If I choose the method where I read the depth buffer and
        transform
        >>>> that back to world coordinates, I think that I may have
        problems
        >>>> clicking on the terrain if there is ever anything drawn
        over the
        >>>> top of it (trees, particles, units), as  the depth buffer
        only
        >>>> contains the last Z value of the item closest to the camera.
        >>>>
        >>>> Although maybe I can use some depth buffer hackery with
        >>>> glDepthFunc(GL_GREATER), assuming the terrain is always the
        >>>> furthest thing away, but that will surely mess with my
        rendering.
        >>>>
        >>>> Just have to find a good ray / poly intersection test that
        returns
        >>>> the point of intersection. My maths book has a sample from
        Graphics
        >>>> Gems I ... I do wonder if there are newer methods though.
        >>>>
        >>>> Js
        >>>>
        >>>> Simon Mihevc wrote:
        >>>>> You could do it by searching for an intersection betwen your
        >>>>> terrain and a ray. Get the ray by projecting the mouse
        coordinates
        >>>>> onto 2 different z planes, which gives the starting point
        and the
        >>>>> direction vector for the ray. Then find the point on the
        terrain,
        >>>>> that is closest to the ray for various ray lengths.
        >>>>> Finding the point that is nearest to the ray is the
        problem here
        >>>>> since there are a lot of points and there's no time to
        check them
        >>>>> all. A bit of knowledge of linear algebra and algorithms
        helps here.
        >>>>>
        >>>>>> I must be working on a project because, thats right
        folks, I have
        >>>>>> another question :)
        >>>>>> :)
        >>>>>>
        >>>>>> Assuming standard 3D RTS with 3D terrain and a 3rd person 45
        >>>>>> degree camera (fixed or not, I havent decided yet)
        >>>>>>
        >>>>>> Using OpenGL selection / picking it seems that selection
        of units
        >>>>>> in an RTS game, using a mouse, is relatively easy.
        >>>>>> However I am having trouble figuring out the best way to
        click on
        >>>>>> a point on the screen where there are no units, and have
        the game
        >>>>>> know the point on the terrain, where the user clicked.
        >>>>>> The terrain is 1 large piece of geometry that is
        generated from
        >>>>>> heightmap and optimised. I cannot just give it a name as
        clicking
        >>>>>> anywhere will just return the selection stack with the
        name of
        >>>>>> the terrain.
        >>>>>> How can I find the point on the terrain where I was
        directing my
        >>>>>> click.
        >>>>>>
        >>>>>> An example might be selecting some units and then
        clicking on an
        >>>>>> empty space to "move here"
        >>>>>>
        >>>>>> Any help or suggestions, including further reading links
        to books
        >>>>>> or sites that tackle the subject, is appreciated.
        >>>>>> Thankyou
        >>>>>>
        >>>>>> Josh Stewart
        >>>>>>
        >>>>
        >>
        >


--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html






---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: