Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - KrissLaCross

Pages: [1]
Help / Multipass shaders in Otter2d
« on: November 01, 2016, 03:15:13 PM »

So I'm trying to implement a basic multipass shader using this tutorial: https://gamedevelopment.tutsplus.com/tutorials/how-to-write-a-smoke-shader--cms-25587
But I'm struggling with seting up the multipass system aka "The Frame Buffer Trick".
The simpel algorithm goes as follow:
  • Pass A through your shader, render onto B.
  • Render B to the screen.
  • Pass B through shader, render onto A.
  • Render A to your screen.
  • Repeat 1.

Where A and B are either two textures or two buffers. I decided too use two Surfaces, because that makes it easier to create some cool stuf later on.
But I'm struggling with step one, I'm just not really sure how too do this in Otter2d. I tried the following:
Code: [Select]
bufferA.Shader = shader;
tempBuffer = bufferA;
bufferA = bufferB;
bufferB = tempBuffer;

using the this simpel shader:
Code: [Select]
uniform sampler2D texture;

void main() {
vec4 color = texture2D(texture, gl_TexCoord[0].xy);
color.r += 0.01;
gl_FragColor = color;

But sadly it doesn't work and I don't know what I'm doing wrong.

I appreciate any help!
Thanks for your time!


Pages: [1]