AleDel / Spout-UE4

Spout Plugin for Unreal Engine
175 stars 80 forks source link

strange ratio make texture look distortionned #34

Closed JeremyFerland closed 7 years ago

JeremyFerland commented 7 years ago

If i'm not using traditional ratio my texture get distorted in unreal. I try it with touchDesigner and there no problem, so the problem is not with the sender, but with this receiver. Do you have any idea what can cause that ?

capture

JeremyFerland commented 7 years ago

I found that if the width is a factor of 32 it work. Why 32 i'm not exactly sure. Do you have any idea how can we accept any width ?

AleDel commented 7 years ago

no, not yet, It is the same in #31, i have no idea

JeremyFerland commented 7 years ago

Sorry i didnt see it, i will take a look tomorrow if I can found anything to help. I was thinking about a hot fix where we create the texture with a width that is a 32 factor and add the spout texture on it with and drop it after. Just a idea, what do you think ?

AleDel commented 7 years ago

I've tested the aspect ratio 4/3, 320 x 240 ----> good 800 x 600 -----> bad 1024 x 768 ---> good I do not get it.

JeremyFerland commented 7 years ago

I will try to find something and if I'm lucky I will tell you, thanks for the help

JeremyFerland commented 7 years ago

Ok first. for me 800x600 work perfectly, in fact in i can divide the width by 32 it work for me. and i think is related to the D3D11_MAPPED_SUBRESOURCE you use in the script SpoutBPFunctionLibrary.cpp line 571.

If I read the api of microsoft (https://msdn.microsoft.com/en-us/library/windows/desktop/ff476182(v=vs.85).aspx) the p.Data that you use is a 16 bytes alignment instead of a 4 bytes. I will run some test later on that

JeremyFerland commented 7 years ago

got it ! in SpoutBPFunctionLibrary.cpp when you yo the RHIUpdateTexture2D, change your stride for mapped.RowPitch and it work with every resolution :D

AleDel commented 7 years ago

Yehhaaa great man !!!