Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8728723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:42:15+00:00 2026-06-13T08:42:15+00:00

I have a background image on a Direct3D canvas. I am drawing a circle

  • 0

I have a background image on a Direct3D canvas. I am drawing a circle at a specific position on the background. After the canvas is zoomed/panned with a camera (using world/view/projection), the background is updated.

Now the problem is, I can’t find the previous position on the image to redraw the circle. I’m using the following function (DirectX 11.1) to find the coordinate. But it’s not working.

XMVECTOR Camera::Unproject(Windows::Foundation::Rect viewPort, Windows::Foundation::Point location)
{
XMFLOAT3 worldPosition(location.X, location.Y, 0.0f);
XMVECTOR worldVector = XMLoadFloat3(&worldPosition);
return XMVector3Unproject(worldVector, viewPort.X, viewPort.Y, viewPort.Width, viewPort.Height, 0.0f, 1.0f, this->Projection(), this->View(), this->World());   
}

I even tried with XMMatrixIdentity as the world. But no success.
Can anyone please help me?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:42:16+00:00Added an answer on June 13, 2026 at 8:42 am

    This is a non-trivial problem with the information you provided.

    A 2D-point on the screen cannot be mapped to one 3D-point in the scene. Every 2D-point maps to a whole ray. Therefore, if you draw a circle on a specific 2D-position, the circle can be placed on various positions in the scene. That’s probably why you get some strange looking results.

    If you move the camera, the ray will probably become “more visible”. I.e. it will not map to a single 2D-point, but a 2D-ray. And your circle is placed somewhere on this ray. You see, there is no way to get the new position of the circle with the provided information. You can only say that it is somewhere on a certain ray.

    But perhaps you can specify the circle’s position. Maybe it is placed on an object, on a virtual plane or something like that. Then this problem is solveable.

    First, you have to find the 3D-position of the circle. Use XMVector3Unproject twice. Once with a z-coordinate of 0 and once with 1. This will give you a point very close to the camera and one that is far away. This is your ray. You then have to compute the position of the circle on that ray. E.g. by intersecting the ray with a plane. This 3D-position can be projected back onto the screen (XMVector3Project) with the new camera parameters and defines the new circle position.

    And yes, you should probably define the Identity matrix as the world matrix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a background image I am drawing with open gl 1.0 es. The
Is it possible to have transparent background image using CSS3? background: url(../img/bg_paperlines.jpg) repeat-x; Using
I am setting the background-image of some elements using css (some elements have no
I have a background image that I'd like to position just off the edge
I have an image that I am using as my background and am trying
I'm using the new CSS3 spec background-size to have a background image that slightly
I'm using the new CSS3 spec background-size to have a background image that slightly
I have a background image for a canvas, and added a few basic elements
For my mobile-desktop nav-bar I have background buttons (default). On top I'm using :after
I have background image for a site header with fixed width. Now I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.