Material not updating in realtime

Hello,
I made a wave animation with shape keys and wanted to apply a material that displays two different textures depending on the slope.
So far so good eveything works but the problem is that the material does not update the keyshape animated normals in realtime.
Here is a gif illustrating the problem:

Is there any possibility to solve this?

Hmmmm… Would be relatively easy to do in a coded shader.
Alternatively as a hack, I think you can recalc the normals via a script.

This is what I am using currently to swap textures for my project. It swaps the current texture with an image in the same folder as the game file.
The version below is untested, let me know if it works and I can help :slight_smile:

import bge
from bge import render,logic,events,types,texture
import VideoTexture

r=render
l=logic
e=events
ty=types
tx=texture

def getobj(name):
	#name - string - name of object
	scenes=l.getSceneList()
	for sce in scenes:
		for obj in sce.objects:
			n=obj.name
			if n==str(name):
				return obj
def txswapA(obj,A,B):
	#obj - object variable
	#A- string - first material name
	#B- string - image name you want to swap it with
	#i.e. txswap(myobject,"material","image2")
	ID=tx.materialID(obj,"MA"+A)
	objtx=tx.Texture(obj,ID)
	path="//"+str(B)
	url=l.expandPath(path)
	newsrc=tx.ImageFFmpeg(url)
	l.texture=objtx
	l.texture.source=newsrc
	l.texture.refresh(False)
def txswapB():
	#delete dynamic tex
	try:
		del l.texture
	except:
		pass

waves=getobj("name_of_object")
if foo:
	txswapA(waves,"material_name","image_file_name")
elif bar:
	txswapB()

EDIT - a non-coding way to do this can be done by using the node editor and splitting the UVs into X and Y coords and making one big texture with two halves and keyframing it. It’s a neat trick and is more reliable than blender’s sprite feature. Here’s a vid on how to do it - https://www.youtube.com/watch?v=6MmWROCjTGI&ab_channel=JohnHamilton