Results 1 to 5 of 5

Thread: OGLES2 Add Full Shader Today

  1. #1
    Lesser Wizard
    Join Date
    Feb 2013
    Posts
    142

    Default OGLES2 Add Full Shader Today

    Add full shader on ogles2, test in iphone 4, IOS 7.1 Good

    https://github.com/fatalfeel/proton_sdk_source

  2. #2
    Lesser Wizard
    Join Date
    Feb 2013
    Posts
    142

    Default pointLight modify for Specularcolor

    //pointLight of COGLES2Solid.vsh and COGLES2Solid2.vsh

    if (NdotL > 0.0)
    {
    diffuse += uLightDiffuse[index] * NdotL * Attenuation;

    vec3 HalfVector = normalize(L + vec3(0.0, 0.0, 1.0));
    float NdotH = max(0.0, dot(normal, HalfVector));

    float SpecularFactor = pow(NdotH, uMaterialShininess);
    specular += uLightSpecular[index] * SpecularFactor * Attenuation;
    }
    //to

    if (NdotL > 0.0)
    {
    diffuse += uLightDiffuse[index] * NdotL * Attenuation;
    }

    vec3 HalfVector = normalize(L + vec3(0.0, 0.0, 1.0));
    float NdotH = dot(normal, HalfVector);

    if (NdotH > 0.0)
    {
    specular += pow(NdotH, uMaterialShininess) * uLightSpecular[index] * Attenuation;
    }



    ref.
    http://glslstudio.com/primer/
    http://antonholmquist.com/blog/openg...ting-examples/
    https://github.com/kizzx2/irrlicht-o...edPipeline.vsh
    http://ogldev.atspace.co.uk/www/tuto...utorial19.html
    http://www.ntu.edu.sg/home/ehchua/pr...icstheory.html

    Quote Originally Posted by feelthat View Post
    Add full shader on ogles2, test in iphone 4, IOS 7.1 Good

    https://github.com/fatalfeel/proton_sdk_source
    Last edited by feelthat; 12-07-2014 at 12:19 AM.

  3. #3
    Master Sorcerer North44's Avatar
    Join Date
    May 2014
    Location
    I live in my house
    Posts
    1,860

    Default

    Quote Originally Posted by feelthat View Post
    Add full shader on ogles2, test in iphone 4, IOS 7.1 Good

    https://github.com/fatalfeel/proton_sdk_source
    Hmm...I wonder what's this about?

    IGN: Decoded

    Currently Retired. Account closed. World locks growing dusty:2900
    Follow me on Instagram @DecodedGT

    Subscribe to me on YT: https://www.youtube.com/user/RKCnr8

  4. #4
    Lesser Wizard
    Join Date
    Feb 2013
    Posts
    142

    Default on HTC one X test ok

    fixed bug for new ndk
    add faster multiply matrix for ios and android

    #if defined TARGET_OS_IPHONE
    vDSP_mmul( m2, 1, m1, 1, M, 1, 4, 4, 4 );

    #elif defined ANDROID_NDK
    float32x4_t x0,x1,x2,x3;
    float32x4_t y0,y1,y2,y3;

    x0 = vld1q_f32(&m1[0]);
    x1 = vld1q_f32(&m1[4]);
    x2 = vld1q_f32(&m1[8]);
    x3 = vld1q_f32(&m1[12]);

    y0 = vld1q_f32(&m2[0]);
    y1 = vld1q_f32(&m2[4]);
    y2 = vld1q_f32(&m2[8]);
    y3 = vld1q_f32(&m2[12]);

    const float32x4_t A0 = vmulq_f32(x0, vdupq_n_f32(vgetq_lane_f32(y0,0)));
    const float32x4_t B0 = vmulq_f32(x1, vdupq_n_f32(vgetq_lane_f32(y0,1)));
    const float32x4_t C0 = vmulq_f32(x2, vdupq_n_f32(vgetq_lane_f32(y0,2)));
    const float32x4_t D0 = vmulq_f32(x3, vdupq_n_f32(vgetq_lane_f32(y0,3)));
    const float32x4_t _R0 = vaddq_f32( vaddq_f32(A0 , B0), vaddq_f32(C0, D0) );

    const float32x4_t A1 = vmulq_f32(x0, vdupq_n_f32(vgetq_lane_f32(y1,0)));
    const float32x4_t B1 = vmulq_f32(x1, vdupq_n_f32(vgetq_lane_f32(y1,1)));
    const float32x4_t C1 = vmulq_f32(x2, vdupq_n_f32(vgetq_lane_f32(y1,2)));
    const float32x4_t D1 = vmulq_f32(x3, vdupq_n_f32(vgetq_lane_f32(y1,3)));
    const float32x4_t _R1 = vaddq_f32( vaddq_f32(A1 , B1), vaddq_f32(C1 , D1) );

    const float32x4_t A2 = vmulq_f32(x0, vdupq_n_f32(vgetq_lane_f32(y2,0)));
    const float32x4_t B2 = vmulq_f32(x1, vdupq_n_f32(vgetq_lane_f32(y2,1)));
    const float32x4_t C2 = vmulq_f32(x2, vdupq_n_f32(vgetq_lane_f32(y2,2)));
    const float32x4_t D2 = vmulq_f32(x3, vdupq_n_f32(vgetq_lane_f32(y2,3)));
    const float32x4_t _R2 = vaddq_f32( vaddq_f32(A2 , B2), vaddq_f32(C2 , D2) );

    const float32x4_t A3 = vmulq_f32(x0, vdupq_n_f32(vgetq_lane_f32(y3,0)));
    const float32x4_t B3 = vmulq_f32(x1, vdupq_n_f32(vgetq_lane_f32(y3,1)));
    const float32x4_t C3 = vmulq_f32(x2, vdupq_n_f32(vgetq_lane_f32(y3,2)));
    const float32x4_t D3 = vmulq_f32(x3, vdupq_n_f32(vgetq_lane_f32(y3,3)));
    const float32x4_t _R3 = vaddq_f32( vaddq_f32(A3 , B3), vaddq_f32(C3, D3) );

    vst1q_f32(&M[0], _R0);
    vst1q_f32(&M[4], _R1);
    vst1q_f32(&M[8], _R2);
    vst1q_f32(&M[12], _R3);

    #else
    M[0] = m1[0]*m2[0] + m1[4]*m2[1] + m1[8]*m2[2] + m1[12]*m2[3];
    M[1] = m1[1]*m2[0] + m1[5]*m2[1] + m1[9]*m2[2] + m1[13]*m2[3];
    M[2] = m1[2]*m2[0] + m1[6]*m2[1] + m1[10]*m2[2] + m1[14]*m2[3];
    M[3] = m1[3]*m2[0] + m1[7]*m2[1] + m1[11]*m2[2] + m1[15]*m2[3];

    M[4] = m1[0]*m2[4] + m1[4]*m2[5] + m1[8]*m2[6] + m1[12]*m2[7];
    M[5] = m1[1]*m2[4] + m1[5]*m2[5] + m1[9]*m2[6] + m1[13]*m2[7];
    M[6] = m1[2]*m2[4] + m1[6]*m2[5] + m1[10]*m2[6] + m1[14]*m2[7];
    M[7] = m1[3]*m2[4] + m1[7]*m2[5] + m1[11]*m2[6] + m1[15]*m2[7];

    M[8] = m1[0]*m2[8] + m1[4]*m2[9] + m1[8]*m2[10] + m1[12]*m2[11];
    M[9] = m1[1]*m2[8] + m1[5]*m2[9] + m1[9]*m2[10] + m1[13]*m2[11];
    M[10] = m1[2]*m2[8] + m1[6]*m2[9] + m1[10]*m2[10] + m1[14]*m2[11];
    M[11] = m1[3]*m2[8] + m1[7]*m2[9] + m1[11]*m2[10] + m1[15]*m2[11];

    M[12] = m1[0]*m2[12] + m1[4]*m2[13] + m1[8]*m2[14] + m1[12]*m2[15];
    M[13] = m1[1]*m2[12] + m1[5]*m2[13] + m1[9]*m2[14] + m1[13]*m2[15];
    M[14] = m1[2]*m2[12] + m1[6]*m2[13] + m1[10]*m2[14] + m1[14]*m2[15];
    M[15] = m1[3]*m2[12] + m1[7]*m2[13] + m1[11]*m2[14] + m1[15]*m2[15];
    #endif

    Quote Originally Posted by feelthat View Post
    //pointLight of COGLES2Solid.vsh and COGLES2Solid2.vsh

    if (NdotL > 0.0)
    {
    diffuse += uLightDiffuse[index] * NdotL * Attenuation;

    vec3 HalfVector = normalize(L + vec3(0.0, 0.0, 1.0));
    float NdotH = max(0.0, dot(normal, HalfVector));

    float SpecularFactor = pow(NdotH, uMaterialShininess);
    specular += uLightSpecular[index] * SpecularFactor * Attenuation;
    }
    //to

    if (NdotL > 0.0)
    {
    diffuse += uLightDiffuse[index] * NdotL * Attenuation;
    }

    vec3 HalfVector = normalize(L + vec3(0.0, 0.0, 1.0));
    float NdotH = dot(normal, HalfVector);

    if (NdotH > 0.0)
    {
    specular += pow(NdotH, uMaterialShininess) * uLightSpecular[index] * Attenuation;
    }



    ref.
    http://glslstudio.com/primer/
    http://antonholmquist.com/blog/openg...ting-examples/
    https://github.com/kizzx2/irrlicht-o...edPipeline.vsh
    http://ogldev.atspace.co.uk/www/tuto...utorial19.html

  5. #5
    Master Sorcerer albzterninja's Avatar
    Join Date
    Mar 2014
    Location
    In a tree
    Posts
    1,928

    Default

    (WARNING, NOTHING POST RELATED!)

    Lel, i have absolutely no idea what you guys are talking about, but I'm downloading Microsoft visuals c++ express and Direct x SDK, and I'm gonna try to someday understand this :]

    Subscribe if you enjoy my videos!

    <---- Thanks chudy!

Similar Threads

  1. OGLES2.0 update 2014
    By atuca in forum Proton SDK
    Replies: 1
    Last Post: 11-17-2014, 01:43 AM
  2. RT3DApp and RTPhysics done in Ogles2 and OpenGL
    By feelthat in forum Proton SDK
    Replies: 18
    Last Post: 12-26-2013, 08:23 PM
  3. Introduce How to use .vert and .frag on OGLES2
    By feelthat in forum Proton SDK
    Replies: 4
    Last Post: 12-04-2013, 12:24 PM
  4. integrated OGLES2 into Proton 3D
    By feelthat in forum Proton SDK
    Replies: 5
    Last Post: 10-22-2013, 12:03 PM
  5. Shader Help
    By jerkald in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 09-07-2008, 09:54 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •