help: howto setup vertex input arguments for .obj format

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

help: howto setup vertex input arguments for .obj format

Post by dlangdev »

what's the declaration for a vertex shader input arguments for an obj file containing the following lines:

Code: Select all

# Blender3D v245 OBJ File: character.02.blend
# www.blender3d.org
mtllib character.02.mtl
o mesh
v 0.032245 0.926210 -0.121173
v -0.031213 0.926210 -0.121218
...
vt 0.312140 0.459124 0.0
vt 0.306906 0.461958 0.0
vt 0.302775 0.458306 0.0
vt 0.309049 0.454698 0.0
...
vn 0.559832 0.238624 -0.793481
vn -0.273629 0.059816 -0.959960
vn -0.289468 0.119694 -0.949644
vn 0.527177 0.246406 -0.813227
...
usemtl Suit_minetex.tga
s 1
f 371/1/1 339/2/2 360/3/3 373/4/4
f 341/5/5 340/6/6 372/7/7 374/8/8
f 373/9/4 360/10/3 361/11/9 375/12/10
f 342/13/11 341/14/5 374/15/8 376/16/12
please look at the code below, and figure out what the type and semantic of the ones marked ????.

Code: Select all

//
// Vertex Shader Declaration
//
float4x4 matViewProjection;
float4x4 matView;

struct VS_INPUT 
{
   float4 Position : POSITION0;
   ????a Tangent: ????b ;
   float3 Normal :   NORMAL0;
   ????c   Face    : ????d
};
i need the tangent and normal to calculate the binormal, this will allow me to calculate other maps such as 3 normals (valve's radiosity) and other nifty stuff.

perhaps play around in texture (tangent) space a little more using this declaration.

eventually ending up being able to play around with this...

www.seas.upenn.edu/~cis665/Skin%20Rendering.ppt



thanks in advance.
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

ok, finally got it.

light position and intensity is still in-the-works, though. i'll fix that later.

Image

Code: Select all

struct VS_INPUT 
{
   float4 Position: POSITION0;
   float2 TexCoord: TEXCOORD0;
   float3 Normal:   NORMAL0;
   float3 Binormal: BINORMAL0;
   float3 Tangent:  TANGENT0;
   
};

struct VS_OUTPUT 
{
   float4 Position: POSITION0;
   float2 TexCoord: TEXCOORD0;
   float3 Normal:   TEXCOORD1;
   float3 Binormal: TEXCOORD2;
   float3 Tangent:  TEXCOORD3;
   
};
this is the normal map...calculated on-the-fly.

Image

and the binormal...same thing...on-the-fly.

Image

and here's the tangent map.

Image
Image
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

i'm having so much fun with this thing.

specular needs more work, diffuse can be enhanced to support ambient occlusion later... everything calculated in the gpu.

anyway, i need to get back on studying much newer stuff. this thing is becoming old faster than i thought.

Image
Image
Post Reply