- Home /
Question by
zaurek · Feb 01, 2014 at 01:31 AM ·
shadertextureoffsettexture offset
set texture offset inside a shader
As the question states I'd like to set the texture offset of a texture inside of the shader. currently I'm setting the offset like this:
public float scrollSpeedX, scrollSpeedY;
private Vector2 offset = new Vector2();
void Update () {
offset.x = (scrollSpeedX * Time.time) % 256;
offset.y = (scrollSpeedY * Time.time) % 256;
renderer.material.SetTextureOffset ("_SelectedTex", offset);
but I'd like to move it into the shader to save CPU. Is that possible at all? Thanks
Comment