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 - lawless_c

Pages: 1 2 [3] 4 5 ... 7
31
Support / Re: How to set a blit shader?
« on: March 11, 2016, 02:41:06 pm »
screen just goes almost completely green and flickers. It doesn't crash. The HTC uses an Adreno GPU , whereas the ellephone p6000 uses a Mali one, that could be the issue.


32
Support / Re: How to set a blit shader?
« on: March 11, 2016, 01:14:00 pm »
Maybe have to update it though, shader works fine on an elephone p6000 but not on a HTC one.

33
Support / Re: How to set a blit shader?
« on: March 09, 2016, 11:16:25 pm »
Yeah i was doing exactly what you said i shouldn't do  :P.   Got it working now though  8)

Game boy style pixelated shader.

Partially based on Lobby s here http://www.jpct.net/forum2/index.php?topic=4355.0
and this pixelation shader http://coding-experiments.blogspot.ie/2010/06/pixelation.html



Vertex Shader
Code: [Select]
precision lowp float;
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;
attribute vec4 position;
attribute vec2 texture0;
varying  lowp vec2 v_texCoord;
void main() {
v_texCoord  = (textureMatrix * vec4(texture0, 0, 1)).xy;
gl_Position = modelViewProjectionMatrix * position;
}




FragmentShader
Code: [Select]

precision lowp float;

uniform sampler2D textureUnit0;
varying  lowp vec2 v_texCoord;
//pallete
lowp vec3 lighthest  = vec3(0.61,0.74,0.06);
lowp vec3 light      = vec3(0.55,0.67,0.06);
lowp vec3 dark       = vec3(0.19,0.38,0.19);
lowp vec3 darkest    = vec3(0.06,0.22,0.06);

void main() {
    float dx = 0.005859375;//3.0*(1./512.);
    float dy = 0.00390625; //2.*(1./512.);
    vec2 coord = vec2(dx*floor(v_texCoord.x/dx),
                      dy*floor(v_texCoord.y/dy));
    vec4 col = texture2D(textureUnit0, coord);

    float ave = (col.r + col.g +col.b)/3.0;
    vec3 fin;

    if(ave < 0.25){fin =darkest;}
    if(ave >= 0.25){fin =dark;}
    if(ave >= 0.50){fin =light;}
    if(ave >= 0.75){fin =lighthest;}

gl_FragColor= vec4(fin,1.0);
}

34
Support / How to set a blit shader?
« on: March 09, 2016, 02:08:06 am »
How and where should a shader be set for blitting?

I'm using a shader with fb.setBlittingShader but it get's ignored?

I'm trying to do this on an android device.

I'm trying to do a filtering effect kind of like this but it seems to just be ignored.

http://www.jpct.net/forum2/index.php?topic=4355.0

35
Support / Set a texture info to a blitter
« on: February 06, 2016, 01:02:10 am »
Is there any way to set a texture info to fb.blit?

I was looking at this thread here http://www.jpct.net/forum2/index.php/topic,4355.msg30380.html#msg30380

And thinking it would be great if i could also access a textureUnit1..3 as well as textureUnit0.

36
News / Re: Version 1.30 has been released!
« on: January 27, 2016, 04:24:51 pm »
oooh i only seeing this now. What does the shader blitter do?

37
Support / Re: Objects multiple worlds?
« on: October 17, 2015, 01:35:18 am »
 8) Got it, might need some adjustments but it sorta works.

 





Heres the code for it, i've commented out the parts related to an Object3d and my attempts to use shaders as a post processing effect(naming convention is a mess too).
when "switchToGlowRender" is  set to 'true' some Objects will be rendered completely black via their glsl fragment shaders, Others will be properly rendered.
In the case of the Aura effect im attempting it's only rendered during the glow render.




Code: [Select]
public class GlowProcessHandler {

    public NPOTTexture toProcess;
    World world;
    public Boolean switchToGlowRender = false;
    //Object3D theRenderspot = null;

   // GLSLShader renderShader = null;
  //  PostProcessingRenderHook renderHook = null;
    TextureManager tm = TextureManager.getInstance();
    int divRatio;


