Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Madox
Oct 25, 2004
Recedite, plebes!

Subotai posted:

How do I translate screen space coordinates to world space coordinates in D3D? For instance I have a texture that is 200x100 pixels and I want to find out the world space size for that texture. How the 200x100 translates to world space coordinates.

You question doesn't really make sense. It doesn't matter what screen size a texture is. It can be stretched onto any sized surface in world space. On the other hand, if you were to display the texture on the front clip plane without stretching it, it would still appear to be be 200x100.

Adbot
ADBOT LOVES YOU

Madox
Oct 25, 2004
Recedite, plebes!

Subotai posted:

Well I have a texture I am dynamically generating and putting text on it and then putting it on a billboard. The billboard size is defined in world space coordinates and I need it to match the texture size which is defined in pixels. If the sizes dont match the text looks stretched or squished.

Sounds like you just need to make sure to make sure the height:width ratio of the billboard quad is the same as the texture's ratio. Then it won't look stretched/squished. As HB said, also, it may still look not-right if the projection/viewport is set up to do something out of the norm.

If the texture is not going to cover the entire billboard, you still need to make sure the ratio of your UV coordinates is the same as the texture's ratio, but the billboard shape itself won't matter.

Madox
Oct 25, 2004
Recedite, plebes!

Subotai posted:

Does anyone know how to render a billboard using screen-space coordinates instead of world space in D3D? I want to put a billboard at x,y screen space coordinates.

If you aren't talking about rendering to the screen for a UI type thing, ignore me :p

If you are using DirectX, you can use D3DFVF_XYZRHW instead of D3DFVF_XYZ, I believe. Its been a while since I used that one, but it should let you specify vertex coordinates in screen space, bypassing any world transform. Remember that the screen space cordinates go from -1 to 1 in DX.

Personally, I prefer to work in actual screen coordinates for my UI, so I use D3DFVF_XYZ type vertices and scale the x and y coordinates to the screen size in my shader something like :

position.x = position.x * 2.0 / screenWidth - 1.0 - halfpixel;
position.y = position.y * 2.0 / screenHeight - 1.0 - halfpixel;
position.zw = 1.0;

where half pixel is 0.5 * screenWidth, etc

Madox
Oct 25, 2004
Recedite, plebes!

Citizen Erased posted:

What I can't work out how to do is translate the verticies in the direction they are now facing. What do I do to the x,y,z position coordinates to make them move in this abritrary direction?

First, you should find out what is the forward direction of your vertex ring when it is unrotated. For this post, I will assume this is going to be the +z direction, so that vector would be (0,0,1). It sounds like you already have the rotation matrix for the given vertex ring. To translate it in the direction it is facing, transform the forward direction vector by your rotation matrix and use that.

newPosition = oldPosition + ((0,0,1) * distanceToMove * rotationMatrix)

Madox
Oct 25, 2004
Recedite, plebes!

Nyvinyd posted:

How would you guys suggest for someone to start from the absolute bottom?

I started with the book 'The C Programming Language' by Kernighan and Ritchie to learn C. That book has exercises in it to boot, so I did all of those then moved on to writing my own text adventure games on *NIX (giving away my age). These days it wouldn't be so bad to start with the same book, desite everything being all C++ OOP. Most of the lanugage basics are still the same as C, and with game development you often want to squeeze out every tiny bit of performance, which often means resorting to some C code in your C++ app. I can't recomend a C++ book since all I read these days are reference books, but you'd definately want something to get you familiar with the C++ features, OOP and patterns etc.

Once you have the language down, you can move onto working with actual graphics simply using the Windows GDI library. Spend a bit of time learning how a basic window program / message pump works and get familiar with working with lines/colour/bmps/tiles etc. You can learn MFC but its not so important anymore. You do not want to use MFC for a game. Alternatively, you can learn C# if you plan to go the XNA route. I don't know a lot about XNA.

Following that you can start looking into DirectX and you should have enough footing to be able to take apart the sample code and other people's apps (Replace DirectX with OpenGL/3rd party engine if you like). The big challenge here is wrapping your head around shader programming. (Oh and maybe math).

That's basicly how I learned so that's all I can recommend really. I skipped the part about learning COM. Also, I'm not big on using engines because I'm more interested in figuring out how to render stuff than in making the game itself, so your goal may be different than mine.

Madox
Oct 25, 2004
Recedite, plebes!

Twiggy794 posted:

I've been Googling around and perusing the Microsoft Connect website for this beta but I can't find anything. Is it closed?

Looks like you should be able to get it from here.
http://creators.xna.com/beta/betahome.aspx

Madox
Oct 25, 2004
Recedite, plebes!

George Kaplan posted:

I've done a search and can't find anything. Is there somewhere I can find goons with XBL Creators Club memberships to discuss a game I'm working on? Just need to get an opinion on what direction I should take it in.

I have XBL Creators Club membership. What kind of discussion would you like. I have PM if you want to use that. I've worked at a game place in the past and fiddle with my own projects, but I'm no expert.

Madox
Oct 25, 2004
Recedite, plebes!

nibe posted:

One button might perform a simple function that doesn't need any arguments, and another button might "spawn x," where I would like to pass x to the delegate. I don't know much about delegates and how you're supposed to use them so I could be doing it wrong. I haven't used WinForms, but that pattern seems like a better version of my catch-all idea.

But maybe I just need to understand delegates better. In your example, why is the button passed in the function? In my code the definition of the delegate is in the Button class, and I create functions elsewhere that are passed to the Button on instantiation, and stored in the delegate. As I mentioned, they don't have any parameters right now. When the Button decides it was clicked, it calls its delegate. Based on what you posted, it looks like WinForms does it differently.

I've written my own UI (twice) for windows and xbox, so I can try to answer some.

Often passing the button in to the function isn't useful and you can ignore it, but sometimes you want to have different behaviour based on which button was used to trigger the delegate (maybe theres 2 or 3 buttons for the same task in various windows). Or you might want to adjust the button to display some indication that an action was recieved.

All of my widgets are set up to fire events which have an event code, and a parameter struct much like the ClickEventArgs example above. When a button is clicked, it tells a global EventManager to trigger event X, which in turns notifies anything that wants to be told about event X's (typical producer/consumer deal). This lets the widgets not really care about what object they need to be hooked up to etc.

Madox
Oct 25, 2004
Recedite, plebes!
Hey guys - For the last week I've been making a GUI front end for the LibNoise perlin noise library. If you use perlin noise to make height maps or textures, try out my tool and tell me what you think.

I use a lot of heightmaps in my projects, and I was tired of having to twiddle code all the time to manipulate the heightmap generator. I wanted some way to see the effects of different settings, so I made this.

The download is availble on github: https://github.com/MadoxLabs/NoiseTool/downloads

The instructions can be found at https://github.com/MadoxLabs/NoiseTool/wiki

If you don't want to read them, you should at least know that there is a pullout menu on the bottom of each window, and right click parameters to make them type-ins.

Please tell me of any bugs/feature requests or enter them on github.

Here is a sample image:
http://i.imgur.com/w6sOn.jpg

Adbot
ADBOT LOVES YOU

Madox
Oct 25, 2004
Recedite, plebes!

OneEightHundred posted:

Apparently SetPixel is the slowest function on the planet.

Anyway, hard part's done!



Hey I just read back to see what you are talking about. I'd be very interested in a c# version of an mpeg player. I wrote my own AVI library because it looked easier, but I can definitely use an mpg library.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply