Login Action Required

The NinevehGL Forum uses a new concept of "socialized forum" or as we like to say "Tweet Forum".

Here is the deal:
  1. No new registration is required. Just sign in with your Twitter account and authorize the NinevehGL Forum.
  2. Once you’re in, you'll be able to "Follow a Thread", that means every time that thread receive a new post or update you'll receive a mention on your twitter.
  3. Besides, you can enable "Auto Share", then every new post and/or thread you make will be tweeted on your timeline. (By default, auto-share is enabled only for your threads)

Forum Rules:

1. We understand human comunication can become "hot" sometimes. So some insults and bad words ARE allowed. Just don't push too much being an asshole all the time.

2. SPAMMERS are not allowed. There are penalties for this kind of user and they can be banned forever.

3. You can report other users, if you judge necessary. An user reported many times by many people can also be banned forever. However you can also receive penalties for report deliberately for no apparent reason.

If there is a similar thread title, make sure the other one doesn't already have the answer you're looking for.

This forum uses the BBCode (Bulletin Board Code), here are some instructions:

Bold: [b]text[/b]
Italic: [i]text[/i]
Underline: [u]text[/u]

Code: [code]text[/code]

[ul] [*]item [/ul]
[ol] [*]item [/ol]



Embed (videos, code, 3D):

Welcome to the NinevehGL's world!
NinevehGL is a 3D engine forged with pure Obj-C.
Welcome to the
Hello, Guest.

Your current vote:

You can change your vote many times. But it's still one single vote.

My shader with bump and reflective
Vote this thread:


Posts: 1


Sat, Jan 12 2013


First, thanks for this 3D engine! Pretty good job!

I'm trying to prepare my own shader. I would like to apply bump map, however when I'm trying to use a_nglTangent variable, "ERROR: 0:49: Use of undeclared identifier 'a_nglTangent'" exception appears.
I can try also to create tangent, similar to:

vec3 tangent;
vec3 v1 = cross(gl_Normal, vec3(0.0,0.0,-1.0));
vec3 v2 = cross(gl_Normal, vec3(0.0,-1.0,0.0));
if (length(v1) > length(v2))
tangent = v1;
tangent = v2;
vec3 n = normalize(gl_NormalMatrix * gl_Normal);
vec3 t = normalize(gl_NormalMatrix * tangent);

in vertex shader, however I don't know how to get gl_Normal.
Can anyone help?
…maybe there is other way - is possible to combine my shader with NinevehGL material?
Thanks in advance.

0% like this - 0/0


Posts: 571


Mon, Jan 14 2013

In response to: @jacek_jk


First, my suggestion is to make a deep read of his content:

There are some rules to create your own shaders:

  1. NinevehGL already have bump maps, you don't need to create it again.
  2. Only the variables used by the current material will exist in shaders because the GLSL ES (OpenGL ES Shading Language) has a very limited number of variables, so NinevehGL will always optimize its usage for you. That means if the material doesn't include the bump map the tangent and bitangent will not exist in the shaders.
  3. In GLSL ES 1.0 there is no such things like gl_NormalMatrix nor gl_Normal. This is all things related to the desktop version, remember that mobile optimizes everything. You'll find in that document above that NinevehGL use the "a_nglNormal" in the VSH and "v_nglNormal" in the FSH.
  4. Rember that NinevehGL has its own algorithm to calculate lights, much more optimized than the normal mode that you'll find in blogs or tutorials. To get access to the calculated variables in the FSH you can use these variables: _nglNormal, _nglVEye, _nglVLight. All these three vectors is the normalized and precalculated version of the correspondent information.

By the way, make sure you have correctly set all your custom variables in "variables" property of your NGLShader, this include also controlling the memory and retain count of the sources you set to those variables.
0% like this - 0/0

NinevehGL is a 3D engine built right on top of OpenGL ES and it uses all the programmable pipeline power, making it easy for you to create great application with shaders.

Share on

Follow NinevehGL
Fastest way to contact us:

Copyright © 2011 db-in. All rights reserved.