Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Go Back  Xtreme Visual Basic Talk > > > > Simple problem? - 2D screen space coordinates from 3D world space coordinates


Reply
 
Thread Tools Display Modes
  #1  
Old 06-04-2007, 07:21 AM
ventsim ventsim is offline
Newcomer
 
Join Date: Jun 2007
Posts: 1
Default Simple problem? - 2D screen space coordinates from 3D world space coordinates


Hi,

I'm new to direct3d and I'm trying to find out if there is an easy way to access the transformed 2d screen space coordinates of a custom vertice list that is rendered to screen after transforming from world coordinates.

I'd like to do this as a simple way to mouse select single 3d objects or fence select multiple objects on the screen. Or do I need to manually transform the vertex list as a seperate array?


Monz
Reply With Quote
  #2  
Old 01-21-2008, 03:18 PM
AdrianDeAngelis's Avatar
AdrianDeAngelis AdrianDeAngelis is offline
Contributor
 
Join Date: May 2005
Location: Australia
Posts: 549
Default

To transform from 3D space to screen space first multiply the 3D vertex co-ordinates by the current world matrix then the current camera matrix and then the current projection matrix. The order is VERY important.

You will then have your screen co-ordinates from -1, -1 (bottom left screen) to 1, 1 (top right screen) with 0,0 being the screen centre. Multiply the results by half the screen width & height & add half the screen width & height. This can also be done in matrix form. I suggest that you multiply all the matrices together to make a single matrix which you use to do all the transformations in a single go for batch processing.

For selecting 3D points this will work OK-ish but if your camera will be zooming in and out a lot, using a fixed collision area will sometimes be too big or small. You would be best doing the reverse, transforming your screen mouse clicks into a 3D ray and then doing a ray-sphere intersection with a bounding sphere around your objects.

Check the forum for this, I had a similar issue a while back and the solution should already be posted
__________________
Automation error... What do you mean automation error you %#@*&!$ thing!

Star Admiral: 3D tactical space sim *** New Version 0.38 10/01/09 ***
Damage, shields and special weapons systems
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
 
Simple problem? - 2D screen space coordinates from 3D world space coordinates
Simple problem? - 2D screen space coordinates from 3D world space coordinates
 
-->