TomF,
@TomF@mastodon.gamedev.place avatar

Oh that's a fun bug! So Unity has both Matrix4x4 and float4x4, and the have slightly different syntax, but close enough. The big difference is float4x4 is significantly faster. So a lot of people replace one with the other - happy.

BUT....

To do matrix multiplication with Matrix4x4, you do a = b*c.

To do it with float4x4 you have to do a = math.mul(b,c)

OK whatever. The problem is that a=b*c COMPILES FINE. It just does the componentwise multiply is all.

W
T
F
people.

dotstdy,
@dotstdy@mastodon.social avatar

@TomF wait but why is there a matrix4 and a float4x4 :')

TomF,
@TomF@mastodon.gamedev.place avatar

@dotstdy The Matrix4x4/Vector4 is a much older library than the float4x4/float4

dotstdy,
@dotstdy@mastodon.social avatar

@TomF yeah i mean i understand that. but why. in which possible universe do you want to be explaining to your users that there's two (soon to be 3) different maths libraries and that sometimes one of them is faster than the others. :')

aras,
@aras@mastodon.gamedev.place avatar

@dotstdy @TomF “it sounded like a good idea at the time”, I guess. Around 2015 or so, Unity thought that hey everything will become DOTS and Burst any day now, and in “like two years” no one will use the “old engine”. Easier to say how that was misguided now, but that was the thinking/direction at the time.

dotstdy,
@dotstdy@mastodon.social avatar

@aras @TomF Yeah, it is very easy to criticize in hindsight of course. I just find this particular thing interesting because it's a mistake that everyone seems to do (not just unity), like all the time. :D "We'll just write a new incompatible thing and everyone will switch" is such an extremely rarely successful approach compared to how often it gets attemped.

aras,
@aras@mastodon.gamedev.place avatar

@dotstdy @TomF Yep. Seemingly everyone has to learn this lesson the hard way. And then the people who learn it leave, and the new people can learn the same lesson again! Yay!

Doomed_Daniel,
@Doomed_Daniel@mastodon.gamedev.place avatar

@aras @dotstdy @TomF
In Unity's case, there seems to be only leaving and no new people, so they can't repeat old mistakes - clever!

bitinn,
@bitinn@mastodon.gamedev.place avatar

@TomF Unity maths isn’t C# maths isn’t Burst maths isn’t Shader maths, even though they all try to be similar to the others 😅

jvalenzu,

@TomF Well, sometimes you need component-wise multiplication. We do state upfront that mathematics uses HLSL syntax (https://docs.unity3d.com/Packages/com.unity.mathematics@1.3/manual/index.html)

That said, you're describing a very common problem that we talk about specifically when talking about interoperability problems, it's an area we're hoping to improve.

TomF,
@TomF@mastodon.gamedev.place avatar

@jvalenzu Specifically for matrices, hadamard as a "default" is pretty nuts. Just turn it off and make it need an explicit function. I don't understand why this is a difficult decision.

xoofx,
@xoofx@mastodon.social avatar

@TomF @jvalenzu The initial decision was to use HLSL so that you could copy HLSL snippet code and it would work almost out of the box. HLSL uses per-component operations for regular multiply operator, so we used that. It makes it consistent with the other types.

TomF,
@TomF@mastodon.gamedev.place avatar

@xoofx @jvalenzu Yes I fully understand how this decision was reached, and why everybody is trying to point to everybody else. I am no stranger to these processes. It has still cost a lot of people a lot of time, and benefited nobody.

dneto,
@dneto@mastodon.gamedev.place avatar

@TomF @xoofx @jvalenzu Or you could make a new shader language.
Everybody loves that.
Ask me how I know.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • DreamBathrooms
  • mdbf
  • ngwrru68w68
  • magazineikmin
  • thenastyranch
  • rosin
  • khanakhh
  • osvaldo12
  • Youngstown
  • slotface
  • Durango
  • kavyap
  • InstantRegret
  • tacticalgear
  • anitta
  • ethstaker
  • modclub
  • cisconetworking
  • tester
  • GTA5RPClips
  • cubers
  • everett
  • megavids
  • provamag3
  • normalnudes
  • Leos
  • JUstTest
  • lostlight
  • All magazines