Porting to Monogame

Discussion in 'Development News' started by Afr0, Apr 28, 2013.

Thread Status:
Not open for further replies.
  1. francot514

    francot514 Well-Known Member

    I want to retake this post, is possible the complete port of the current project dollhouse code,??? as i said i get error for the Effects files, that need to be changed to Monogame Effect format:
    Code:
    This does not appear to be a MonoGame MGFX file!

    Attached Files:

  2. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    I've narrowed the bug down to the worldViewProjection matrix being wrong or the calculation having an unexpected result. Next I need to see whether the input matrix is wrong or if it's not being applied correctly in the shader.
  3. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    Mat Monogame 3.3:
    + mat ( 0.04166666 -0.02777778 -6.123725E-05 0 )
    ( 0 0.06804138 -5E-05 0 )
    ( -0.04166668 -0.02777777 -6.123723E-05 0 )
    ( 1.348699E-06 5.333333 0.5117576 1 ) Microsoft.Xna.Framework.Matrix


    Mat XNA

    + mat { {M11:0.04166666 M12:-0.02777778 M13:-6.123725E-05 M14:0}
    {M21:0 M22:0.06804138 M23:-5E-05 M24:0}
    {M31:-0.04166668 M32:-0.02777777 M33:-6.123723E-05 M34:0}
    {M41:1.348699E-06 M42:5.333333 M43:0.5117576 M44:1} } Microsoft.Xna.Framework.Matrix

    So they're, uh, the same... Not sure why the difference is so pronounced.
    Last edited: Jan 22, 2015
  4. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    upload_2015-1-22_13-29-38.png
    Finally fixed it! I bet you want to know what the fix was. I know you do. Here it is:

    Code:
        result.backDepth = backProjection.z / backProjection.w + (0.00000000001*backProjection.x+0.00000000001*backProjection.y);
        result.frontDepth = frontProjection.z / frontProjection.w + (0.00000000001*frontProjection.x+0.00000000001*frontProjection.y);
    
    "but rhys!" I hear you say, "that makes no sense whatsoever!"

    Exactly.

    Two components of the world projection matrix were not being used for whatever reason (when I checked the glsl source), which was causing its uniform to be completely broken. I fixed that. The two rows it was missing were actually skippable, but Monogame removed them and didn't actually handle removing them correctly when passing the matrix to the shader.

    I'll probably rewrite the shader to pass two only rows of the worldProjectionMatrix and manually dot them instead of needlessly calculating the other rows and slightly offsetting the depth to get around a stupid bug.
    Fatbag, aidancheddar and liinor like this.
  5. Afr0

    Afr0 Well-Known Member

    Rhys, I love you! Now we can switch to Monogame and compile for Linux and Mac and set up the lot buy system! :D
    liinor likes this.
  6. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    Not so fast!! Clicking on objects doesn't work yet, and the debug windows still use windows forms.
  7. BorderKontrol

    BorderKontrol Member

    *plays seductive saxophone music*
  8. pisarz1958

    pisarz1958 Administrator Staff Member Moderator

    Monogame port will compile in VS2013, right?
  9. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    VS2010 right now. I might move the project to a later version before merging though, as we now use the Monogame Content Pipeline to compile content separately.
  10. francot514

    francot514 Well-Known Member

    You was talking with me??? good work anyway for fix it

    What do you mean, if you change it to monogame, the clicking objects will not work?? also for windows forms i think monogame can handle it on cross platform...
  11. aidancheddar

    aidancheddar Active Member

    MonoGame doesn't have proper support for 2013 Community. That includes the Content Pipline. I tried.
    Last edited: Jan 23, 2015
  12. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    Yeah, I'll believe that when it doesn't work.
  13. aidancheddar

    aidancheddar Active Member

  14. Afr0

    Afr0 Well-Known Member

    Rhys is more experienced.
    Anywho, we don't need to create a Content project, as we can compile Content seperately.
  15. aidancheddar

    aidancheddar Active Member

    I know. I take back what I said about the newb thing.
    At the moment, the XNA 4 project still has a content project type in it needed to compile, even we're using our own engine to compile.
  16. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    Not anymore, I'm now using the monogame 3.3 pipeline externally, which works perfectly.

    Linking a 2 month old issue which uses an embedded content project does not help.
  17. aidancheddar

    aidancheddar Active Member

    That's why I showed you the link. Also, MonoGame 3.3 isn't even stable. Only 3.2 and that in came out April 7, 2014. So the issue is still valid.
    Last edited: Jan 23, 2015
  18. RHY3756547

    RHY3756547 FreeSO Developer Staff Member Moderator

    Depth buffer fixed - for OpenGL I had to (depth/2)+0.5 all depth outputs to make them match the ones 3d geometry (like characters) were outputting.

    upload_2015-1-25_17-2-55.png
    Dark_Kostas and aidancheddar like this.
  19. Afr0

    Afr0 Well-Known Member

  20. aidancheddar

    aidancheddar Active Member

    Nice. :D
    Fair enough.
    Last edited: Jan 25, 2015
Thread Status:
Not open for further replies.

Share This Page