Giter Site home page Giter Site logo

the light do not work in iphone4 about minko HOT 21 CLOSED

aerys avatar aerys commented on July 1, 2024
the light do not work in iphone4

from minko.

Comments (21)

JMLX42 avatar JMLX42 commented on July 1, 2024

TeapotsExample.as uses a special shader (NormalsShader). This very shader does not handle lighting. It was made for a simple purpose: have a cool rendering with the TeapotsExample and CubesExample demos.

Thus, it is perfectly normal that the rendering is not affected by the "lightEnabled" property: the shader does not provide lighting. And whether you run it on iPhone 4 or on PC won't make a difference.

If you want to have simple directional lighting, use the BasicShader as we do in the DirectionalLightExample.
If you want complex lighting, use the minko-lighting extension and have a look at the lighting examples.

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

hello @promethe42
it is the TerrainExample.as
it is not work on ios when i open the lightenable.
but it is work on pc .

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

oh sorry it is not light issue. it is the issue Embed image.

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

We need a more detailed bug report, code to reproduce the issue and some screen captures if possible.

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

it is not a bug.

it is a issue of package ipa of my self.

but if i open the light the demo run at 30fps.
i close the light it is run at 60fps.

20000 face in ip4.

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

The TerrainShader uses a very simple directional lighting shader combined with texture splatting.
If enabling the light cuts down the framerate, it means the device is having a hard time handling the few extra pixel shader operations. It seams unlikely since directional lighting is less than 10 instructions...

What device are you using?

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

i use the iphone4.
code like this

_terrain = new Mesh(
terrainGeometry,
{
diffuseColor : 0xffffff,
lightEnabled : true
}
);

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

the full code

https://gist.github.com/3009829

https://gist.github.com/2976629

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

do you have the same results when you add a DirectionalLight using minko-lighting?

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

i am studying the minko . i have not used the minko-lighting.

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

I find it rather surprising that the directional lighting might cause such a big performance difference.

Here is the assembly code compiled at runtime with lighting on:

aerys.minko.example.core.terrain::TerrainShader
- vertex shader
m44 vt0.xyzw, va0.xyzw, vc0.xyzw
m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
mov op.xyzw, vt0.xyzw
mov vt0.x, vc8.xxxx
mov vt0.y, va0.zzzz
mov v0.xyzw, vt0.xyyy
mov vt0.w, vc8.yyyy
m33 vt0.xyz, va1.xyzw, vc0.xyzw
mov vt0.xyz, vt0.xyzz
mov v1.xyzw, vt0.xyzw
- fragment shader
tex ft0.xyzw, v0.xyyy, fs0 
nrm ft1.xyz, v1.xyzw
dp3 ft1.x, ft1.xyzz, fc1.xyzz
neg ft1.x, ft1.xxxx
sat ft1.x, ft1.xxxx
mul ft1.x, ft1.xxxx, fc0.wwww
mul ft1.xyz, ft1.xxxx, fc2.xyzz
add ft1.xyz, fc0.xyzz, ft1.xyzz
mul ft1.xyz, ft0.xyzz, ft1.xyzz
mov ft1.w, ft0.wwww
mov oc.xyzw, ft1.xyzw

Here is the same code with lighting off:

aerys.minko.example.core.terrain::TerrainShader
- vertex shader
m44 vt0.xyzw, va0.xyzw, vc0.xyzw
m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
mov op.xyzw, vt0.xyzw
mov vt0.x, vc8.xxxx
mov vt0.y, va0.zzzz
mov v0.xyzw, vt0.xyyy
- fragment shader
tex ft0.xyzw, v0.xyyy, fs0 
mov oc.xyzw, ft0.xyzw

As you can see it's just 9 instructions more when the lighting is on.
Is it an iPhone 4 or an iPhone4S?

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

aerys.minko.render.effect.basic::BasicShader

  • vertex shader
    m44 vt0.xyzw, va0.xyzw, vc0.xyzw
    m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
    mov op.xyzw, vt0.xyzw
    m33 vt0.xyz, va1.xyzw, vc0.xyzw
    mov v0.xyzw, vt0.xyzz
  • fragment shader
    mov ft0.w, fc0.wwww
    nrm ft0.xyz, v0.xyzz
    dp3 ft0.x, ft0.xyzz, fc2.xyzz
    neg ft0.x, ft0.xxxx
    sat ft0.x, ft0.xxxx
    mul ft0.x, ft0.xxxx, fc1.wwww
    mul ft0.xyz, ft0.xxxx, fc3.xyzz
    add ft0.xyz, fc1.xyzz, ft0.xyzz
    mul ft0.xyz, fc0.xyzz, ft0.xyzz
    mov oc.xyzw, ft0.xyzw

