08-12-2025, 12:37 PM
I am glad to hear that you are impressed with the Ab4d.SharpEngine.
I tried to reproduce your problem, but in my case, the specular material was correctly rendered.
For example, I opened the Materials/MaterialsSample.cs file in the Ab4d.SharpEngine.Samples.Common project and added the following into the OnCreateScene method after the _boxMesh initialization:
I also commented the whole OnCreateLights method a few lines below.
This correctly renders the box with specular light:
The code above is almost the same as yours, except that it uses the MeshFactory.CreateBoxMesh to create the StandardMesh.
Therefore, I assume that the normals in your mesh are not correctly defined.
You can test that by stopping at a breakpoint after the standardMesh is initialized and then in the Visual Studio immediate window run the following:
standardMesh.DumpDetails();
Please check your mesh. If you cannot find the cause of the problem, then please try to update one of the samples (for example MaterialsSample.cs) and attach the updated source code to this post so I can reproduce the problem.
I tried to reproduce your problem, but in my case, the specular material was correctly rendered.
For example, I opened the Materials/MaterialsSample.cs file in the Ab4d.SharpEngine.Samples.Common project and added the following into the OnCreateScene method after the _boxMesh initialization:
PHP Code:
var specularMaterial = new StandardMaterial(Colors.Silver)
{
SpecularPower = 16,
SpecularColor = Colors.Silver
};
MeshModelNode? roofMeshModelNode = new MeshModelNode(_boxMesh, specularMaterial, name: "SampleMeshModel");
roofMeshModelNode.BackMaterial = specularMaterial;
scene.RootNode.Add(roofMeshModelNode);
scene.Lights.Clear();
scene.Lights.Add(new PointLight(new Vector3(0, 500, 0)));
if (targetPositionCamera != null)
targetPositionCamera.ShowCameraLight = ShowCameraLightType.Never;
return;
I also commented the whole OnCreateLights method a few lines below.
This correctly renders the box with specular light:
The code above is almost the same as yours, except that it uses the MeshFactory.CreateBoxMesh to create the StandardMesh.
Therefore, I assume that the normals in your mesh are not correctly defined.
You can test that by stopping at a breakpoint after the standardMesh is initialized and then in the Visual Studio immediate window run the following:
standardMesh.DumpDetails();
Please check your mesh. If you cannot find the cause of the problem, then please try to update one of the samples (for example MaterialsSample.cs) and attach the updated source code to this post so I can reproduce the problem.
Andrej Benedik

