Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing 3D text rendering #364

Closed
wants to merge 2 commits into from
Closed

Fixing 3D text rendering #364

wants to merge 2 commits into from

Conversation

@phr00t
Copy link
Contributor

phr00t commented Feb 3, 2019

PR Details

Fixes rendering of 3D text when not fullscreen or buildboard.

Description

Instead of just calculating one world view projection matrix at the start of the string, I calculate a world view projection matrix for each glyph. This isn't needed in 2D rendering, so it should check somewhere if it is 3D text or not for performance reasons. There are probably other better ways to go about this, but this fixes the function problem in hopes of a better production solution.

I also have to set RealVirtualResolutionRatio to (1f, 1f), or else scaling is all messed up in 3D. I'm sure this value is useful in 2D somewhere, though, so again -- it needs to know when it is rendering in 3D (so it can just set this Vector2 to (1f, 1f) or in 2D and calculate it).

Related Issue

#314

Motivation and Context

3D text simply doesn't work in Xenko currently. VR UIs would be impossible without a fix like this.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • [ x ] Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
@CLAassistant

This comment has been minimized.

Copy link

CLAassistant commented Feb 3, 2019

CLA assistant check
All committers have signed the CLA.

@phr00t

This comment has been minimized.

Copy link
Contributor Author

phr00t commented Feb 3, 2019

I say "breaking change", because I this isn't ready for production. It needs to be cleaned up (particularly the RealVirtualResolution Vector2 and 3D/2D determination).

@Kryptos-FR Kryptos-FR changed the title fixed 3D text rendering matrix, but still needs work [wip] fixed 3D text rendering matrix, but still needs work Feb 3, 2019
@phr00t

This comment has been minimized.

Copy link
Contributor Author

phr00t commented Feb 3, 2019

Another oddity with this fix: the blinking cursor on EditText elements doesn't line up with the text. The text is in the upper left, while the cursor vertically centers. Unsure if this bug existed before or after these changes.

@phr00t

This comment has been minimized.

Copy link
Contributor Author

phr00t commented Feb 4, 2019

OK, I think this is "cleaned up" & does some checking to see if it is rendering in 3D or 2D. I made viewProjectionMatrix public within UIBatch to be quicker to access for calculating world view matrices for each glyph. Hoping this is ready for merging, or at least very close.

In other news, I really think the blinking cursor is an existing bug unrelated to my work -- but easily overlooked or worked around by making the "edit text" field no higher than a single line of the font. Although, multi-line edit text fields won't work...

@phr00t phr00t changed the title [wip] fixed 3D text rendering matrix, but still needs work Fixed 3D text rendering Feb 4, 2019
@phr00t phr00t changed the title Fixed 3D text rendering Fixing 3D text rendering Feb 4, 2019
@@ -26,7 +26,7 @@ public class UIBatch : BatchBase<UIBatch.UIImageDrawInfo>
/// <summary>
/// The view projection matrix that will be used for the current begin/end draw calls.
/// </summary>
private Matrix viewProjectionMatrix;
public Matrix viewProjectionMatrix;

This comment has been minimized.

Copy link
@xen2

xen2 May 8, 2019

Member

Please keep this private and pass it to SpriteFont.InternalUIDrawGlyph as a ref Matrix

@fdrobidoux

This comment has been minimized.

Copy link
Contributor

fdrobidoux commented Oct 4, 2019

Hello there, feature I was trying to merge since Monday.

@phr00t

This comment has been minimized.

Copy link
Contributor Author

phr00t commented Oct 18, 2019

Noting that there were more issues relating to 3D text which I moved on to fix in my fork:

phr00t#84
phr00t#97

phr00t added a commit to phr00t/FocusEngine that referenced this pull request Oct 23, 2019
…atio depending on actual requestedFontSize (fixes xenko3d#314) (fixes xenko3d#364)
@xen2 xen2 closed this in eafa92f Oct 25, 2019
@phr00t phr00t deleted the phr00t:fix3dtext2 branch Dec 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.