Jump to content

  • Log In with Google      Sign In   
  • Create Account

"My first shader", lighting and matrices ok?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 19 November 2012 - 03:28 PM

Hi,
Since a few months I tried to adapt my 3d engine into using shaders. As a first step I tried to to the following with a vertex shader:
- vertex translation
- 'simple' texturing
- 1 directional light
The issues I'm facing:
--> lighting direction is in model space instead of worldspace (rotated objects mean lighting rotates with them)
--> normals look messed up (could also be a modelling issue, 3ds max)
My question:
What are your ideas/ what am I doing wrong?
I wrote a short summary of pseudo code of what I'm doing, I'm also curious if I'm not messing up traditional matrix actions instead of through the shader. Rotations are not yet done in the shader for sure.
Any help is appreciated.
The pseudo code:
============
Inital, one time
============
1. d3d.InitWindowClass

2. d3d.InitD3dDevice

3. dinput.Init

4. scene.load

** meshes with worldpos X, Y, Z and ROT X, Y, Z, and scale
** ambient scene light
** full into mObjects
** save texture folder
** save FX filenames
** camera startpos X, Y, Z

5. d3dscene.load

** loadmeshes
** new CD3dmesh array
** count materials ALL
** mD3dmeshes => fill with nrMaterials, rot, scale and worldpos values
** mD3dmeshes => load all X files (With texture folder)
** loadXfile
** set tempmaterialbuffer
** make materials unique, using texfile name
** fill mMatIdTable with: material ID, attr numbers (for each CD3dmesh)
** loadmaterials
** from tempmaterials, using mMatId array
** MatD3d copy
** material ambient = material diffuse
** copy materials values AMBIENT and DIFFUSE to mShaderMaterials.Ambient and Diffuse
** GetAttrAndbuffer
** adjacency = 3*getnumfaces
** generate adjacency
** D3DXcomputenormals
** optimize in place (mMesh), attrsort etc.
(normals compute after this, messes up lighting!)
** mMesh getattributetable
** save attribute table to mAttrTable (each mesh)
** get vertexbuffer and facebuffer!!! (mVtxBuffer / mFaceBuffer)
** GetNumBytesPerVertex (mVtxSize)*
** calc radius and worldpos
** create array mAttrWorldPos for each subobject WORLD position
** create arrays for boundingradius floats and boundingboxes per subobject
** TVERTEX *verticesPointer
** TVERTEX *verticesArray (mMesh->GetNumVertices)
** vtxbuffer lock
** memcpy vertices, numvertices * get vertex decl size
** SCALE; alle vertices * scale*
** compute boundingsphere radius for FULL MESH
** compute boundingsphere radius for all SUB OBJECTS
** calculate boundingbox for all SUB OBJECTS
** delete verticesArray
???? delete[] vertices; rotation saved???
** add FULL MESH word POS to SUB OBJECTS world pos (incl. boundingbox array)
** update world matrix
** D3DXMatrixTranslation(mMatTranslate, mWorldPos XYZ)
** D3DXMatrixRotationX(mMatRotateX, mRot.x)
** D3DXMatrixRotationy(mMatRotateX, mRot.y)
** D3DXMatrixRotationz(mMatRotateX, mRot.z)
** D3DXMatrixScaling(mMatScale, mScale)
** mMatWorld = matrot X* matrot Y * matrot Z * matscale * mattranslate)

