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

Pages: 1 2 3 [4] 5
46
Projects / Re: New Library And Game
« on: November 19, 2012, 10:43:55 pm »
I like it already :D It reminds me my first project for Android: Trace_On

47
Projects / Virtual Photo Gallery (spot lights in jPCT)
« on: November 19, 2012, 10:23:34 pm »
Hello everyone.

I was experimenting with spot lights in GLSL & jPCT and this is small fruit of my experiments - "Virtual Photo Gallery" (wallpaper and application).
There is strange side effect of those experiments - the regular application behaves different than wallpaper service, and it looks like TextureManager is not creating a new instance (IMHO logicaly it should ;) ) when application is reCreated (onCreate was called but TextureManager has it's old data) ??? but I don't want to dig into details of my struggle.

Anyway you can download it:
Link application: https://play.google.com/store/apps/details?id=com.zr.virtual.photo.gallery

Link to wallpaper: https://play.google.com/store/apps/details?id=com.zr.virtual.photo.gallery.wallpaper


48
Support / Re: Depth buffer error?
« on: November 05, 2012, 04:50:35 pm »
Thanks !!  :D , it helped, but I didn't enabled transparency in this object.

49
Support / Depth buffer error?
« on: November 05, 2012, 04:22:51 pm »
I have torus in the center of scene, when camera look at it from one side it is rendered ok, but when I move camera to other side it looks like a depth buffer error. Any advice how to avoid this kind of problem, is any cure for this?


50
Support / Re: Light diffuse colors in fragment shader
« on: October 31, 2012, 11:48:11 pm »
Thanks for advices. I will try to change... something ;) I had similar behavior when I have added "full" attenuation calculations - on Galaxy S2 it was ok but on the other two devices it has no effect, it looks like a distance from light to vertex was always 0. I think the value was so small so it was truncated to 0 or it was overflow and it was treated as 0 also - so for now I have to remove linear and quadratic attenuation, and left only spot exponent with constant attenuation - I know it make no sense.
Anyway I will try to experiment, but I was trying to set light intensity in range from 0.0 to 1.0 and pass value from Light.getIntensity() as another uniform and it worked.

51
Support / Light diffuse colors in fragment shader
« on: October 31, 2012, 04:58:59 pm »
I wanted to add to my shader diffuse colors for lights. Everything was fine on Samsung Galaxy S2, but on lower devices like LG-GT540 or Samsung Galaxy Mini it looks like I got zeros in diffuseColors array ??? What might be cause of this behavior? I can pass color for light in my own uniforms but I wanted to use existing ones.

52
Support / Re: Stationary spot light - how to?
« on: October 30, 2012, 11:51:24 pm »
Looks like it was quite diffrent problem. I solved it with workaround. I wanted to created programmatically a rectangle and make it appear in diffrent places. To make it short - some of the rectangles have changed order of indexes from CCW to CW, I don't know how but it works  ???


53
Support / Re: Stationary spot light - how to?
« on: October 30, 2012, 05:55:28 pm »
When I add objects to scene, and translate/rotate them, the spot for them is calculated completely wrong. The objects with letter "A" are almost in the same position as walls.



I think the problem is with spot direction - IMO it shouldn't be multiplied by modelView matrix, but if I don't do it the spot is changing its direction every time I move/rotate camera.

54
Support / Stationary spot light - how to?
« on: October 29, 2012, 08:40:20 pm »
I am trying to create stationary spot light, but so far I am stuck - shaders aren't my best side. I have created desired effect but only on objects which don't have any transformation. What I am doing wrong? I was trying diffrent combinations for transformed objects but in all cases the light was "moving" when I changed camera position. For simplicity I have removed attenuation (it is set to 1.0).

VP:
Code: [Select]
void main(void)
{
vec4 normal4 = vec4(normal, 0);
vec4 position4 = modelViewMatrix * position;
vec3 position3 = position4.xyz / position4.w;

vec4 eyeNormal4 = modelViewMatrix * normal4;
varNormal = eyeNormal4.xyz;

varLightDir[0] = normalize(lightPositions[0] - position3);
varSpotDir[0] = normalize((modelViewMatrix * vec4(lightSpotDir0,0)).xyz);
varLightDist[0] = length(lightPositions[0] - position3 );

texCoord = texture0;
gl_Position = modelViewProjectionMatrix * position;
}

