• Advertisement


This topic is now archived and is closed to further replies.

Cel-Shading (Dx7 and VB)

This topic is 5027 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having some trouble getting cel-shading to work in my program. I've been following the tutorial here on GameDev (the one by MENTAL). I'm using my own file format for the models, so I've altered my code sample some for here. Here's the code:
' Begin Code

Type Normal
    NormalX As Single
    NormalY As Single
    NormalZ As Single
End Type

Dim Normals(100) As Normal
Dim Vertices(100) As D3DLVERTEX

Dim g_Dx As New DirectX7
Dim g_Light As D3DVECTOR, g_Normal As D3DVECTOR
Dim iTexCoord As Single

With g_Light
    .x = 10
    .y = 10
    .z = -10
End With
g_Dx.VectorNormalize g_Light

For i = 1 To NumVertices
    With Normals(i)
        g_Normal.x = .NormalX
        g_Normal.y = .NormalY
        g_Normal.z = .NormalZ
    End With

    iTexCoord = g_Dx.VectorDotProduct(g_Light, g_Normal)

    g_Dx.CreateD3DLVertex x, y, z, Color, 1, iTexCoord, iTexCoord, Vertices(i)
Next i

' End Code
I've tried normalizing g_Normal, but for some odd reason it winds up in an overflow error when I do CreateD3DLVertex. Any help would be greatly appreciated. [edited by - dxprog on May 17, 2004 6:16:16 PM]

Share this post

Link to post
Share on other sites
Okay, scratch that. I just need to know how to do 1D texture mapping.

Share this post

Link to post
Share on other sites

  • Advertisement