|
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.
|
# ¿ Nov 25, 2007 23:20 |
|
|
# ¿ May 3, 2024 00:13 |
|
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.
|
# ¿ Nov 25, 2007 23:53 |
|
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. 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.
|
# ¿ Nov 26, 2007 04:32 |
|
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.
|
# ¿ Dec 1, 2007 02:42 |
|
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? *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 |
# ¿ Dec 2, 2007 21:39 |
|
|
# ¿ May 3, 2024 00:13 |
|
Vinlaen posted:Are there any game engines (or frameworks/libraries) that include automatic network synchronization of game objects? You could try raknet.
|
# ¿ Mar 1, 2008 02:34 |