Version updates!

Started by EgonOlsen, March 28, 2010, 09:47:50 PM

Previous topic - Next topic

EgonOlsen

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... :(

rhine

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?

EgonOlsen

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

rhine

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.

Nemetz

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.

EgonOlsen

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... ???

rhine

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! :)

Thomas.

Quote from: EgonOlsen 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... :(

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? :)

EgonOlsen

Quote from: rhine on August 03, 2011, 09:45:34 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.

EgonOlsen

Quote from: Thomas. on August 03, 2011, 09:56:27 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:


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;
}




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"?

Thomas.

Thanks, I look at it tomorrow :) ... Are you working on implementation point and spot light to engine?

EgonOlsen

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.

Thomas.

normal mapping improve just 3 fps :(

EgonOlsen

Yes, offset mapping isn't that much more shader code, so it isn't much slower.

keaukraine

Quote from: EgonOlsen 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.
Hey, I can test it on Tegra 2 tablet!