aerys.minko.render.effect.basic::BasicShader

  • vertex shader
    m44 vt0.xyzw, va0.xyzw, vc0.xyzw
    m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
    mov op.xyzw, vt0.xyzw
  • fragment shader
    mov oc.xyzw, fc0.xyzw

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

not 4s just iphone4

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

aerys.minko.render.effect.basic::BasicShader

  • vertex shader
    m44 vt0.xyzw, va0.xyzw, vc0.xyzw
    m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
    mov op.xyzw, vt0.xyzw
    m33 vt0.xyz, va1.xyzw, vc0.xyzw
    mov v0.xyzw, vt0.xyzz
  • fragment shader
    mov ft0.w, fc0.wwww
    nrm ft0.xyz, v0.xyzz
    dp3 ft0.x, ft0.xyzz, fc2.xyzz
    neg ft0.x, ft0.xxxx
    sat ft0.x, ft0.xxxx
    mul ft0.x, ft0.xxxx, fc1.wwww
    mul ft0.xyz, ft0.xxxx, fc3.xyzz
    add ft0.xyz, fc1.xyzz, ft0.xyzz
    mul ft0.xyz, fc0.xyzz, ft0.xyzz
    mov oc.xyzw, ft0.xyzw

aerys.minko.render.effect.basic::BasicShader

  • vertex shader
    m44 vt0.xyzw, va0.xyzw, vc0.xyzw
    m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
    mov op.xyzw, vt0.xyzw
  • fragment shader
    mov oc.xyzw, fc0.xyzw

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

Hmmm iPhone4 is a lot less powerful than the 4s if I remember correctly.
Getting half the framerate because of 10 pixel shader instructions is still weird...

But what's the point with quoting the assembly code? :)

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

need a fastShader. like BasicShader.but just interpose color.

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

Can you please try using the BasicShader instead of the TerrainShader and see if the lighting on/off still affects the framerate?

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

yes i always used the basicshader.
it is just 30 fps.
and the assembly code of basicshader

the light enable

aerys.minko.render.effect.basic::BasicShader
•vertex shader m44 vt0.xyzw, va0.xyzw, vc0.xyzw m44 vt0.xyzw, vt0.xyzw, vc4.xyzw mov op.xyzw, vt0.xyzw m33 vt0.xyz, va1.xyzw, vc0.xyzw mov v0.xyzw, vt0.xyzz
•fragment shader mov ft0.w, fc0.wwww nrm ft0.xyz, v0.xyzz dp3 ft0.x, ft0.xyzz, fc2.xyzz neg ft0.x, ft0.xxxx sat ft0.x, ft0.xxxx mul ft0.x, ft0.xxxx, fc1.wwww mul ft0.xyz, ft0.xxxx, fc3.xyzz add ft0.xyz, fc1.xyzz, ft0.xyzz mul ft0.xyz, fc0.xyzz, ft0.xyzz mov oc.xyzw, ft0.xyzw

close the light
aerys.minko.render.effect.basic::BasicShader
•vertex shader m44 vt0.xyzw, va0.xyzw, vc0.xyzw m44 vt0.xyzw, vt0.xyzw, vc4.xyzw mov op.xyzw, vt0.xyzw
•fragment shader mov oc.xyzw, fc0.xyzw

from minko.

JMLX42 avatar JMLX42 commented on July 1, 2024

You should use "pre" tags to embed the code. I can't read the ASM code if it's inlide like this :)
Still... no explanation for this performance issue.
Can you test on a 4s ?

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

test :)

aerys.minko.render.effect.basic::BasicShader
- vertex shader
m44 vt0.xyzw, va0.xyzw, vc0.xyzw
m44 vt0.xyzw, vt0.xyzw, vc4.xyzw
mov op.xyzw, vt0.xyzw
m33 vt0.xyz, va1.xyzw, vc0.xyzw
mov v0.xyzw, vt0.xyzz
- fragment shader
mov ft0.w, fc0.wwww
nrm ft0.xyz, v0.xyzz
dp3 ft0.x, ft0.xyzz, fc2.xyzz
neg ft0.x, ft0.xxxx
sat ft0.x, ft0.xxxx
mul ft0.x, ft0.xxxx, fc1.wwww
mul ft0.xyz, ft0.xxxx, fc3.xyzz
add ft0.xyz, fc1.xyzz, ft0.xyzz
mul ft0.xyz, fc0.xyzz, ft0.xyzz
mov oc.xyzw, ft0.xyzw

from minko.

lizhi525 avatar lizhi525 commented on July 1, 2024

yh ,i will try the 4s

from minko.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.