[Help] Shader Conversion from ShaderToy

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • Got an erros on this: "^" .

    Tried this:

    uv -= -4.65 + 49.38333*scale - 143.5 * pow(scale.x, 2.0) + 126.6667 * pow(scale.x, 3.0);

    And sometimes it get just the center, other times not. :(

    Any help please? Gigatron ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I tried something, maybe this is what you looking for ?

    void main() { // Sprite Area vec2 uv= vTex; uv -= 0.5; // offset uv -= offset; // scale uv = scale * uv; // rotate uv = cos(rotate) * uv + sin(rotate) * vec2(uv.y, -uv.x); uv += 0.5; // center image in canvas - Not works on C2 //uv += 0.5; // Fix the tile thing uv = fract(uv); gl_FragColor = texture2D(samplerFront, uv); }

  • Hey! SnipG yes, works! I need to test better but yes, seems was a problem with the order and adding a uv -= before.

    Thanks!

  • Well found an error due i'm suing an updated version with a divider:

    {
    	
    	// Sprite Area
    	vec2 uv= vTex; 
    	
    	// center image in canvas 1
    	uv -= 0.5; 
    	
    	// offset
     uv -= offset;
    	
    	// scale
     uv /= scale;
    
    	// rotate
     uv = cos(rotate) * uv + sin(rotate) * vec2(uv.y, -uv.x);
    	
    	
    	// center image in canvas 2
     uv += 0.5; 
    
    	// Fix the tile thing + Divider
    	vec2 n = vec2(1.0, 1.0) * divider;
     uv = fract(uv*n);
    
    	gl_FragColor = texture2D(samplerFront, uv);
    
    }
    

    vec2 n = vec2(1.0, 1.0) * divider;

    What i do i load an image on tuntime this one can be 10x10. So i scale it bigger than 1024x1024. What i do i set on Divider parameter that scalation, so i keep the orignal texture size to use the Scale parameter.

    Any idea how to fix?

  • I have to test more but i think i fixed it with this:

    uv += 0.5/(divider);

    Then now no matter the divider still the image is on center, but i have to confirm to be 100% sure.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)