FP:
Code: [Select]
void main (void)
{
vec4 finalColor;
float spotAngle;
vec3 n = normalize(varNormal);
vec3 normalLightDir;
float diff;
float att;

vec4 base = texture2D(textureUnit0, texCoord);
finalColor = base * ambientColor;
normalLightDir = normalize(varLightDir[0]);
diff = max(0.0, dot(n, normalLightDir));
if(diff > 0.0)
{
spotAngle = dot(normalize(-varSpotDir[0]), normalLightDir);
if(spotAngle > 0.75)  //spot cut off
{
spotAngle = pow(spotAngle, 12.0);
//att = spotAngle / (0.6 + 0.001 * tempDistance + 0.1 * tempDistance * tempDistance );
att= 1.0;
finalColor += (base) * diff * att ;
}
}

finalColor.a = alpha;
gl_FragColor = finalColor;
}

55
Bugs / Re: Set uniform with SimpleVector
« on: October 18, 2012, 10:08:43 pm »
Beta version work fine  :)

56
Bugs / Set uniform with SimpleVector
« on: October 18, 2012, 09:08:22 pm »
When I am trying to set uniform with setUniform(String, SimpleVector) I get error, but setting the same with float[] works ok. Uniform variable is vec3 type.
It's not big problem for me to use float arrays but maybe I done something wrong. I presume array version is faster than SimpleVector.

10-18 20:49:57.446: E/AndroidRuntime(11941): FATAL EXCEPTION: GLThread 8991
10-18 20:49:57.446: E/AndroidRuntime(11941): java.lang.NullPointerException
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GLSLShader.update(GLSLShader.java:561)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GL20.updateShaderData(GL20.java:215)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GLRenderer.initShader(GLRenderer.java:519)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.CompiledInstance.render(CompiledInstance.java:427)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.GLRenderer.drawVertexArray(GLRenderer.java:2211)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.World.draw(World.java:1307)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.threed.jpct.World.draw(World.java:1074)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at com.zr.tile3d.MainActivity.onDrawFrame(MainActivity.java:301)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
10-18 20:49:57.446: E/AndroidRuntime(11941):    at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)

57
Projects / Re: Escape From Creepy Lab
« on: October 10, 2012, 10:33:11 pm »
Sure you can add it.
Three buttons are needed for laser cannon, and teleport. At the begining I was thinkin about hiding/showing buttons depending on collided type of object, but it might be confused for user.
I wanted the fire button was primary operation (for enter gate action too), but then I imagined situation where other interactive object might be very close to the gate, and player has collision with gate and this object, so if you want to operate this object and pressed fire button it might be not nice suprise :) Thats why I assigned enter gate to "action up".


58
Projects / Escape From Creepy Lab
« on: October 06, 2012, 12:51:16 am »
Hi everyone.
I want to present my another production – oldschool-type arcade platformer - in fact it is 2D game presented with 3D graphics.  It does not contain advanced fx, shaders etc., just simple models and some skeletal animations. The idea to write this game comes from old game for C64. I thought it would be nice to play this game again, but without joystick as controller (screen joystick usualy is not a good idea) and with 3D graphics... and here it is: "Escape From Creepy Lab".

https://play.google.com/store/apps/details?id=com.zr.creepylab


59
Bones / How to change visibility of AnimatedGroup?
« on: July 28, 2012, 04:44:03 pm »
Hi.

I was try to change visibility of AnimatedGroup with something like this:

Code: [Select]
animGroup.getRoot().setVisibility(false);
but it is not working. How can I change the visiblitiy of animated group? I can remove it from world but in that case I have to give lower level objects access to World object.

60
Support / Re: Live Wllpaper Help
« on: June 05, 2012, 01:05:36 pm »
I don't provide you ready solution, but I am using GLWallpaperService from this page: http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapers and it works similar as GLSurfaceView. The only change you have to made there is when you want to use GLES2.0, but in that case changing phone orientation makes user to watch black screen for some time when framebuffer is initializing.

Pages: 1 2 3 [4] 5