Questions related to trail effect node material

I am reading Trail effect with Babylon.js. In my last demo, I exploited a… | by Babylon.js | Medium and trying to understand the node material used for it.

First, I am stuck at this:

But as you can see in NME graph, there is another texture sampling. For that sampling, the V component is offset a little (-0.001) in order to get a position a little behind in the curve described in the texture.

I exported the shader code from the node material editor and it seems to refer to these code. I guess this uniform u_Vector is the little delta (-0.001). But I don’t find where it is defined and passed into the node material. Anyone knows what am I missing?

//Uniforms
uniform vec2 u_Vector;
... 

//tailSampler0
transformedUV = vec2(textureTransform * vec4(xy.xy, 1.0, 0.0));
...

//Add
vec2 output11 = xy + u_Vector;
... 

//tailSampler1
transformedUV1 = vec2(textureTransform1 * vec4(output11.xy, 1.0, 0.0));

I might have more questions after I pass this first blocker. :smile:

Pinging the amazing @Cedric who created the original effect! :smiley:

Hi @slin

The offset constant is visible here :

The display only shows first 2 decimal digits, so you have to expand the values.

1 Like

Do you think it would be good to have a feature to increase the amount of decimal digits shown? I can create an issue for us to look at later. :thinking:

I have no opinion. @PatrickRyan maybe ?

Hi @Cedric

Thanks for helping! I actually opened the panel of this node. Then I saw value 0 again. I didn’t notice the + icon to expand this field. :rofl:

Screen Shot 2022-01-28 at 7.21.44 AM

1 Like

@Cedric and @carolhmj, if my memory is correct, we increased precision on the floats in NME after we set up the display of the values to 2 decimal places in the node and properties panel. I don’t see a problem with the properties panel showing the full value without needing to expand the value input. My worry is what happens to the Vector input nodes if we display more than two decimal places:

image

Vector4 is already breaking to a second line, making the node larger. Vector3 would likely get larger too if we default to 4 decimal places for every value. I also agree that not being able to see the actual value on the node isn’t optimal either. Maybe a compromise is to show decimals to the full precision of the number only when they are present. That means a value that is comprised of integers would display as just whole numbers without decimals and if the values have high precision decimals, we display them when present. That would mean that some of the nodes would be larger, but not every Vector3 would be two wrapped lines of value in the node.

Hi @PatrickRyan

Maybe we can have css ellipsis style text for numbers? So user expect the number is not fully displayed in the node box. Also tooltips could be option to quickly show the full values without going to the side panel.

I think we will have to do some design exploration to see if truncating the values is harmful to the experience at all. It is nice to be able to “read” your graph without needing to click on the node to see the actual values in the node. We will look at NME as a whole after the next release as there are some quality-of-life features we want to incorporate.

1 Like