** create bounding mesh
** adjacency = 3* mesh getnumfaces
** mMesh - generateAdjacency
** D3DX simplifymesh
** generate adjacency (mBoundingMesh)
** optimizeinplace (mBoundingMesh)
** get AttributeTable
** get vertexbuffer
** get indexbuffer
(REMARK: not rotated/ scaled/ transformed???)
** loadmaterials
** fill mMaterials.MatD3D
** mMaterials ambient = diffuse
** create index table; for each mesh and subobject corresponding material ID
** copy ambient & diffuse to mShaderMaterials for all materials
** loadtextures
** into mTextures (with same ID's as materials)
** mCamStartPos = start pos X, Y, Z (from scene file)
** mCamStartRot = start rot X, Y, Z (from scene file)
??? VIEWMATRIX TO BE UPDATED?

6. Direct3D (prepare scene)
** camera initialize
** position = startpos from scene file
** mRoll = rot x from scene file
** mYaw = rot y from scene file
** mPitch = rot.z from scene file
** create shaders
** create vertexdeclaration
** set vertexdeclaration
** load EFFECT/FX files
** D3DXCreateEffectFromFile for all effects
** init shaders
** cam => calculate projection matrix
** set "Proj" var in shader with projection matrix (all FX/effects)
** set "Ambient" var in shader with ambient light values (all FX/effects)

======================
FOR EACH FRAME, RENDER
======================
1. camera->update (From dinput mouse/keyboard, pos/rot)
** calculate viewmatrix
** calculate frustum
2. d3d device, clear D3DTARGET, ZBUFFER, ...
3. BeginScene
4. for all EFFECTS (fx files) (loop)
** setvertexshader "Basicshader"
** SetTechnique "BasicShader" (shader program)
** setmatrix "View" with camera=>viewmatrix
** mEffect->Begin (effectnumpasses)
** for all meshes (loop)
** if mesh has corresponding effect/fx index
** if mesh boundingsphere in frustum
** mesh=>update worldmatrix
** mesh=>preselect
** mEffect -> set world matrix with mesh world matrix
** d3d device => SetStreamSource, mesh vtx buffer
** d3d device => setIndex, mesh facebuffer
** loop through all materials
** preselect material
** mEffect -> set float arrays for Material ambient & diffuse
** mEffect -> set texture with material texture
** loop through all subobjects (mAttr, attributes)
** if suboject material index == material in loop
** check if subject boundingradius is frustum
** go through all 'numpasses'
** mEffect->beginpass( )
** render subobject (DrawIndexedPrimitive)
** mEffect->endpass ()
** mEffect->End()
4. endscene
5. d3d device->present

====================
THE SHADER (FX FILE)
====================

[source lang="cpp"]/****************************************************//** VARS NOT CONTROLLED BY CREALYSM ENGINE YET **//****************************************************/// directional lightingfloat3 DirLightDir < string UIDirectional = "Light Direction"; > = {0.0, 0.0, 1.0};float4 DirLightDiffuse = { 1.0f, 1.0f, 1.0f, 0.5f }; // light diffuse// modelfile, just for effecteditstring XFile = "objects\\boxwld.x"; // model/****************************************************//** VARS CONTROLLED BY CREALYSM ENGINE **//****************************************************/struct VS_OUTPUT{ float4 Pos : POSITION; float4 Diff : COLOR0; float2 Tex : TEXCOORD0;};float4x4 World : WORLD;float4x4 View : VIEW;float4x4 Proj : PROJECTION;float4 AmbientLight; float4 MatAmb : MATERIALAMBIENT;float4 MatDiff: MATERIALDIFFUSE;texture Tex0 < string name = "textures\\wdplanks.png"; >;/****************************************************//** THE ACTUAL VERTEXSHADER PROGRAM **//****************************************************/VS_OUTPUT VS( float4 Pos : POSITION, float4 Diff: COLOR0, float3 Norm: NORMAL, float2 Tex : TEXCOORD0){ VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldView = mul(World, View); float4x4 WorldViewProj = mul(WorldView, Proj); // output final pos = pos * WorldViewProj Out.Pos = mul(Pos, WorldViewProj); Out.Tex = Tex; Out.Diff = AmbientLight * MatAmb + DirLightDiffuse * MatDiff * max(0, dot(Norm, -DirLightDir)); // diffuse + ambient return Out;}/****************************************************//** SAMPLER STATES FOR TEXTURING **//****************************************************/sampler Sampler = sampler_state{ Texture = (Tex0); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; };/****************************************************//** BASIC VERTEXSHADER TECHNIQUE **//****************************************************/technique BasicShader{ pass P0 { zEnable = TRUE; CullMode = CCW; Lighting = TRUE; SpecularEnable = FALSE; Sampler[0] = (Sampler); VertexShader = compile vs_2_0 VS(); PixelShader = NULL; } }[/source]

Sponsor:

#2 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 20 November 2012 - 10:07 AM

If your directional light is a world space direction and your model is in world space, then you need to make sure you move your model's normals into world space as well. I didn't see that happening in the shader.
Perception is when one imagination clashes with another

#3 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 20 November 2012 - 01:53 PM

Hi,
Thanks, I understand what you mean, I don't pass the normals through to the shader at the moment.
The strange thing is that enabling/disabling: if(D3D_OK != D3DXComputeNormals(mMesh, adjacency)) return false;
does affect the lighting in the scene (normals affected).
This makes me think that from somewhere there are normals that are used.

What I checked is:
- own TVERTEX structure and vertex declarations both include normal positions (D3DXVECTOR3 / D3DDECLTYPE_FLOAT3, D3DDECLUSAGE_NORMAL)

What I will try is changing the FX file (shader), because now it has:

[source lang="cpp"]struct VS_OUTPUT{ float4 Pos : POSITION; float4 Diff : COLOR0; float2 Tex : TEXCOORD0;};VS_OUTPUT VS( float4 Pos : POSITION, float4 Diff: COLOR0, float3 Norm: NORMAL, float2 Tex : TEXCOORD0){ VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldView = mul(World, View); float4x4 WorldViewProj = mul(WorldView, Proj); // output final pos = pos * WorldViewProj Out.Pos = mul(Pos, WorldViewProj); Out.Tex = Tex; Out.Diff = AmbientLight * MatAmb + DirLightDiffuse * MatDiff * max(0, dot(Norm, -DirLightDir)); // diffuse + ambient return Out;}[/source]
which looks a bit strange, because the normals are not declared in the output definition (in the beginning of the FX file).
I hope changing the FX file/ shader will solve it.

If I'm overseeing something, all help is appreciated. I'll let you know the result after doing some changes.
Thanks again.

#4 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 20 November 2012 - 02:06 PM

I tried to change the FX file/ shader, but it gives an error when compiling:
"invalid output symantic 'NORMAL0'

here it is:
[source lang="cpp"] /****************************************************//** VARS NOT CONTROLLED BY CREALYSM ENGINE YET **//****************************************************/// directional lightingfloat3 DirLightDir < string UIDirectional = "Light Direction"; > = {0.0, 0.0, 1.0};float4 DirLightDiffuse = { 1.0f, 1.0f, 1.0f, 0.5f }; // light diffuse// modelfile, just for effecteditstring XFile = "objects\\house.x"; // model/****************************************************//** VARS CONTROLLED BY CREALYSM ENGINE **//****************************************************/struct VS_IN{ float3 pos : POSITION; float3 norm : NORMAL; float2 tex : TEXTCOORD0;};struct VS_OUTPUT{ float4 Pos : POSITION; float4 Diff : COLOR0; float3 Norm : NORMAL0; float2 Tex : TEXCOORD0;};float4x4 World : WORLD;float4x4 View : VIEW;float4x4 Proj : PROJECTION;float4 AmbientLight; float4 MatAmb : MATERIALAMBIENT; float4 MatDiff: MATERIALDIFFUSE; texture Tex0 < string name = "textures\\wdplanks.png"; >;/****************************************************//** THE ACTUAL VERTEXSHADER PROGRAM **//****************************************************/VS_OUTPUT VS( float4 Pos : POSITION, float4 Diff: COLOR0, float3 Norm: NORMAL0, float2 Tex : TEXCOORD0){ VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldView = mul(World, View); float4x4 WorldViewProj = mul(WorldView, Proj); // output final pos = pos * WorldViewProj Out.Pos = mul(Pos, WorldViewProj); Out.Tex = Tex; Out.Diff = AmbientLight * MatAmb + DirLightDiffuse * MatDiff * max(0, dot(Norm, -DirLightDir)); // diffuse + ambient return Out;}/****************************************************//** SAMPLER STATES FOR TEXTURING **//****************************************************/sampler Sampler = sampler_state{ Texture = (Tex0); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; };/****************************************************//** BASIC VERTEXSHADER TECHNIQUE **//****************************************************/technique BasicShader{ pass P0 { zEnable = TRUE; CullMode = CCW; Lighting = TRUE; SpecularEnable = FALSE; Sampler[0] = (Sampler); VertexShader = compile vs_2_0 VS(); PixelShader = NULL; } }[/source]
I'll get more insight on the shader and FX file principles, to see what I'm overseeing (just a beginner when it comes to shaders).
I think/ know for sure that my 'code' (structures, declarations etc.) is alright.

If you read it before I got it solved.... :)

#5 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 20 November 2012 - 03:21 PM

Right, if I remember NORMAL isn't a valid pixel shader semantic, but you can pass it out as a TEXCOORD if you'd like. Though it looks like you're doing your lighting in the vertex shader so that shouldn't matter.

So maybe your misunderstanding this line:
VS_OUTPUT VS(
  float4 Pos : POSITION,
  float4 Diff: COLOR0,
  float3 Norm: NORMAL0,
  float2 Tex : TEXCOORD0)

This line is saying that this function is the entry point for your vertex shader, and whatever vertex that is currently being processed will pass in their valid for POSITION, COLOR0, NORMAL0, and TEXCOORD0, and your shader will return a structure called VS_OUTPUT, which is what you defined. So your shader is expecting a normal, and will take whatever value your vertex buffer has at that position in your vertex, which you specified in your vertex declaration.

Also, as a quick hint and a great performance gain, calculate your ViewProjection at least, if not your entire WorldViewProjection in the application and pass it to the shader as a uniform. That avoid the matrix concatenation from being performed several thousands of times a frame.
Perception is when one imagination clashes with another

#6 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 20 November 2012 - 03:58 PM

Thanks, I changed the ViewProjection part to gain the performance increase. Result:
=> pCam update, one time per frame, calculating viewmatrix, multiply by projectionmatrix and set it only once for each effect with SetMatrix("ViewProj")

In the shader it now looks like this:

[source lang="cpp"]float4x4 World : WORLD;float4x4 ViewProj : VIEWPROJECTION;VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldViewProj = mul(World, ViewProj);[/source]

Working fine.

For the normals, I might have found it. This is my vertex declaration:

[source lang="cpp"]const D3DVERTEXELEMENT9 dec[5] ={ {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, {0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, D3DDECL_END()};[/source]
The names "POSITION", "NORMAL", "TEXCOORD" should probably match with the same 'vars' in the FX file.
I'll try that to see if it helps.

Thanks again for the hints.

#7 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 20 November 2012 - 05:10 PM

Been struggling and looking and found the following:

- in my UpdateWorldMatrix (for each mesh) function I perform:
D3DXMatrixTranslation
D3DXMatrixRotation
D3DXMatricScale

and multiply them all into the new WorldMatrix for the mesh/ model

After this I don't recalculate the normals, which might be the problem.
I tried to add the following of my initial code into the UpdateWorldMatrix function, just to test:

DWORD *adjacency = new DWORD[3*mMesh->GetNumFaces()];
mMesh->GenerateAdjacency(0.1f, adjacency);
D3DXComputeNormals(mMesh, adjacency);
delete[] adjacency;

But unfortunately no result. When I comment the D3DXMatrixRotations and leave them out, the lighting is all perfect (objects not rotated).

I'll try to find more information on how to recalculate the normals after D3DXMatrix rotations.

#8 Seabolt   Members   -  Reputation: 633

Like
0Likes
Like

Posted 21 November 2012 - 11:02 AM

Did you try multiplying your normals in the vertex shader by the world matrix?
Perception is when one imagination clashes with another

#9 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 21 November 2012 - 12:24 PM

Hi, that sounds logical. Just tried it out.
Unfortunately I can't get ik compiled (probably need to learn more on shaders/ HLSL first), I get:
'invalid output semantic 'NORMAL0' (on line 20, in the VS_OUTPUT struct Float3 Norm : NORMAL;)

Here it is:
[source lang="cpp"]/****************************************************//** VARS NOT CONTROLLED BY CREALYSM ENGINE YET **//****************************************************/// directional lightingfloat3 DirLightDir < string UIDirectional = "Light Direction"; > = {0.0, 0.0, 1.0};float4 DirLightDiffuse = { 1.0f, 1.0f, 1.0f, 0.5f }; // light diffuse// modelfile, just for effecteditstring XFile = "objects\\house.x"; // model/****************************************************//** VARS CONTROLLED BY CREALYSM ENGINE **//****************************************************/struct VS_OUTPUT{ float4 Pos : POSITION; float4 Diff : COLOR0; float3 Norm : NORMAL; float2 Tex : TEXCOORD0;};float4x4 World : WORLD;float4x4 ViewProj : VIEWPROJECTION;float4 AmbientLight; float4 MatAmb : MATERIALAMBIENT; float4 MatDiff: MATERIALDIFFUSE; texture Tex0 < string name = "textures\\wdplanks.png"; >;/****************************************************//** THE ACTUAL VERTEXSHADER PROGRAM **//****************************************************/VS_OUTPUT VS( float4 Pos : POSITION, float4 Diff: COLOR0, float3 Norm: NORMAL, float2 Tex : TEXCOORD0){ VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldViewProj = mul(World, ViewProj); // output final pos = pos * WorldViewProj Out.Pos = mul(Pos, WorldViewProj); Out.Diff = AmbientLight * MatAmb + DirLightDiffuse * MatDiff * max(0, dot(Norm, -DirLightDir)); // diffuse + ambient Out.Norm = mul(Norm, World); Out.Tex = Tex; return Out;}/****************************************************//** SAMPLER STATES FOR TEXTURING **//****************************************************/sampler Sampler = sampler_state{ Texture = (Tex0); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; };/****************************************************//** BASIC VERTEXSHADER TECHNIQUE **//****************************************************/technique BasicVertexShader{ pass P0 { zEnable = TRUE; CullMode = CCW; Lighting = TRUE; SpecularEnable = FALSE; Sampler[0] = (Sampler); VertexShader = compile vs_2_0 VS(); PixelShader = NULL; } }[/source]

#10 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 21 November 2012 - 12:29 PM

YES, got it compiled finally. Found out that you can't send a normal into a PIXELSHADER and therefor not in the 'highover' VS_OUTPUT structure.
Not giving the right lighting yet, but getting there I hope Posted Image

Here's the valid shader/FX file.

[source lang="cpp"]/****************************************************//** VARS NOT CONTROLLED BY CREALYSM ENGINE YET **//****************************************************/// directional lightingfloat3 DirLightDir < string UIDirectional = "Light Direction"; > = {0.0, 0.0, 1.0};float4 DirLightDiffuse = { 1.0f, 1.0f, 1.0f, 0.5f }; // light diffuse// modelfile, just for effecteditstring XFile = "objects\\house.x"; // model/****************************************************//** VARS CONTROLLED BY CREALYSM ENGINE **//****************************************************/struct VS_OUTPUT{ float4 Pos : POSITION; float4 Diff : COLOR0; float3 Norm : TEXCOORD1; float2 Tex : TEXCOORD0;};float4x4 World : WORLD;float4x4 ViewProj : VIEWPROJECTION;float4 AmbientLight; float4 MatAmb : MATERIALAMBIENT; float4 MatDiff: MATERIALDIFFUSE; texture Tex0 < string name = "textures\\wdplanks.png"; >;/****************************************************//** THE ACTUAL VERTEXSHADER PROGRAM **//****************************************************/VS_OUTPUT VS( float4 Pos : POSITION, float4 Diff: COLOR0, float3 Norm: NORMAL, float2 Tex : TEXCOORD0){ VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldViewProj = mul(World, ViewProj); // output final pos = pos * WorldViewProj Out.Pos = mul(Pos, WorldViewProj); Out.Diff = AmbientLight * MatAmb + DirLightDiffuse * MatDiff * max(0, dot(Norm, -DirLightDir)); // diffuse + ambient Out.Norm = mul(Norm, World); Out.Tex = Tex; return Out;}/****************************************************//** SAMPLER STATES FOR TEXTURING **//****************************************************/sampler Sampler = sampler_state{ Texture = (Tex0); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; };/****************************************************//** BASIC VERTEXSHADER TECHNIQUE **//****************************************************/technique BasicVertexShader{ pass P0 { zEnable = TRUE; CullMode = CCW; Lighting = TRUE; SpecularEnable = FALSE; Sampler[0] = (Sampler); VertexShader = compile vs_2_0 VS(); PixelShader = NULL; } }[/source]

#11 cozzie   Members   -  Reputation: 1771

Like
0Likes
Like

Posted 21 November 2012 - 01:34 PM

GOT IT! Many thanks, you've send me in the right direction.
The solution was doing the Normal with WorldMatrix multiplication in the Diffuse calculation.

Here it is:

[source lang="cpp"]/****************************************************//** VARS NOT CONTROLLED BY CREALYSM ENGINE YET **//****************************************************/// directional lightingfloat3 DirLightDir < string UIDirectional = "Light Direction"; > = {0.0, 0.0, 1.0};float4 DirLightDiffuse = { 1.0f, 1.0f, 1.0f, 0.5f }; // light diffuse// modelfile, just for effecteditstring XFile = "objects\\house.x"; // model/****************************************************//** VARS CONTROLLED BY CREALYSM ENGINE **//****************************************************/struct VS_OUTPUT{ float4 Pos : POSITION; float4 Diff : COLOR0;// float3 Norm : TEXCOORD1; float2 Tex : TEXCOORD0;};float4x4 World : WORLD;float4x4 ViewProj : VIEWPROJECTION;float4 AmbientLight; float4 MatAmb : MATERIALAMBIENT; float4 MatDiff: MATERIALDIFFUSE; texture Tex0 < string name = "textures\\wdplanks.png"; >;/****************************************************//** THE ACTUAL VERTEXSHADER PROGRAM **//****************************************************/VS_OUTPUT VS( float4 Pos : POSITION, float4 Diff: COLOR0, float3 Norm: NORMAL, float2 Tex : TEXCOORD0){ VS_OUTPUT Out = (VS_OUTPUT)0; // calculate the WorldViewProj matrix float4x4 WorldViewProj = mul(World, ViewProj); // output final pos = pos * WorldViewProj Out.Pos = mul(Pos, WorldViewProj); Out.Diff = AmbientLight * MatAmb + DirLightDiffuse * MatDiff * max(0, dot(mul(Norm, World), -DirLightDir)); // diffuse + ambient// Out.Norm = mul(Norm, WorldViewProj); Out.Tex = Tex; return Out;}/****************************************************//** SAMPLER STATES FOR TEXTURING **//****************************************************/sampler Sampler = sampler_state{ Texture = (Tex0); MinFilter = LINEAR; MagFilter = LINEAR; MipFilter = LINEAR; };/****************************************************//** BASIC VERTEXSHADER TECHNIQUE **//****************************************************/technique BasicVertexShader{ pass P0 { zEnable = TRUE; CullMode = CCW; Lighting = TRUE; SpecularEnable = FALSE; Sampler[0] = (Sampler); VertexShader = compile vs_2_0 VS(); PixelShader = NULL; } }[/source]


(not 100% right yet, it's now giving the ambient lighting value as diffuse but with all normals correct, so tweaking it now it will be easy).
Thanks again.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS