Can't use TLeaderheadShader_20 - Why?

kipkuhmi

Warlord
Joined
Aug 8, 2007
Messages
131
Hi everybody,

I've restarted to work on a leaderhead.

In my infinite battle against the illumination problem that has been haunting me for a year I've come as far as to know that something is wrong with my TLeaderheadShader_20.

When in the material editor I set the Shader to "Custom Shader" I can import my textures into Civ. All works well, however it's practically a non-shader version, ie. I can't use any maps like bump, normal or spec maps.

When I put the Shader to "TLeaderheadShader_20" then I can use NRML, SPEC, ENV and ENV_MASK maps, however nothing of it shows in the game.
When my LH is the first one to appear then the whole body is totally black; when I see it after having seen others then there is light, but always different ones depending on the lights that the LH before used. The light sources that I use in the game don't seem to have any effect whatever I do.

Somehow the game doesn't load the lights. However strong the light source shines, whatever the color, it doesn't show in the game.

Does anyone have a solution? This is driving me absolutely crazy.
 
I think your problem are the lights, not the shader (because i know TLHShader20 is working, when using the original LH's lights.)

Have you tried to "transplant" lights from a original LH into your exported file ?

Also the basic shader settings (Diffuse, Ambient, Emitance Color) and Vertex Coloring (should be off) do affect how the LH will respond to lightning.
 
I too think that it's the lights causing the problem. I've tried both methods, using the nif-imported scene lights, and setting up new ones.

One thing I don't understand, for example, is why the lights are listed in a very different way in the exported nif file:

Example of a light in an original LH nif:
+ NiPointLight --> [Light icon]bak_diffuse
-- NiStringExtra Data --> GSC:f3LightPos1=position\r\nGSC...


and in my nif file (when I use the imported light settings):

NiAmbientLight --> [Light icon] [No entry following, no NiStringExtraData]

in my nif file (when I set up my own lighting):
NiPointLight --> [Light icon]bak_diffuse [No NiSringExtraData]

Maybe there's something I don't know yet ... do the light have to be of a special kind? (I take it they are standard omni lights)? Are there any important custom settings for the light that one has to observe? Does the mesh have to be escpecially included?
 
And sth else I'd wish to know: What material do you use? Is it "Civilization IV X Platform Material, and then CustomShader "TLeaderheadShader_20", or is it a "DirectX 9 Material"?
 
What puzzles me most, is there absolutely no one else who's having that problem ?!?
 
I use "TLeaderheadShader_Noskin_20" as a substitute. Its the same thing except it works. :p Don't mess around with lights or anything.

The other shader is for advanced LH's and I don't know what in their geometry data allows them to use it without a crash. I haven't read your whole case yet btw so pardon me, I'll read the whole thing later and add.
 
Hmmm, i do not export complete LH's - i only export the edited mesh and merge it on the animation of a original LH - meaning that i am using the original scene lights from a stock LH.

That what i meant btw - not Import and Reexport the lights, export your LH without lights and then try to Copy/Paste the lights from another LH's nif via NifScope into your exported file, without importing them in max first. I do suspect, that there are some specific settings with the lights, that are screwed by the import/export process.

And sth else I'd wish to know: What material do you use? Is it "Civilization IV X Platform Material, and then CustomShader "TLeaderheadShader_20", or is it a "DirectX 9 Material"?
Neither. I use "Standard" material and choose the "CivilizationIV Shader" from Shader Basic Parameters rollout. I know from the Firaxis example files, it's what they did with they units. We dont have a example on LH unfortunately.

Here is a material setup that is working for me - but again - as i said - i only export the mesh and use the original secene lighnting from another LH.
capture05082008213919rf1.jpg
 
Forgot something else...

I plan to write a tutorial on how to add shaders without 3DS, and also you can use George S. Patton or Zhukov as a base/example of my shader technique. I don't know if it applies here but thought I'd let you know. :p
 
Thanks for the answers, I appreciate that.

@Refar
Strange, that's what I use for my settings, too. Doesn't work with me, however. As soon as I hit the Apply button for TLeaderheadShader_20, my lights are gone.

@dutchking
I've already tried out TLeaderheadShader_NoSkin_20, didn't work either. What could be interesting, do you have a max file for Zhukov or Patton (I couldn't open Patton.zip, by the way)?

I still believe that the main problem remain with the lights. The light nodes in the exported nif file are totally different from an original one (as described above).

Then I wonder, what do the CivTools in the max menu do? There's a "Light lister" and a "Light Include/Exclude Tool" which Firaxis added, so it must be meant for something.
 
Well I don't use 3Ds. :p So the answer to that would be no. But I do recommend downloading patton again, as I recently reuploaded him (here, not at civunited) or Zhukov and comparing the following atributes of their geometry to yours:
Properties
Location in a NIF
Trishape/Strip data
Object data
and Properties' Properties
When I add shaders to a LH I usually try to mimic those characteristics from the LH I based it off best I can. If you made a LH from scratch try the same thing with a LH that has similar geometry, or try to do something in 3Ds.
 
When I want to examine my nif files in SceneViewer, I get the following error message:

"No CivilizationIV shader libraries found to load."

I strongly suspect that something is badly wrong with the TLeaderheadShader_20 ... I'm running 3dsmax 8 on Vista 64, so maybe that's a problem? I've heard there are problems with Pixelshader 1.1 / 2.0. Does anyone know anything about it?
 
This no "Civilization shader libraries found" thingie is a problem with nifscope installation path - i had it as well. I do not remember the exact solution, but it went away after thinkering with the settings in nifscope a bit. Maybe you will be able to google something up.

I run Max 8 on windows XP, so can't say a lot about vista.
 
In the 3dsmax8 folder

/plugins/CivilizationIV/Shaders

there's a file called ComputeCiv4Lighting.fx.

I wonder what it does and how one uses it ...

Plus in the same folder there's a batch file "CompileShaders". Do you have to compile all those MaxTools before using them?!?
 
For me the firaxis tools were working out of the box, without compiling anything.
 
So did mine ... apart from the non-working Leaderheadshader / light settings.
However, that CompileShaders.bat must be there for some reason. Maybe it really serves for re-compiling the files when you have a different platform.
 
It might be just there, because who ever packaged the files, forgot to remove it - :smoke: happens everywhere. Adapting to a different platform is only rarely as simple as recompiling - i.e. when it comes to graphics lots of things are very platform specific.

Then again - maybe it will work...
 
Hey, did you ever sort out the lighting problem? I have the same problem (I think) ... you know, the one where your custom leaderhead looks different viewing it after selecting other leaderheads previously. It's driving me crazy. :crazyeye:

I'm using Bismark's default lights and shaders, imported in Nifskope.

- First screenshot is viewing the leaderhead without selecting another leaderhead beforehand.

- Second screenshot is viewing the leaderhead after just looking at Catherine.
 
I didn't quite understand: Do you construct your file first in max and then export it into nif? - That's the working line I used, and where the problem manifested itself.

To my understanding, the problem can't be solved - it's a bug, plain and simple. The Firaxis Plugin just doesn't export the lights correctly. Wether your file suffers from that problem or not, can easily be verified when you click LHs with extreme light settings (eg Sitting Bull, Justinian) or with a lot of gold or other reflecting stuff (eg Huayna Capac).

Technically, the reason seems to be clear: The Civ 3D engine doesn't recognize the lights as such because they haven't been exported correctly from .max to .nif. I guess when you click from one scene to another the old light settings are overwritten in the RAM by the new light settings. As your nif file doesn't have any light settings, there's nothing which could overwrite the old light, and so those remain in the RAM. That's pretty much how I figuered it out for myself.

Fortunately, it doesn't have to bother you. There's a workaround which is so simple that I asked myself how I could ever waste so much time on that problem. :)

I don't know if there's an English translation to the German way of saying: Make need a virtue.

The basic thought is to define the light sources not in the max file but in the nif file (ie after export)

1. In your max file, delete all the light sources. They don't work anyway.
2. Now you can use the light bug to view different light settings for your scene. If you want to do that, open the Civilopedia and check out what light setting gives the best effect to your LH.
3. If for example you would like to have Bismarck's light in your custom nif file, just run NifSkope and open Bismarck in one tab and your file in the other. You can easily copy the branches defining the lights from Bismarck to your LH. Save it, and that's it.

This should help you. At least it worked perfectly for me. Of course, it's a bit annoying that you have to copy the lights into your LH file by hand each time you change the max file. However, you quickly get used to it, and it's more than rewarding that the lights are finally stable.

Good luck!
 
Back
Top Bottom