Need help with Rastertek tutorial - making a 2D font overlay

Started by
3 comments, last by Thibault Ober 6 years, 5 months ago

Hi guys, anyone experienced with DX11 could look at my graphics.cpp class? I got fonts rendering correctly

with painters algorithm - painting over the other 3d stuff each frame, however, whenever I turn the camera left or right,

the fonts get smushed narrower and narrower, then disappear completely.

 

It seems like the fix must be a very small change, untying their rendering from the cam direction,

but I just can't figure out how to do it under all this rendering complexity. Any tips would be helpful, thanks.

https://github.com/mister51213/DirectX11Engine/blob/master/DirectX11Engine/Graphics.cpp

Capture.PNG

Advertisement

When displaying text, you are not suppose to use the viewMatrix. Only the orthoProjection is needed but I think in this tutorial you will also need the basic world Matrix. The problem is that you are storing rotation inside your viewMatrix or any other type of modelMatrix and this cause to rotate your quad containing your text. It produces your bad effects, get narrow ...

Hope it helps

On 11/12/2017 at 10:20 PM, Thibault Ober said:

When displaying text, you are not suppose to use the viewMatrix. Only the orthoProjection is needed but I think in this tutorial you will also need the basic world Matrix. The problem is that you are storing rotation inside your viewMatrix or any other type of modelMatrix and this cause to rotate your quad containing your text. It produces your bad effects, get narrow ...

Hope it helps

So you're saying in the following function, dont pass in the view matrix right? What matrix should I pass in instead, just identity?

SetShaderParameters(deviceContext, worldMatrix, identity /*viewMatrix*/, projectionMatrix, texture);

 

 

 

I don't know how you handle your mouse. But you should put the resulting rotation somewhere (in a matrix). In order to draw your quad properly (in front) you shouldn't try to use them.

I will recommend to take in to account only the orthoProjection Matrix you have.


SetShaderParameters(deviceContext, identity, identity /*viewMatrix*/, projectionMatrix, texture);

 

projectionMatrix i think is computed with an orthoProjection. Try the code above and tell us your result.

 

good luck

 

This topic is closed to new replies.

Advertisement