# How can I make it so an area of the level goes back in time?

Like in Skyward Sword, you hit a Timeshift Crystal in the ship, and the whole ship gets sails, the sand seascape becomes water, and faded textures become vibrant, and things on electricity start running again and are no longer rusty, if you hit the Crystal again, the entire level becomes old and decrepit again.

How can I recreate this effect? It’s a cool mechanic. It would also be good to maybe have it so you can play around with its radius of effect by game properties. This would obviously be Python scripted.

I could use a kdtree and lerp vertex color and position /normal from a target mesh and locally effect time travel

probably the most straight forward method would be use object color to drive a mix between two shader nodes trees. this is less of a coding hurdle, and much more of a shader node/material one. the code could be as simple as looping `obj.color[0] = time` assuming red channel drives mix and `time` is the value that transitions from 0-1.

You can use texture replacement for materials in real time, but it is expensive for many textures or to replace a large number of textures at once, as well as use graphics nodes to create many effects - such as replacing some textures with others or mixing them at a distance from the active camera. This method works very quickly and requires only node settings and little knowledge in vector mathematics to control the distance. Or if you know the GLSL language, you can write a fragmentary shader to mix several textures and replace them in real time through scripts - more precisely, not loading, but replacing one texture with another from the texture slot

With material nodes you could use the Visibility Factor of a point lamp set to Sphere, with Specular and Diffuse disabled, to control the area location and radius (the distance of the lamp, controlled with a script).
You can mix materials, textures, colors, etc.

WASD to move the area, Q and E to decrease/increase the radius.

2 Likes

so I use kdtree to paint in this demo

imagine instead swapping time inside the bubble by learping pos / vertex color / and yes even object color of nearby objects.

quick_time_sphere.blend (2.0 MB)

this is cool, but a bit harder to pull off a animated transition

the simplest way and probably least impressive is just to make two scenes that are essentially duplicates with changes, you hit the crystal and enter a separate scene, this is however also the most reasonable way to do it that most modern games would something like that.

quick_time_sphere3(vertex_colors).blend (2.2 MB)
this lerps vertex position and color over time inside a sphere

‘local time travel’

one could stand in it and travel to the future or stand outside it and bring a chunk of future / past to them

I agree this is probably how I would do it. Though I’m not sure how to get around creating a giant node tree.

the minimum effective solution is this, basically you can setup each material like normal.

1 Like

I know you went a different direction, but did you check the KDTree thing?

do you need this in 2.79x?

While the kdtree method is good for altering the geometry, having to change the vertex colors of every possible object, and subdivide it necessarily, that could be affected by this effect is, in my opinion, too much, considering that the question was mostly about changing the appearance.
I tried to improve my approach, by using the energy as the radius, multiplied by 10, since the energy is clamped at 10, this gives a maximum diameter of 200 meters(BU). With the radius it is possible to have a blending edge of an specific width.

The width and the color of the blending edge can be changed inside the group node.

Going further, a noise texture can be used to apply a distortion to the radius, to enhance the effect.

material-radial-mix2-upbge.blend (137.9 KB) (upbge only)

2 Likes

indeed that effect is quite nice!

maybe combining them
(mostly using the texture cords trick) and only use the vertex color trick / kd thing for cinematics

Getting the best of both worlds! Pun intended.

The issue with a radial time shift effect in UPBGE 0.3+ is the fact that the Lamp Data node was removed due to EEVEE not supporting lamp shaders and lamps in nodes. I believe eventually they will add support for this lamp data effect, but how would I get an object like an Empty in the nodes and then do the circle effect like in the GIF above?

With Viewport Render enabled, Holdout operations kind of work.

I figured it out anyway through some experimenting. As there is no Lamp Data, I mapped it to an Empty through Texture Coordinate.