Hi Alex,
don't worry about the bad news: we're here to "solve" problems: no problems
= no fun :)
I think that it should be possible to pass tangent values
using gl_TexCoord variable.
I used OpenCollada exporter in 3dstudio max with "export tangent/binormal"
option turned on. In the .dae file created the are these lines:

<input semantic="VERTEX" source="#geom-Plane01-vertices" offset="0"/>

<input semantic="NORMAL" source="#geom-Plane01-normals" offset="1"/>

<input semantic="TEXCOORD" source="#geom-Plane01-map1" offset="2" set="1"/>

<input semantic="TEXTANGENT" source="#geom-Plane01-map1-textangents" offset=
"3" set="1"/>

<input semantic="TEXBINORMAL" source="#geom-Plane01-map1-texbinormals"offset=
"3" set="1"/>

Now I know that tangent and binormal per-vertex values are described in the
mesh file. How to read that values in the GLSL shader? Here it is how
collada handles multiple texture:

http://www.gamedev.net/community/forums/topic.asp?topic_id=529630&whichpage=1&#3429961

..so I tried to modify the .dae file to pass tangents and binormal values as
multiple texture coordinates adding these lines:

<input semantic="TEXCOORD" source="#geom-Plane01-map1" offset="2" set="0"/>
[...]

<bind_vertex_input semantic="TEXCOORD" input_semantic="TEXTANGENT"input_set=
"1" set="1"></bind_vertex_input>

<bind_vertex_input semantic="TEXCOORD" input_semantic="TEXBINORMAL"input_set=
"1" set="2"></bind_vertex_input>

..and then I tried to access texture UV coords using gl_TexCoord[0],
tangents coords using gl_TexCoord[1], and binormal coords
using gl_TexCoord[2]
but it doesn't seem to work. :\

Am I wasting my time, or it could be one possible solution?




I was wanted to do the same thing a while back. Unfortunately, the answer
> was pretty much that it can t be done in QC. It could potentially be
> achieved with a 3rd-party plugin  like Kineme 3D, but the Kineme developers
> seemed to think the way QC is setup internally makes it very difficult to
> pass arbitrary vertex attributes to GLSL shaders.
>  Sorry to be the bearer of bad news...
>
> a|x



> >Hi,
> >I'm trying to implement cone-step mapping shader in QC, and I got this
> >problem: the GLSL vertex shader needs to know the tangent of each vertex.
> As
> >far as I know, GLSL lets to access to the per-vertex normal value using
> the
> >built-in attribute gl_Normal, but the tangent of each vertex needs to be
> >passed from the OpenGL application (calculated when the mesh is loaded for
> >example), or stored in the mesh file.
> >So, i guess the right way to do that is to use per-vertex attribute like
> >this in vertex shader:
> >
> >[...]
> >attribute vec3 tangent;    //The tangent of the current vertex
> >[...]
> >
> >...but how can this attribute be passed to the GLSL shader for each
> vertex?
> >I also need per-vertex binormal value, but I guess it would be ok to
> >calculculate its value once I got per-vertex normal and tangent values in
> >this way:
> >
> >binormal = normalize(cross(normal, tangent));
> >
> >Thank you for any kind of help!
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to