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

Pages: 1 ... 6 7 [8] 9 10 ... 20
106
Support / Re: Texture becomes blur and pixelated after many onResume
« on: September 04, 2014, 06:10:02 pm »
Hi egon,

I realized some parts of my code are using scalarMul for texture matrix. I think I might need clearTranslation instead. Is it ok if you could include the method in jpct-ae? In addition, the jpct-ae.jar does not include the virtualizer performance fix. Could you tag along the fix with the jar as well? Thank you so much and sry for any inconvenience. 

107
Support / Re: Texture becomes blur and pixelated after many onResume
« on: September 04, 2014, 09:36:06 am »
It should be alright then. Thanks alot for your help, egon.

108
Support / Re: Texture becomes blur and pixelated after many onResume
« on: September 04, 2014, 05:11:30 am »
Hi egon,

Thanks for the new jar.

So far I'm just translating the matrix, no rotation yet. But it'd be a great feature in the future to clear only translation without affecting the rotation. BTW, if rotation values get bigger, possible that it will distort the texture too? and may be even object rotation matrix and translation? Should we limit all the values as well?

109
Support / Re: Texture becomes blur and pixelated after many onResume
« on: September 03, 2014, 06:17:26 pm »
is it a good idea to control the limit values of texture matrix? I wanted to check the texture matrix translation if it exceed certain value then reset it back to 0, but it seems like the matrix returns new object of translation in getTranslation() and there is no clear translation method. Is it possible if we can get translation from matrix by object pointing (e.g. getTranslation(SimpleVector)) and clear translation method?

110
Support / Re: Texture becomes blur and pixelated after many onResume
« on: September 03, 2014, 04:43:51 pm »
Hi Egon,

I think I found the root cause. I'm translating the texture matrix for that object. When the translation values gets bigger, the texture starts to get pixelated.

The attachment shows the pixelated and fine textures respectively (with distinct colored texture).

Is it common that texture may be get distorted when texture matrix values are too big for the shader to handle?

111
Support / Re: Texture becomes blur and pixelated after many onResume
« on: September 02, 2014, 04:41:48 pm »
I roughly take the same portion of the screen for comparison. But you can see the pixelated area in lost.jpg whereas the other one is fine.


112
Support / Texture becomes blur and pixelated after many onResume
« on: September 02, 2014, 03:42:20 pm »
Hi egon,

I have this issue where the texture becoming more blur and pixelated each time the live wallpaper resumes from pause. It takes many times till the effect is obvious. The texture is in 512x512, mipmap, and compression enabled ( setTextureCompression(true) ).

Can it be the texture is compressed over and over again till it loses the quality?

113
Support / Re: GLSLShader pass matrix array
« on: September 01, 2014, 09:58:02 am »
It should be ok then, thanks alot ; ).  Just that I worry that it will consume CPU at backend, expecially for live wallpaper. It just drain battery REAL fast if some CPU cycles are wasted.

114
Support / Re: GLSLShader pass matrix array
« on: September 01, 2014, 08:59:57 am »
Yea, I could do that with the individual instances GLSLShader. Does it cost more in switching the shader program? If the cost is high, is it possible to point the matrix object to shader instead of creating new array instance in GLSLShader (mayb I can convert matrix to float array manually and pass into shader)?

115
Support / Re: GLSLShader pass matrix array
« on: September 01, 2014, 08:01:33 am »
Hi Egon,

Sry to bring this up. I shared the the same shader with multiple objects and they pass different length of matrix array, but it causes an error

Code: [Select]
09-01 13:41:50.153: E/AndroidRuntime(27402): FATAL EXCEPTION: GLThread 35538
09-01 13:41:50.153: E/AndroidRuntime(27402): java.lang.ArrayIndexOutOfBoundsException: length=144; index=144
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.GLSLShader$Uniform.setValue(GLSLShader.java:1340)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.GLSLShader.set(GLSLShader.java:1025)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.GLSLShader.setUniform(GLSLShader.java:582)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.kisionlab.oceanblue3d.objects.TurtleScene$1.beforeRendering(TurtleScene.java:107)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:467)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2314)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.World.draw(World.java:1361)
09-01 13:41:50.153: E/AndroidRuntime(27402): at com.threed.jpct.World.draw(World.java:1099)

Is GLSLShader not meant to be shared among other objects?

116
Support / Re: Transparent object not showing in some devices
« on: September 01, 2014, 05:38:07 am »
I think I'll stick with current one since it's working now.. Thanks alot for your help egon. Really appreciate it

117
Support / Re: Transparent object not showing in some devices
« on: August 31, 2014, 03:58:04 pm »
I tried reducing the number of uniforms, varying and attributes, and for some reasons, it's working fine! I'm not quite sure what actually fixed it.

btw, if we use the multi pass, does it reduce the cost performance for transparency?

