Discontinuities in simplex noise

I’m not sure what the noise node would have to do with this though. Its purely driven by its input, now it is possible different clients might render it with different looks because its procedural but from what I am seeing here I would assume there is something different with the vector3 its sampling.

Is the derivative of the smooth step being used in the simplex noise continuous?

yes yes those are words…

hahaha Ok, hold on let me look.
Give me a few mins to whip up a test case to see.

https://playground.babylonjs.com/#9Z5WJ9
Here are all the axes in a 0-1 range, I’m not sure what derivative you are asking about as there is no smoothstep function in the script.
X


Y

Z

I’m not to sure what you are actually asking for to be honest. What specifically is not happening with the node material as a result of using the noise node? Are you trying to create a perturbed normal map from the noise? Sorry just trying to catch up fully and a lot of different questions where asked.

If you wanna do some reading on the actual magic in the numbers here is a clip from the code

//  This is a modified version of Stefan Gustavson's and Ian McEwan's work at http://github.com/ashima/webgl-noise
//  Modifications are...
//  - faster random number generation
//  - analytical final normalization
//  - space scaled can have an approx feature size of 1.0
//  - filter kernel changed to fix discontinuities at tetrahedron boundaries

I am merely the messenger sir.

1 Like

I’m not to sure what you are actually asking for to be honest. What specifically is not happening with the node material as a result of using the noise node? Are you trying to create a perturbed normal map from the noise? Sorry just trying to catch up fully and a lot of different questions where asked.

@Pryme8 Yes, I am trying to create a perturbed normal map from the noise. Though it isn’t really a map/texture, the intention is to calculate the perturbed normals on the fly using your Ashima noise.

With respect to discontinuities, most noise functions have a lerp/smoothstep function. Depending on how the noise is being used, having a continuous derivative of the lerp/smoothstep function can be important, when trying to avoid artifacts.

  • The choice of interpolating function in each dimension was 3 t 2 - 2 t 3, which contains nonzero values in its second derivative. This can cause visual artifacts when the derivative of noise is taken, such as when doing bump mapping.

I’m not to sure what you are actually asking for to be honest. What specifically is not happening with the node material as a result of using the noise node? Are you trying to create a perturbed normal map from the noise? Sorry just trying to catch up fully and a lot of different questions where asked.

@Pryme8 many thanks for the playground derivative check!

Starting to think there is something wrong w/ how I am perturbing normals. Any chance I could get an NME example which perturbs normals using the simplex block and the PBR block?

Here is my current attempt, which is clearly a failure.

Using color, here is the pattern I’m trying to create bumps from:

Or even a simpler NME example, like the image in Fig. 5-11 below, would be fantastic!

The bump block has “Transform as direction” checked in one case and not in the other case.

Thanks @Evgeni_Popov ! It must get reset when I disconnect/reconnect the node, which makes sense.

One tip: you can compare two node materials by comparing their .json files (that’s what I did to find the difference) :wink:

1 Like

One tip: you can compare two node materials by comparing their .json files (that’s what I did to find the difference)

@Evgeni_Popov I’ll do that next time, thanks!

Asking the big guns for help.

Think I see what’s happening, the lerp/smoothstep between mesh.position’s in the vertices is discontinuous. And until WebGPU comes out, don’t think there is any way to create a geometry shader.

https://nodematerial-editor.babylonjs.com/#WTQ3DG

Plane geometry looks fine. Other geometries look bad.

You won’t have geometry shaders even with WebGPU, it is not part of the spec and as I understood it it is not planned, there are too many problems with them and the current trend is to not use them. See Reddit - Dive into anything

Instead, one are using compute shaders (that are part of WebGPU and now supported by Babylon.js - try this for eg, which will work only in Chrome or Edge Canary) and tesselation shaders (which are under investigation but I’m not sure at all there will be an extension for it - maybe we will have mesh shaders instead).

@Evgeni_Popov Having tesselation would be awesome.

well when the web technologies supports it then yes, yes it will be awesome!

Yeah, starting to realize I need to shift strategies. Pondering some new ideas. Ken and Stefan got me thinking differently. Thin instances are looking really useful as a volume primitive.

@Pryme8 would it make sense to expose the gradient on simplex noise block? According to Stefan, there is a performance argument for doing so.

https://weber.itn.liu.se/~stegu76/TNM084-2019/shadron/sdnoise3.glsl
(see end of file)

other reference links

and current state of my demo, which is still distorted at the poles, think I’m screwing up by not transforming gradient into tangent space?

Not sure how to do this, how do I create a tangent space transform node? @Deltakosh any ideas?

https://nodematerial-editor.babylonjs.com/#ND6Z9D#6

https://nme.babylonjs.com/#JNQ200#34

Is this what you are trying to do?

Yes! That’s it! But I don’t entirely understand how it works. How do I learn more?

I see there are multiple octaves of noise, but not sure I understand the rest. Also, how do I antialias frequencies based on camera distance? Think I see Nyquist frequency based artifacts when zooming out?

possibly a uniform that is tied to camera distance to mesh that changes the frequency?

that might work. is there a way to import an “instanced mesh” into NME?

You can load a custom scene in the NME, so you can create in the Playground a scene with instances and save it as a .babylon scene that you can reload in the NME.

1 Like