Jump to content

  • Log In with Google      Sign In   
  • Create Account


AdeptStrain

Member Since 19 Mar 2012
Offline Last Active Yesterday, 07:21 PM

Posts I've Made

In Topic: 3D UI transformation matrix

05 September 2014 - 02:39 PM

Sounds like you have your widgets in currently in screenspace. If you want them 3D you probably want them in world space (again, just out in front of your camera), rotate them there, and then multiply them by your ViewProjection matrix. Your view matrix doesn't make much sense to me, you're treating it like you're still in screen space when you're not.

 

If this is your first foray into 3D graphics you may want to read up on some linear algebra/matrix transformation tutorials (I don't know any great ones off the top of my head, maybe someone has a good suggestion and can chime in). Or am I misunderstanding your issue?


In Topic: 3D UI transformation matrix

05 September 2014 - 08:24 AM

Off the top of my head, there's probably a could of ways you could do this:

 

  • Set your WIdgets transform to be your camera's position, then offset it a bit and rotate to get it how you want. Probably want to turn off depth filtering/writing as well.

or

  • Render all your widgets to separate texture (all rotated and such just using normal matrix math), then draw the UI as full screen quad over your scene before you present the frame.

The only real difference is one uses your camera and one has no camera and all your widgets are rendered around the origin and then rendered a final time over the scene. There might be some even simpler method, but these are just some ideas off the top of my head.


In Topic: How to get rid of camera z-axis rotation

24 August 2014 - 01:03 PM

You only need to update the view matrix before rendering as that is where it is used (obviously if you needed the camera or the view matrix for some math reason, i.e. culling, you could grab it sooner). Using the code above, you can call your "UpdateViewMatrix2" as much as you want but it's just going to be a waste if you aren't actually about to use that matrix.


In Topic: Terrain patch border issue

24 August 2014 - 09:30 AM

The general way I've seen people deal with this issue is just adding the 1 pixel padding so your patches overlap at the borders. If you look into World Machine's tiling functionality - that's exactly what it does to solve this problem.


In Topic: How to get rid of camera z-axis rotation

24 August 2014 - 09:09 AM

It's probably the most simple way to prevent Z rotation - not to mention it gives you a very easy way to see the exact rotation parameters of your camera (which is going to be difficult when trying to deconstruct a full rotation matrix). You can also limit either of the axis very simply by changing the min/max values of each axis which comes in handy for gameplay and the like. Also blending values smoothly between cameras, etc.

 

What lock are you referring to? The Yaw isn't locked at all, that's a full 360 degree circle. The pitch is locked to +/-90 degrees - any more and you end up "upside down". Change the clamp values to be -Pi and Pi and you'll see what I'm saying.

 

This setup should work fine for both a free camera and first person camera (as well as third person if you decide to go down that route).


PARTNERS