NME material preview different to scene

I’m working with NME for the first time. Trying to build a simple low-poly Ocean Shader. I found the following two introductory tutorials, that I have tried to follow:

Vertex Shader: Node Material Editor: Vertex Shader - YouTube
Fragment Shader: Node Material Editor: Lights and Textures - YouTube

I have been able to follow the vertex shader without issue and can get a working sine wave. However, am really struggling to get a basic Fragment Output consistent across the NME & scene.

This is my node setup & material preview:

In my scene however, it renders white, with the occasional blue/black triangle. The mesh I am rendering on is a plane that was subdivided and then had it’s faces triangulated.

My scene lighting does contain a HDR that I added with the following code, and I can only think that the node setup is struggling with the HDR for some reason?

const hdr = new BABYLON.HDRCubeTexture("/assets/hdr/sample.hdr", scene, 512);
scene.environmentTexture = hdr;

If I use the default material, then I do get a nice output, but I’m hoping to use the node editor in order to give myself more control over the waves (via vertex output).

All help truly appreciated. Thank you

Scene Output:

Using the default shader in the scene does produce nice HDR reflections, etc. So, I’m aiming for this effect with the fragment output, but with a wave controlled in the vertex output:


  • It turns out this was an issue with the Ocean mesh. I had scaled up x 300 in Blender, and exported. Within the NME, the lights seem to struggle to interact with the mesh properly. To correct this, I used “Apply” (Ctrl+A in Object Mode) and applied the scale such that the object’s scale was equal to 1.

  • The other move I need to do was to multiply the light node’s “Diffuse” x “Specular” such that it would reflect from the light in the scene.

I still do have an outstanding issue in that the material doesn’t reflect from the sceneEnvironment texture at all, but the initial issue is at least resolved.