Where to do transformation on rendering pipeline

I’m working on a vertex transform shader on the material, basically what the material do is transforms each vertex in the flat world so that it would bend into spherical world via World Position Offset on material shader.

Since I applied the vertex transform on the material level, I need to go back and forth when I want to place new object on the world, between flat world and spherical world, disabling and enabling it, since I need to place object precisely on a flat world.

I’m planning to move this transformation into a more low level approach, so that every object on the world get this effect without the need of applying the material on the object, probably do some changes in the unreal shader usf files.

So the question is, I’m searching for a way to somewhat do vertex processing right after I clicked the “Play” button on the Editor.

I could place objects on the world in the “flat” state, and right after I clicked the Play button, the vertex transformation kicks in and the world render in a spherical way. This is a better workflow I believe for this kind of process.

Is BasePassVertexShader.usf the right way to start? Where do I need to apply the vertex transformation?

Since I don’t really understand the rendering pipeline of unreal, I don’t know the exact place to do transformation

Thoughts?

Picture for reference, normal flat world and spherical world

See also the effect from this video
- YouTube


Thanks!

Hey ernesernesto -

By inputting your work into the World Position Offset input of a material, you are actually already inputting the information into the Vertex computation of that particular shader. Even if you put the information into shader code you would still see the warped effect in the editor as it runs the shader for preview and editing mode as well as for the game. You probably just need to add an initial Lerp option between the Spherical Math and 0 with the alpha being a Scalar Parameter from a Material Parameter Collection(MPC). Then in your level Blueprint, Set that particular Scalar Parameter from the MPC to 1 which will cause the materials using this change to using the Spherical Math. Here is an example of how I might set it up using a Material Function that is built with the LERP already in place and that Function plugged into my individual materials

Thank You

Eric Ketchum

Hi Eric!

Thanks for always answering with a great solution !

This has never been crossed my mind, been using static switch and static bool node, resulting in massive recompile of the shader whenever I toggle the effect back and forth, using this, changing between effects are instant

Perfect solution for my problem, no need to dig deeper, thanks again!