How to Import or Draw a Plane in XNA? - c#

I'm implementing a small software and am having trouble getting the Draw Geometry! How I can do this?
Thank you.

Your question is very vague. If you want to draw some vertexes you have to use the GraphicsDevice draw methods otherwise if you need to draw some sprites you have to use the SpriteBatch draw method. If you want to import a model you can exploit the draw method of the Model class.
If you're starting from a scratch I recommend you to give a look to those step-by-step tutorials:
Your First Game - XNA Game Studio in 2D
Displaying a 3D Model on the Screen
Draw a Textured Quad

Related

I imported an image in my project in unity and it doesn't blend with the lighting ; cause in the dark light i can still see the image pretty clear

I imported an image instead of a 3d model for am enemy, and the game is supposed to be in dark at night but the image is not blending with the rest of the environment so can anyone plz help.
If it is set to sprite it uses an unlit shader that does not respond to lighting. If you have it on a material as the albeto channel on a 3D plane, it will respond to lighting but only as a flat surface. Unless you also have a normal map for it.

Get texture from images through 3D projection

In my (limited) experiences on 3D programming, usually we set up a 3D model with materials and texture, then set up the light and camera. Finally we can get a 2D view through the camera.
But I need to reverse this procedure: given a 2D view image, a camera setup, and a 3D model without texture, I wanted to find the texture for the model such that it results in the same 2D view. To simplify we ignore the light and materials, assuming they are even.
Although not easy, I think I can write a program to do this. But are there any existing wheels out there so I don't have to invent it again? (C#, WPF 3D or openCV)
Helix3d Toolkit for WPF has an interesting example called "ContourDemo". If you download the whole source you get a very comprehensive example app showcasing its capabilities.
This particular example uses a number of helper methods to generate a contour mesh from a given 3D model file(.3ds, .obj, .stl).
With some extending this could be the basis of reverse calculating the uv mapping, possibly.
Even if there is nothing suitable to perform the core requirement (extracting the texture) it is a great toolkit for displaying your original files and any outputs you have generated generated.

Xna 2D overlay text in 3D?

How would I go about drawing 2D text in Xna while my game is in 3D. Basically I want it to overlay over the screen, not draw it in a certain position in the 3D environment.
The SpriteBatch, documented here, will allow you to write 2D text, check a tutorial like this one. See DrawString. Here's a simple example from Microsoft.

3D objects for Kinect application

Currently i am working on kinect Virtual Jewel shop app. In which user can able to choose the jewels and check how it looks .
The App started with 2d images where it does not look realistic .
so can any one suggest your ideas for the following queries.
How to make the 2D images realistic without going forward for 3D?
I choose 3d for fitting the jewels with neck , we can skew and rotate the images in 3D. Whether the same thing can be accomplished by 2d? if so how can we do it.
For going forward with 3d is there any tool available to convert the 2D images into 3D?
I am zero and new to 3D objects, pls tell me how we can sit the 3D object in skeleton data. is there any format available in 3D ?
The current application is in wpf 4.0 so How can we use the 3D object in WPF ??
I don't think it can look realistic without 3D. But you can generate a 3D mesh with the form of the jewel.
(See this to get the idea http://fenicsproject.org/_images/hollow_cylinder.png ).
And put your 2D images like a texture on the mesh.
Check the riemers tutorials.
http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series2/Textures.php

Xna: drawing dynamics alpha map

I need to draw simple alpha maps in xna which depends on current game state. I cannot save many kinds of alpha maps in reseources, so i want to draw them dynamically.
For example sprite can be partially hidden behind wall.
I think about using System.Drawing, but when i'm including this dll, there are conflicts with Xna namespaces. Is there another way to draw simple bitmaps in xna?
Thank you for your time.
You should not use the System.Drawing classes. These work on images that lie in the system RAM. Instead use XNA to manipulate a texture that lies in GPU memory.
You can use SetRenderTarget() to set the texture as the render target. This will cause further draw calls to be executed on the texture. This way, you can draw everything on the texture. However, you will not have methods for drawing circles, squares etc. To achieve this, you should either create vertex buffers with the according geometry or use a sprite template.

Categories

Resources