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
Subotai
Jan 24, 2004

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.

Adbot
ADBOT LOVES YOU

Subotai
Jan 24, 2004

Madox posted:

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.

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.

Subotai
Jan 24, 2004

Madox posted:

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.


Hmm well keeping the ratio does keep the text from looking out of proportion, but it seems that I still need to make sure the billboard is roughly the same size as the texture the text is on, because making a 14 point font the size of a third of the screen makes the text fuzzy. So anyway I looked up some info on transforms and I think I might have the solution. I have to test out the code though.

Subotai
Jan 24, 2004

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.

Subotai
Jan 24, 2004

Ugg boots posted:

You'll want to use the inverse of your World-To-Screen Matrix to find a Screen-To-World Matrix to transform your points with. Then you can just draw your billboards there.

Do you have an example of how to get the Screen-To-World matrix? :confused:

*edit*
Ohh I think I just figured out how to get the inverse. Then I can just use that and I should be set?

Subotai fucked around with this message at 21:43 on Dec 2, 2007

Adbot
ADBOT LOVES YOU

Subotai
Jan 24, 2004

Vinlaen posted:

Are there any game engines (or frameworks/libraries) that include automatic network synchronization of game objects?

For example, if I create a Worms or Scorched Earth game I would to shoot a projectile (using simple physics) and have it follow the same trajectory on every game client. I'd also like to include environment physics objects like black holes, etc, etc.

It seems like no game engines include automatic network synchronization... :(

You could try raknet.

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