Author Topic: Version updates!  (Read 177834 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #270 on: August 01, 2011, 10:41:16 pm »
Tried steep parallax mapping today...it's not feasible on current mobile gpus. Performance was around 4 fps on my Nexus S. Just too many ifs and whiles in the fragment shader, i guess... :(

Offline rhine

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Version updates!
« Reply #271 on: August 02, 2011, 11:06:28 pm »
Hey EgonOlsen, have you been able to test JPCT-AE against any of the tablet-based devices? If so, have you notice any performance difference/change?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #272 on: August 02, 2011, 11:13:31 pm »
No, i haven't tested it on a tablet yet. Judging from the benchmark results, performance is fine. It might be bit lower due to the higher resolution though. Here's for example a result from some Galaxy Tab: http://www.jpct.de/an3dbenchxl/details.php?code=MTY0MjUx108470

Offline rhine

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Version updates!
« Reply #273 on: August 02, 2011, 11:33:34 pm »
The resolution for these devices are only going to get higher over time (not to mention CPU and RAM). This is just one of the first links that came back from comparing the Galaxy Tab series models:

http://socialcompare.com/en/comparison/samsung-galaxy-tab-10-1-vs-8-9-vs-7-inch

I'd love to see these features your working on run against the larger devices as well.

Offline Nemetz

  • int
  • **
  • Posts: 53
    • View Profile
Re: Version updates!
« Reply #274 on: August 03, 2011, 07:50:16 am »
Yes, i tested some simple applications based on JPCT. On smaller  Galaxy Tab  in visual  and perfomance case i did't see any differences between Galaxy Tab and HTC Desire S.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #275 on: August 03, 2011, 03:43:38 pm »
I'm not sure what your question is all about...the engine doesn't care about the device it's running on as long as it's Android... ???

Offline rhine

  • byte
  • *
  • Posts: 5
    • View Profile
Re: Version updates!
« Reply #276 on: August 03, 2011, 09:45:34 pm »
I was simply referring to your new feature/enhancement tests. What I was hoping to suggest (sorry if I was not clear) was for you to consider higher performance Android devices as well (such as Galaxy Tab 10.1, Xoom and Google TV) again if at all possible.

Perhaps parallax mapping (and other features your working on) may not be ready for the current line of smartphones but it may run well on tablets. Anyhow, it was just a suggestion and I would be more than happy to help test new features for you if interested.

Thanks again for your hard work to make this engine awesome! :)

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #277 on: August 03, 2011, 09:56:27 pm »
Tried steep parallax mapping today...it's not feasible on current mobile gpus. Performance was around 4 fps on my Nexus S. Just too many ifs and whiles in the fragment shader, i guess... :(

I tried add your parallax shader and object to my game and when camera is moving closer (object take more pixels) fps drop down very fast, from 65 (I have removed default lock on galaxy s) to 25... bump or normal mapping would be faster... how it goes with the fragment lights? :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #278 on: August 03, 2011, 09:58:11 pm »
Perhaps parallax mapping (and other features your working on) may not be ready for the current line of smartphones but it may run well on tablets. Anyhow, it was just a suggestion and I would be more than happy to help test new features for you if interested.
Everybody is free to implement any kind of shaders...that parallax mapping thingy was just a test of mine. It's not part of the engine itself and it maybe never will.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #279 on: August 03, 2011, 10:01:09 pm »
I tried add your parallax shader and object to my game and when camera is moving closer (object take more pixels) fps drop down very fast, from 65 (I have removed default lock on galaxy s) to 25... bump or normal mapping would be faster... how it goes with the fragment lights? :)
You can strip the shader down to be simple normal mapping shader...or try these:

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

uniform vec4 additionalColor;
uniform vec4 ambientColor;

uniform vec3 lightPositions[8];

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

varying vec3 lightVec[2];
varying vec3 eyeVec;
varying vec2 texCoord;

void main(void)
{
texCoord = texture0.xy;

vec3 n = normalize(modelViewMatrix * vec4(normal,0.0)).xyz;
vec3 t = normalize(modelViewMatrix * vec4(tangent.xyz, 0.0)).xyz;

vec3 b = tangent.w*cross(n, t);

vec3 vVertex = vec3(modelViewMatrix * position);
vec3 tmpVec = lightPositions[0].xyz - vVertex;

vec3 lv;
vec3 ev;

lv.x = dot(tmpVec, t);
lv.y = dot(tmpVec, b);
lv.z = dot(tmpVec, n);

lightVec[0]=lv;

tmpVec = vVertex*-1.0;
eyeVec.x = dot(tmpVec, t);
eyeVec.y = dot(tmpVec, b);
eyeVec.z = dot(tmpVec, n);

gl_Position = modelViewProjectionMatrix * position;
}


Code: [Select]
precision mediump float;

varying vec3 lightVec[2];
varying vec3 eyeVec;
varying vec2 texCoord;

uniform sampler2D textureUnit0;
uniform sampler2D textureUnit1;

uniform vec3 diffuseColors[8];
uniform vec3 specularColors[8];

uniform vec4 ambientColor;

uniform float invRadius;

void main ()
{
vec4 vAmbient = ambientColor;
vec3 vVec = normalize(eyeVec);
vec4 base = texture2D(textureUnit0, texCoord);
vec3 bump = normalize(texture2D(textureUnit1, texCoord).xyz * 2.0 - 1.0);

float distSqr = dot(lightVec[0], lightVec[0]);
float att = clamp(1.0 - invRadius * sqrt(distSqr), 0.0, 1.0);
vec3 lVec = lightVec[0] * inversesqrt(distSqr);

float diffuse = max(dot(lVec, bump), 0.0);
vec4 vDiffuse = vec4(diffuseColors[0],0) * diffuse;

float specular = pow(clamp(dot(reflect(-lVec, bump), vVec), 0.0, 1.0), 0.85);
vec4 vSpecular = vec4(specularColors[0],0) * specular;

vec4 col = (vDiffuse*base + vSpecular) * att;

gl_FragColor = col+(vAmbient*base + vDiffuse*base + vSpecular) * att;
}

What do you mean with "how it goes with the fragment lights"?

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #280 on: August 03, 2011, 10:17:00 pm »
Thanks, I look at it tomorrow :) ... Are you working on implementation point and spot light to engine?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #281 on: August 03, 2011, 10:22:18 pm »
No, not really. Currently, my strategy is to let people write their own shader code for this, if they want to use it. That way, they can better adopt to the hardware/software they are using. I'm having enough trouble making the default shaders run on all devices (still no test results from Tegra 2...), which is why i don't want to add another layer of stuff that might require support from my side ATM. This may change once this ES 2.0 feature is stable and proven.

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Version updates!
« Reply #282 on: August 04, 2011, 10:14:48 pm »
normal mapping improve just 3 fps :(

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Version updates!
« Reply #283 on: August 05, 2011, 10:35:55 am »
Yes, offset mapping isn't that much more shader code, so it isn't much slower.

Offline keaukraine

  • byte
  • *
  • Posts: 34
    • View Profile
Re: Version updates!
« Reply #284 on: August 19, 2011, 06:31:41 pm »
No, not really. Currently, my strategy is to let people write their own shader code for this, if they want to use it. That way, they can better adopt to the hardware/software they are using. I'm having enough trouble making the default shaders run on all devices (still no test results from Tegra 2...), which is why i don't want to add another layer of stuff that might require support from my side ATM. This may change once this ES 2.0 feature is stable and proven.
Hey, I can test it on Tegra 2 tablet!