Spherical World Material - Where to do transformation on rendering pipeline?

Hi guys,

Right now I’m working on a spherical world build from applying material shader. Like the work Blaaguuu did on this thread Spherical World Material Experiment - Rendering - Epic Developer Community Forums
You could see the video of the world differences here that I’m making right now

Normal flat world

Spherical world after vertex transformation

also you could see the world before and after from images below

Basically what the material shader do is transforms each vertex in the flat world into spherical world via World Position Offset on material shader
Physics and navigation works normally like a flat world, since I only change the way the world renders.

Of course this has some limitations like we can’t do a loop through the world since the world is not really “wrapped”, and each object on the world must be applied by this material so it would get the “spherical” effect.

Since I applied on the material level, I need to go back and forth disabling the material when I want to place new object on the world. Since I can only place object with the precise position on a flat world.

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

I’m searching for a way to somewhat do vertex processing right after I clicked the “Play” button on the Editor, so 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 you guys think I need to do some changes on the vertex transformation?
Since I don’t really understand the rendering pipeline of unreal, I don’t know the exact place to do transformation, I hope the unreal devs could give some comments on this :slight_smile:

Thoughts anyone?

Thanks for sparing your time here!
Cheers,
ernesernesto

Updates

Currently I’m using static switch with static bool on my sphere material function to toggle between spherical effect and normal effect. This function plugged into world position offset and applied to all objects on the world.

Drawbacks from this approach is everytime I toggle the effect all objects on the world need to recompile it’s shader, took about ±5min yo finish recompiling. 2000++ shader recompile for roughly 30 different material instances. Quite a long time for iteration I guess, still searching for a better way to do this.

If anyone interested on my approach I could share my material setup

Thanks!

I asked question on answer.unrealengine and the staff pointed out a good way to solve my problems

This made enabling the effects back and forth really quick
Cheers