    public GlowProcessHandler(World world, Resources res, FrameBuffer bf) {

       // this.theRenderspot = Primitives.getPlane(6, 8);
        divRatio=32;


      //  renderShader = new GLSLShader(Loader.loadTextFile(res.openRawResource(R.raw.postprocess_vert)),
       //         Loader.loadTextFile(res.openRawResource(R.raw.postprocess_frag)));


        this.world = world;

        toProcess = new NPOTTexture(bf.getWidth()/divRatio , bf.getHeight()/divRatio, RGBColor.BLACK);
        toProcess.setFiltering(true);
        toProcess.setMipmap(false);
        tm.addTexture("postprocess", toProcess);
       // theRenderspot.setTexture("postprocess");


        //theRenderspot.setTransparency(3);
        //theRenderspot.setCulling(false);


        //renderHook = new PostProcessingRenderHook(theRenderspot, renderShader);
        //renderHook.setCurrentShader(renderShader);


//        theRenderspot.setOrigin(new SimpleVector(10, 0, 0));
//        theRenderspot.setShader(renderShader);
//        theRenderspot.setRenderHook(renderHook);

    }


    public void doPostProcess(FrameBuffer fb) {
        switchToGlowRender = true;

        fb.setRenderTarget(toProcess);
        fb.clear(Color.BLACK);
        world.renderScene(fb);
        world.draw(fb);
        fb.display();
        fb.removeRenderTarget();

        switchToGlowRender = false;
    }


    public void doBlit(FrameBuffer fb)
    {
       fb.blit(toProcess, 0, 0, 0, fb.getHeight(),
       fb.getWidth()/divRatio, fb.getHeight()/divRatio, fb.getWidth(), -fb.getHeight(), 44, true, null);

    }
}

38
Support / Re: Objects multiple worlds?
« on: October 15, 2015, 06:14:19 pm »
My code for it

toProcess is  the texture object

theRenderspot is the object3d

Code: [Select]
public void doPostProcess(FrameBuffer fb) {

        switchToGlowRender = true;

        fb.setRenderTarget(toProcess);
        world.renderScene(fb);
        world.draw(fb);
        fb.display();

       // tm.
        fb.removeRenderTarget();

        tm.replaceTexture("postprocess", toProcess);
       // theRenderspot.setTexture("postprocess");


        switchToGlowRender = false;

    }


Checked the config at the start so im definitely using opengl es 2.0

39
Support / Re: Objects multiple worlds?
« on: October 15, 2015, 04:13:21 pm »
yeah. I briefly got some weird effects , on the texture , will keep fiddling with it.

40
Support / Re: Objects multiple worlds?
« on: October 15, 2015, 12:01:28 pm »
Sorry to bother you again but should what would be the best way to implement/update this?

I mean creating a texture that is linked to an object3d that gets updated.

At the moment i have the frame buffer setRenderTarget    to a texture which i have set as a texture for an object3d , but that texture is just looking black.
It doesn't seem to update as it should.

41
Support / Re: Objects multiple worlds?
« on: October 13, 2015, 06:07:22 pm »
But I'm not sure why you want to for a glow effect... ???

If it works i may be able to use if for other kinds of effects or post processing.

If im sending framebuffer data to the texture instead will it be automatically updated for Object3d's using that texture? I.E the next time they're drawn they'll use it?

I'm not entirely clear on guaranteeing a texture is updated/changed.


42
Support / Re: Objects multiple worlds?
« on: October 12, 2015, 11:31:39 pm »
Does this sound reasonable?

1. I do a glow render, ie all objects are either strongly coloured if glowing or completely black
2.This render is sent to a texture an object3d is using.(can we change textures on an object for each render?)
3.This object3d has a renderhook/shader attached so it covers whole screen, and applies a blur (fullscreen quad)
4.We render again but this time to the frame-buffer.

I'm going to try out and will let you know if it works.

43
Support / Re: Objects multiple worlds?
« on: October 12, 2015, 07:17:18 pm »
Actually I may be able to do both in one world instance :-)

44
Support / Objects multiple worlds?
« on: October 12, 2015, 06:06:29 pm »
Is it possible to add the same instances of an Object3d to many worlds?

Would there be disposal or other issues?

I'm thinking of creating a another World object in which objects are added and the results are used to create a glowing effect.

If i could get these objects in the other world instance to use a different shader that would be even better. Maybe if i used the render-hook to switch them.
I could then use some combination of additive blending to overlay the result on the frame-buffer.

45
Support / Re: Screen size/shape & view area?
« on: August 17, 2015, 11:51:21 pm »
Ah that's perfect.

Pages: 1 2 [3] 4 5 ... 7