Sampling texture in MaterialExtension

I tried to sample the texture and move the vertices in the shader using the MaterialExtension node, but it doesn’t seem to work. I think it is important to store information about complex simulations, etc., in the texture and get it in the MaterialExtension so that it can be drawn in PBR shader in Stride. Is there a way to do this?

Texture using MaterialExtension.zip

Hi there and welcome to the vvvvorums!

Check out VL.Fuse, there is a helppatch called “function based vertex displacement”. I believe it does what you want.

cheers

Thanks for reply!

I tried it, but the ModifyMeshSurface node uses the MaterialExtension node inside it, and it didn’t work as well.


test.vl (21.9 KB)

the issue is that the stride engine assigns textures in materials per resource group, so your texture input has to be in the same resource group. The second issue is that the name Texture is already taken by another base shader, so you have to rename it:

rgroup PerMaterial
{
    stage Texture2D<float4> DisplaceTexture;
}

another hint to make the code a little bit shorter, you can inherit from MaterialExtension which gathers most common base shaders. see the full code here:

Texture using MaterialExtension 2.zip (5.6 KB)

otherwise, correct thinking and application of material extensions:

1 Like

Excellent.
This works perfectly, thank you!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.