118
Support / Re: Transparent object not showing in some devices
« on: August 31, 2014, 06:21:42 am »
What are the 'hacks'? Would love to listen more about it ;)

119
Support / Re: Transparent object not showing in some devices
« on: August 30, 2014, 07:25:44 pm »
Yes, i'm using my custom shader. There is no warning or error for the shader. It seems like Broadcom is behaving different compared to PowerVR chip.

Here's my custom shader,
vertex shader:
Code: [Select]
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;

uniform vec4 additionalColor;
uniform vec4 ambientColor;

uniform float shininess;

uniform int lightCount;

uniform mat4 skinPalette[17];

uniform vec3 lightPositions[8];
uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];
uniform float attenuation[8];

attribute vec4 position;
attribute vec3 normal;
attribute vec2 texture0;
attribute vec2 texture1;

attribute vec4 skinWeights;
attribute vec4 skinJointIndices;

varying vec2 texCoord[4];
varying vec4 vertexColor;

void main() {

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

vec4 myPosition = vec4(0,0,0,0);
vec3 myNormal = vec3(0,0,0);

vec4 vertexTemp;
vec3 normalTemp;
mat4 mat;

mat = skinPalette[int(skinJointIndices[0])];
vertexTemp = mat * position;
vertexTemp *= skinWeights.x;
myPosition += vertexTemp;
normalTemp = mat3(mat) * normal;
normalTemp *= skinWeights.x;
myNormal += normalTemp;

mat = skinPalette[int(skinJointIndices[1])];
vertexTemp = mat * position;
vertexTemp *= skinWeights.y;
myPosition += vertexTemp;
normalTemp = mat3(mat) * normal;
normalTemp *= skinWeights.y;
myNormal += normalTemp;

vec4 vertexPos = modelViewMatrix * myPosition;
vertexColor = ambientColor;

if (lightCount>0) {
// This is correct only if the modelview matrix is orthogonal. In jPCT-AE, it always is...unless you fiddle around with it.
vec3 normalEye   = normalize(modelViewMatrix * vec4(myNormal, 0.0)).xyz;

float angle = dot(normalEye, normalize(lightPositions[0] - vertexPos.xyz));

if (angle > 0.0) {
vertexColor += vec4((diffuseColors[0] * angle + specularColors[0] * pow(angle, shininess))*(1.0/(1.0+length(lightPositions[0] - vertexPos.xyz)*attenuation[0])), 1) * additionalColor;
}
}

gl_Position = modelViewProjectionMatrix * myPosition;
}
skinPalette, skinWeights, skinJointIndices are the variables for hardware skinning.

fragment shader:
Code: [Select]
precision mediump float;

uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;

uniform int textureCount;

varying vec2 texCoord[4];
varying vec4 vertexColor;

void main() {
vec4 col = texture2D(textureUnit0, texCoord[0]) * vertexColor;
gl_FragColor=col;
}

In addition, I tried with this edited default vertex shader with fragment shader above:
vertex shader:
Code: [Select]
uniform mat4 modelViewMatrix;
uniform mat4 modelViewProjectionMatrix;
uniform mat4 textureMatrix;

uniform vec4 additionalColor;
uniform vec4 ambientColor;
uniform float shininess;

uniform int lightCount;

uniform vec3 lightPositions[8];
uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];
uniform float attenuation[8];

attribute vec4 position;
attribute vec3 normal;
attribute vec2 texture0;
attribute vec2 texture1;

varying vec2 texCoord[4];
varying vec4 vertexColor;

void main() {

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

vec4 vertexPos = modelViewMatrix * position;
vertexColor = ambientColor;

if (lightCount>0) {
// This is correct only if the modelview matrix is orthogonal. In jPCT-AE, it always is...unless you fiddle around with it.
vec3 normalEye   = normalize(modelViewMatrix * vec4(normal, 0.0)).xyz;

float angle = dot(normalEye, normalize(lightPositions[0] - vertexPos.xyz));

if (angle > 0.0) {
vertexColor += vec4((diffuseColors[0] * angle + specularColors[0] * pow(angle, shininess))*(1.0/(1.0+length(lightPositions[0] - vertexPos.xyz)*attenuation[0])), 1) * additionalColor;
}

}

gl_Position = modelViewProjectionMatrix * position;
}
The result is even more strange. The object shows only part of it, and the rest of polygons are not showed. But it looks fine in other devices.

120
Support / Transparent object not showing in some devices
« on: August 30, 2014, 12:40:06 pm »
Hi Egon,

Have you had this situation before? Tested on galaxy trend plus (I think the GPU is Broadcom VideoCore IV). However, other devices like S4 and note 10 are working fine. Previously, I removed some uniforms in shader and it worked fine. But after I'm adding more objects, the transparent object disappears again. Could this be possibly caused by the shader/hardware limitation?

Pages: 1 ... 6 7 [8] 9 10 ... 20