0 Favourites

[Discussion] Shader works unexpected on TiledBackgrounds.

  • Disclaimer: I have not written this shader.


    <?xml version="1.0" encoding="UTF-8" ?>
    	<!-- About -->
    	<id>Scroll</id>			<!-- Never change the ID.  Change the name instead -->
    	<description>Seamlessly scroll the texture within a given amount of time</description>
    	<!-- Settings -->
    	<!-- Extend the bounding box for effect processing by a number of pixels to show the edges
    		 of effects which go beyond the object edges, e.g. blur and warp. -->
    	<!-- Set to true if the background is sampled (samplerBack is referenced at all in the shader) -->
    	<!-- Set to true if the background is not sampled at 1:1 with the foreground (e.g. the
    		 background texture co-ordinates are modified in some way by the shader, as done
    		 by Glass and Lens) -->
    	<!-- Set to true if the effect changes over time, e.g. Noise or Warp effects. -->
    	<!-- Parameters -->
    			<name>X shift</name>
    			<description>Amount of time for a full horizontal shift</description>
    			<name>Y shift</name>
    			<description>Amount of time for a full vertical shift</description>
    // Scroll effect
    varying mediump vec2 vTex;
    uniform lowp sampler2D samplerFront;
    uniform lowp float seconds;
    uniform lowp float xshift;
    uniform lowp float yshift;
    void main(void)
    	mediump vec2 tex = vTex;
    	if (xshift != 0.0) tex.x = mod(tex.x-mod(seconds,xshift)/xshift,1.0);
    	if (yshift != 0.0) tex.y = mod(tex.y-mod(seconds,yshift)/yshift,1.0);
    	gl_FragColor = texture2D(samplerFront,tex);
    For some reasons tiledbackgrounds seem to do it though either layout size or window size. Sprites work as expected.
    The tiledbackgrounds is 16x16 and its width is a multiple of 16 and its height is 16.
    Any support, will be greatly appreciated, in addition can you explain what you done so I can learn. 
    Thank you
  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)