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

Pages: [1] 2 3 ... 5
1
Projects / Re: TheoTown
« on: December 21, 2015, 12:47:04 pm »


Thank you, Egon.

Is there any chance to improve blitting performance? Another thing is that uniforms applied to a blitting shader seem to be ignored because blits are drawn batched so just the last set values will be used for one batch.

2
Projects / Re: TheoTown
« on: August 25, 2015, 09:59:12 am »
It has a heap size of 16 MB ;D

ETC doesn't help because it needs for a short time even more memory than without it (I guess it's because of the compressing process). I think it would be needed here to upload just parts of the texture so that the whole image never has to be stored within the VM heap.

3
Projects / Re: TheoTown
« on: August 24, 2015, 08:08:23 pm »
Thank you :)

I use a huge 2048x2048 texture which contains all the graphics (so it's a texture atlas). Textual plugins then define the coordinates of single frames. I experimented on other solutions but the texture atlas seems to be the fastest for drawing.

This is the texture with a scaling of 25%:


A problem are old devices with a too small VM stack. They can't run the game, even if the texture size is supported.

4
Projects / TheoTown
« on: August 24, 2015, 11:24:05 am »
Hi,

I wrote a 2d city simulation game using jPCT as blitting engine. It's still in alpha phase but I'm working on it :)

Homepage: http://www.theotown.de/app/
Google Play: https://play.google.com/store/apps/details?id=info.flowersoft.theotown.theotown

Greetings
Lobby

5
Support / Re: Shader for blitting
« on: April 26, 2015, 12:52:23 pm »
Yeah, that's often used for 2d, but it's anything else than trivial :( .

6
Support / Re: Shader for blitting
« on: April 25, 2015, 03:40:46 pm »
You're right there. Performance tests revealed that blitting is much faster than using 3D objects instead.

7
Support / Re: Shader for blitting
« on: April 24, 2015, 11:29:31 pm »
Thank you, seems to work for me. Here a test where I just desaturate a game:


I used the shaders as following.

Vertex:
Code: [Select]
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;

uniform vec4 additionalColor;
uniform vec4 ambientColor;

uniform float alpha;

uniform bool useColors;

attribute vec4 position;
attribute vec4 color;
attribute vec2 texture0;

varying vec2 texCoord;
varying vec4 vertexColor;

void main() {

texCoord = (textureMatrix * vec4(texture0, 0, 1)).xy;

vec4 vertexPos = modelViewMatrix * position;
vertexColor = ambientColor + additionalColor;

vertexColor=vec4(min(vec3(1), vertexColor.xyz * color.xyz), alpha);

gl_Position = modelViewProjectionMatrix * position;
}

Fragment:
Code: [Select]
precision mediump float;

uniform sampler2D textureUnit0;

varying vec2 texCoord;
varying vec4 vertexColor;

void main() {
vec4 col = texture2D(textureUnit0, texCoord) * vertexColor;

    float grey = 0.3 * col.r + 0.6 * col.g + 0.1 * col.b;

col = vec4(vec3(grey), col.a);

gl_FragColor=col;
}

Which shader code is used for blitting by default? Maybe you can also provide it's source if it contains some useful optimizations.


Z-Testing in this context means that one can set a depth value for each blit and only fragments with smaller depth value should be drawn. I could need this to solve some issues with drawing the cars. I always have to draw them in the right order now to avoid wrong overlapping.

8
Support / Re: Shader for blitting
« on: April 18, 2015, 06:51:42 pm »
Hey Egon, did you forget it?  ;D

Another thing: May it possible to use z-Testing for blitting?

9
Support / Re: Shader for blitting
« on: April 08, 2015, 03:59:36 pm »
I hadn't something special in mind. Just thought it would be really useful to render some effects without 3d objects.

10
Support / Shader for blitting
« on: April 06, 2015, 10:35:51 am »
Hello, is there a way to set an own shader for blitting?

11
Support / Re: Object3D's transparency issue
« on: January 05, 2015, 03:35:24 pm »
I can't open the image :( .

12
Support / Re: Question about transparency
« on: January 05, 2015, 11:21:44 am »
B behind the A  and C behind the B,   but it seems   b and c  can see  through A .  It maybe the Z-Order problem.

Yes, that sounds like the z-ordering problem on transparent objects. See this topic for more information. I also provide there a sample with a costum shader to solve the problem using alpha testing (which just means that fully transparent texels won't be drawn).

13
Support / Re: Question about transparency
« on: January 04, 2015, 09:58:41 am »
In order to load a texture with alpha channel you have to use a Texture constructor where you specify the useAlpha parameter with true. Otherwise the transparency won't be loaded. A setTransparency(15) should then be enough to see the changes. Be aware that you may get problems with the drawing order when using transparency like this.

Here I would recommend instead a own shader which just doesn't draw one specific color (like black). This also would solve the Z-Order problem.

14
Support / Re: Object3D's transparency issue
« on: January 03, 2015, 01:54:34 pm »
Indeed it will ;) . Alpha testing is also used in minecraft btw.

15
Support / Re: Object3D's transparency issue
« on: January 03, 2015, 11:38:57 am »
Maybe you should make sure that you call setTransparency(-1) on your objects so they will use the Z-buffer correctly.

Pages: [1] 2 3 ... 5