I just jumped into empty Xcode Project for Mac OS - Application Game
As looking on default template of Metal4 it comes with cube with texture ( so apply Godot Logo be good idea
) but interestingly as looking through variables noticed how similarly they are called to Godot ones .
var dynamicUniformBuffer: MTLBuffer
var pipelineState: MTLRenderPipelineState
var depthState: MTLDepthStencilState
var colorMap: MTLTexture
Ok maybe just because language is English , but looking more into Shaders section
vertex ColorInOut vertexShader(Vertex in [[stage_in]],
constant Uniforms & uniforms [[ buffer(BufferIndexUniforms) ]])
{
ColorInOut out;
float4 position = float4(in.position, 1.0);
out.position = uniforms.projectionMatrix * uniforms.modelViewMatrix * position;
out.texCoord = in.texCoord;
return out;
}
fragment float4 fragmentShader(ColorInOut in [[stage_in]],
constant Uniforms & uniforms [[ buffer(BufferIndexUniforms) ]],
texture2d<half> colorMap [[ texture(TextureIndexColor) ]])
{
constexpr sampler colorSampler(mip_filter::linear,
mag_filter::linear,
min_filter::linear);
half4 colorSample = colorMap.sample(colorSampler, in.texCoord.xy);
return float4(colorSample);
}
this have some more similarities then Swift . especially when peek inside mip_filter:
enum class min_filter
{
nearest = __METAL_MIN_FILTER_NEAREST__,
linear = __METAL_MIN_FILTER_LINEAR__,
#if defined(__HAVE_BICUBIC_FILTERING__)
bicubic = __METAL_MIN_FILTER_BICUBIC__
#endif
};
enum class filter
{
nearest = __METAL_FILTER_NEAREST__,
linear = __METAL_FILTER_LINEAR__,
#if defined(__HAVE_BICUBIC_FILTERING__)
bicubic = __METAL_FILTER_BICUBIC__
#endif
};
enum class mip_filter
{
none = __METAL_MIP_FILTER_NONE__,
nearest = __METAL_MIP_FILTER_NEAREST__,
linear = __METAL_MIP_FILTER_LINEAR__
};
enum class coord
{
normalized = __METAL_COORD_NORMALIZED__,
pixel = __METAL_COORD_PIXEL__
};
What catching my attention is coord normalized and pixel.
As saw in Godot on Mac OS generally you get Retina x2 resolution , but enabling half resolution not always bring it to native , so wonder if this have something to do with it as is it MoltenVK used as translation between Metal and Godot ? ( at least I have to download it before can compile arm version )
Is cube for some specific reason standard in 3d environment ? ( DirectX12 sample use it as well )
this using same as Godot export StoryBoard
RealityKit is purely based on Swift and there is some graphic properties which match exactly Blender or Godot , but interestingly Apple chooses format of Pixar ?
/// Add a ``ModelDebugOptionsComponent`` with a visualization mode of
/// `specular` to an entity to tell RealityKit to draw the entity’s
/// calculated specularity as its surface color. RealityKit uses
/// `specular` to calculate bright highlights caused by shiny surfaces
/// reflecting light. RealityKit draws the specularity value as a
/// grayscale value from black (`0.0`) to white (`1.0`).
///
/// - Note: In most cases, RealityKit calculates specular highlights
/// based on an entity’s `roughness` and `metallic` values, and not its
/// `specular` value, which is usually `0.0`. As a result, this mode
/// causes most entities to render in solid black. Only entities that
/// need highlights in addition to the ones RealityKit calculates from
/// `roughness` and `metallic` need `specular` values greater than zero.
/// Examples of entities that might use `specular` to create
/// supplemental highlights are gemstones and cut glass.
///
/// RealityKit calculates specularity for entities with a
/// ``SimpleMaterial`` and for entities imported from a USDZ file. For
/// other entities, this option has no effect.
///
/// Here’s how to enable ambient occlusion visualization for an entity:
