Mesh its not being lightened

Started by
6 comments, last by dark_vision 20 years, 3 months ago
Hello there. I''ve just finished the part of my engine that supports skeletal animation and all that stuff, and started an extensive test, it works great with a custom model I have, the tiny.x file of the SDK, but the Spawn model of Jim Adams RPG books doesn''t lights up, its allways black, no matter how many lights it have in front of its face. I''ve played with the material and light values trying to figure out what''s going on, discovering that it works with ambient light (either from the light source or the one specified in the render state), but then I don''t have shading. When the mesh is loaded, the material ambient value is taken from de diffuse color, so they''re the same (I even hard-coded it), and still it only responds to ambient light. I''ve seen others with a similar problem searching here, but found not satisfactory answer. I even tryed the ''calculate normal'' (something like that) render state, with no succses (well, it doesn''t get scaled, but just to be sure). Could it be the file? Thanks in advance. James.
Advertisement
Are you sure the normals are correct? if the normals (for some weird reason) are inverted it would only light up if ambiency was on (i think)

There could be numerous possibilities for why this happened; if possible i recommend finding another test x file to see if it lights up as well.
Bow before me... for i am l33t!
Thanks for your reply Pirosan. I don''t really know how the normals are declared in the file, but I also used D3DXComputeNormals when loading the Mesh, and same results. In fact it happends with all Jim Adams models, and I can''t even see if he does something special with them since when their demos have them, he uses ambient light.
Since you have the DX9 SDK (I''m assuming) I''d recommend opening up the Mesh Viewer program, then the models you want, and perform the following operations:

MeshOps->Weld vertices. Select weld all vertices, and hit okay.
Meshops->Compute normals
Save the finished result.

If you do that, the mesh should work fine (the weld vertices was just to speed it up, since some converters have extraneous vertices)
it may have been that he did not include the information for his objects normals (dont know why)

I ran into problems with normals when using the conv3ds on my 3ds files. I couldnt get any of my objects lit because the x file didnt include them.

EDIT: if you want to create your own models to see if they work, www.milkshape3d.com has an excellent 3d modelling program that is easy to use and exports in .x files easily and quickly. Its only 20 bucks if you want to buy the full version, and the 30 day trial version allows you to use all the program's functions so that you can see if you like it or not. I have used Ms3d ever since i got the trial version, and it is definitly worth the money!

[edited by - Pirosan on January 6, 2004 9:29:09 PM]
Bow before me... for i am l33t!
Well Cypher, I have de 8 one but is the same for this (it appears). I opened the file in the mesh viewer, but just saving it (with or without changes) gives me problems, since when I load it, it creates the enumeration object but cant get Data objects, so I can read nothing from it.

I''ll like to see the mesh viewer source code to know what''s happening, but it don''t come with the sdk, or I just didn''t saw it?

I tryed to open it whith the mesh tutorial thought, with no success (even being saved mesh viewer).

I am making a new model right now, with the current modeling protocol, to see if I have problems, but even if I don''t, is kind of dangerous to leave things unsolved, since it can attack you from behing when you have forgoten the issue.
I don''t know about the DX8 one, but the DX9 one doesn''t come with source code. However, it seems to use a lot of functions already defined in D3DX, so those problems are quite odd.
Well it must be the file, since I don''t have problems with anything else, I finished the other model and it works perfect.

Thanks for all the replies.

James.

This topic is closed to new replies.

Advertisement