Skip to main content
I changed two sections from using vectors to multi-floats. The first section to float 4 and the second to float3. And I added some extra description for the problem at the end.
Source Link
Ethan
  • 145
  • 5

Here's a list of math functions I'm having trouble finding a direct function match for in Godot C#:

math.rcp() //get reciprocal of a float
//Then there's swizzle operations like:
Vector4float4 point;
Vector4float4 newpoint = point.yzwx;

There's also all sorts of other vector operations I can't find the equivalent for like:

Vector3float3 point;
math.abs(point);
math.exp(point);

Also I need certain special vector types like:

uint3 point //Is like an unsigned int vec3

Also in this code that I'm converting it adds a float to a float3 and I'm not even sure what the semantics are for that.

float3 add
add * 0.6f + 0.5f;

TheseThis is the code I'm trying to convert https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Runtime/GaussianUtils.cs I've been able to reproduce all of the functions with constructors and changing rcp to 1.0f/x, but I don't know what the memory allocations will do to the performance. These are my questions, thanks.

Here's a list of math functions I'm having trouble finding a direct function match for in Godot C#:

math.rcp() //get reciprocal of a float
//Then there's swizzle operations like:
Vector4 point;
Vector4 newpoint = point.yzwx;

There's also all sorts of other vector operations I can't find the equivalent for like:

Vector3 point;
math.abs(point);
math.exp(point);

Also I need certain special vector types like:

uint3 point //Is like an unsigned int vec3

Also in this code that I'm converting it adds a float to a float3 and I'm not even sure what the semantics are for that.

float3 add
add * 0.6f + 0.5f;

These are my questions, thanks.

Here's a list of math functions I'm having trouble finding a direct function match for in Godot C#:

math.rcp() //get reciprocal of a float
//Then there's swizzle operations like:
float4 point;
float4 newpoint = point.yzwx;

There's also all sorts of other vector operations I can't find the equivalent for like:

float3 point;
math.abs(point);
math.exp(point);

Also I need certain special vector types like:

uint3 point //Is like an unsigned int vec3

Also in this code that I'm converting it adds a float to a float3 and I'm not even sure what the semantics are for that.

float3 add
add * 0.6f + 0.5f;

This is the code I'm trying to convert https://github.com/aras-p/UnityGaussianSplatting/blob/main/package/Runtime/GaussianUtils.cs I've been able to reproduce all of the functions with constructors and changing rcp to 1.0f/x, but I don't know what the memory allocations will do to the performance. These are my questions, thanks.

Source Link
Ethan
  • 145
  • 5

How do I use these Unity math functions in Godot C#?

Here's a list of math functions I'm having trouble finding a direct function match for in Godot C#:

math.rcp() //get reciprocal of a float
//Then there's swizzle operations like:
Vector4 point;
Vector4 newpoint = point.yzwx;

There's also all sorts of other vector operations I can't find the equivalent for like:

Vector3 point;
math.abs(point);
math.exp(point);

Also I need certain special vector types like:

uint3 point //Is like an unsigned int vec3

Also in this code that I'm converting it adds a float to a float3 and I'm not even sure what the semantics are for that.

float3 add
add * 0.6f + 0.5f;

These are my questions, thanks.