Jump to content
Sign in to follow this  
Steiner

Texturing issues

Recommended Posts

Hi guys, wonder if anyone knows how come a KW Slingshot unit that I am trying to import into Tiberium Wars will not load its texture no matter how I try?

 

There is no issue at all in the buildmod.bat, it reports all goes normal and there are no missing texture files or wrong references whatsoever. Nevertheless in the game it looks like this:

 

I have tried everything now, but to no avail. Help will be much appreciated.

 

See below:

 

post-9896-0-77025500-1409453803_thumb.jpg

Edited by Steiner

Share this post


Link to post

That's not a texture problem. It's because KW's shaders are different to the TW ones regarding housecolor and so the textures are. Easiest way to fix that is to put the KW GDI shader into your mod (rename plz) and change the shader name the W3DMeshes of the Slingshot to the new name.

 

 

Well, how to extract KW's shader?

Share this post


Link to post

There isnt anything usefull to do with extracting shaders. They come compiled with the game. TW had special uncompiled shaders released with the sdk for use with 3dmax9. Max can't read the compiled ones as far as i remember.

 

The easiest thing to do might be to open your unit's w3x file (preferably with a xml editor or a better notepad editor) and change the shader in there.

 

Example:

 

look for the section of the xml code that looks something like this:

 

 

<FXShader ShaderName="ObjectsGDI.fx" TechniqueIndex="0">
            <Constants>
                <Texture Name="DiffuseTexture">
                    <Value>My_Units_Difuse_texture</Value>
                </Texture>
                <Texture Name="NormalMap">
                    <Value>My_Units_Normal_texture</Value>
                </Texture>
                <Texture Name="SpecMap">
                    <Value>My_Units_Specular_texture</Value>
                </Texture>
                <Texture Name="RecolorTexture">
                    <Value>My_Units_HouseColor_texture</Value>
                </Texture>
                
            </Constants>
        </FXShader>
 

If you imported your original unit w3x from TT or RA or such it will have a shader native to those games in there. Changed that shader name to ObjectsGDI.fx for example.

 

RA3 and TT use the blue channel in images to mark the house color parts iirc. Alot of the TW textures use a alpha channel/mask in a seperate texture for house color.

If you want to convert the TT textures to something useable by TW or KW, you might have to edit the original units textures so you have a difuse, normal and specular texture map AND extract/copy the blue channel from the specular map into a new house color texture but dont use the rgb channels but create a new layer mask that hides everything but the visible house color section and save that as a dds or such with a alpha channel.

 

also at the top of the w3x file don't forget to add the texture references, something like:

 

 

<Includes>
        <Include type="all" source="ART:My_Units_Difuse_texture.xml"/>
        <Include type="all" source="ART:My_Units_Normal_texture.xml"/>
        <Include type="all" source="ART:My_Units_Specular_texture.xml"/>
        <Include type="all" source="ART:My_Units_Housecolor_texture.xml"/>
</Includes>
 

have a look at the TW documentation on how textures are used in the art pipeline

Share this post


Link to post

 

There isnt anything usefull to do with extracting shaders. They come compiled with the game. TW had special uncompiled shaders released with the sdk for use with 3dmax9. Max can't read the compiled ones as far as i remember.

 

The easiest thing to do might be to open your unit's w3x file (preferably with a xml editor or a better notepad editor) and change the shader in there.

 

Example:

 

look for the section of the xml code that looks something like this:

 

 

<FXShader ShaderName="ObjectsGDI.fx" TechniqueIndex="0">
            <Constants>
                <Texture Name="DiffuseTexture">
                    <Value>My_Units_Difuse_texture</Value>
                </Texture>
                <Texture Name="NormalMap">
                    <Value>My_Units_Normal_texture</Value>
                </Texture>
                <Texture Name="SpecMap">
                    <Value>My_Units_Specular_texture</Value>
                </Texture>
                <Texture Name="RecolorTexture">
                    <Value>My_Units_HouseColor_texture</Value>
                </Texture>
                
            </Constants>
        </FXShader>
 
If you imported your original unit w3x from TT or RA or such it will have a shader native to those games in there. Changed that shader name to ObjectsGDI.fx for example.

 

RA3 and TT use the blue channel in images to mark the house color parts iirc. Alot of the TW textures use a alpha channel/mask in a seperate texture for house color.

If you want to convert the TT textures to something useable by TW or KW, you might have to edit the original units textures so you have a difuse, normal and specular texture map AND extract/copy the blue channel from the specular map into a new house color texture but dont use the rgb channels but create a new layer mask that hides everything but the visible house color section and save that as a dds or such with a alpha channel.

 

also at the top of the w3x file don't forget to add the texture references, something like:

 

<Includes>
        <Include type="all" source="ART:My_Units_Difuse_texture.xml"/>
        <Include type="all" source="ART:My_Units_Normal_texture.xml"/>
        <Include type="all" source="ART:My_Units_Specular_texture.xml"/>
        <Include type="all" source="ART:My_Units_Housecolor_texture.xml"/>
</Includes>
 
have a look at the TW documentation on how textures are used in the art pipeline

No wonder my self-made Wolverine model can't show HC in KW, and KW official Titan show HC the whole model, so I have to add new HC_texture for Titan. But if so, I should add blue HC channel on official wolverine SPM texture, right?

 

 

And would you teach me how to modify shader? No complex changing, just wanna NOD.fx looks a bit more blue.

 

There's the code from Objects.fxh, how to compile it?

 

#elif defined(MATERIAL_PARAMS_NOD)

// Fixed material parameters for NOD

static const float BumpScale = 1.5;

static const float3 AmbientColor = float3(0.3, 0.3, 0.3);

static const float4 DiffuseColor = float4(0.584, 0.624, 0.733, 1.0);//means R,G,B,A? Should I change the 0.733?

static const float3 SpecularColor = float3(1.0, 1.0, 1.0);

static const float SpecularExponent = 50.0;

Edited by Nmenth
merged double post

Share this post


Link to post

In the objectsgdi.fx shader...the blue channel is only use to accentuate the housecolor..make it glow abit. But defining the outline of the house color is done through a HC texture with a alpha channel.

To create a housecolor you need to know wich shader you are using first, after that you can think about how to add a housecolor.

 

Can't help you with writing shaders. Not my expertise.

Share this post


Link to post

Write them? Just use notepad if you don't have another program.

Compile them with fxc (a tool you get in the Direct X SDK).

 

And yes it's RGBA.

Edited by Lauren

Share this post


Link to post

Write them? Just use notepad if you don't have another program.

Compile them with fxc (a tool you get in the Direct X SDK).

 

And yes it's RGBA.

I looked into that a bit when i was fumbling about with idea of switching to modding RA3. Specialy because i dislike color pallete they choose for RA3.

But i put that idea way down on my to learn list.

What i would be interested to know if its possible to read the content of the shaders that came with the sdk's of both TW and RA3? Notepad++ or other editors basicly show alot of gibberish when you try to open those shaders.

Would be nice to see how EALA build there shaders up and learn from there. The shader writing example that they gave with the sdk doesnt offer much perspective on how o start if you are totoaly new to coding shaders imo.

Share this post


Link to post

Thanks.

Will make things easier to learn if/when i ever touch shading possibilities for TW.

Share this post


Link to post

The EA shaders are actually quite complicated as they use a lot of preprocessor switches. You can learn by looking at them, but reading through some hlsl tutorials probably helps more.

Share this post


Link to post

Write them? Just use notepad if you don't have another program.

Compile them with fxc (a tool you get in the Direct X SDK).

 

And yes it's RGBA.

 

The EA shaders are actually quite complicated as they use a lot of preprocessor switches. You can learn by looking at them, but reading through some hlsl tutorials probably helps more.

Thanx, and is there any way to get KW shader or uncompiled fx?

In fact, I wanna trying to add some RA3 fx into CC3, but as I once supposed it would report error when running the game if you add them directly without any modification for fitting the CC3.

Share this post


Link to post

"shader or uncompiled fx" No or needed, fx files are shaders.

Also you wont be able to integrate RA3 shader into CnC3 that easy.

Share this post


Link to post

"shader or uncompiled fx" No or needed, fx files are shaders.

Also you wont be able to integrate RA3 shader into CnC3 that easy.

And I tried to add my own infantry w3x into KW, which shown everything OK in TW, but shown nothing in KW. All texture files is KW's own original.

 

Is KW's infantry.fx different from TW, either?

Share this post


Link to post

Does your infantry show at all? can you select them, use them etc? If it is just a shader issue...it will usually show errors in the artwork but you should have a phsysical object on screen nonetheless.

Share this post


Link to post

Does your infantry show at all? can you select them, use them etc? If it is just a shader issue...it will usually show errors in the artwork but you should have a phsysical object on screen nonetheless.

Yes, you can't see but you can select and use, seems just w3x problem. But I don't know where's the mistake.

 

The vehicle w3x shows normal, and the w3x files' naming is correct I swear, so my filepath and filename seems no mistake. Why the infantry can't show? :ghost:

Edited by ztz2019

Share this post


Link to post

did you set the export options correctly? Maybe you set certain meshes to export as bones only and not geometry?

Share this post


Link to post

Don't really sure what they all said above but I extracted shadders before and it work like a charm

 

KW use different shader than TW, you need to extract them using biber extractor tool from KW's shadder.big files

 

Take the gdi's shader and remand it, make sure it in fxo format and not fx (if not rename it)

 

Put it in your misic/shader folder (iirc since I'm not on my desktop right now)

 

And in the slightshot's skn.w3x files change the shader name to the gdi shader you renamed with notepad and save

 

That should do the trick

Share this post


Link to post

As what Egozi44 said. ^^^

 

All KW units use their own KW shaders. I had to rename every shader of every KW unit that uses the KW shader. For example, the KW version of objectsGDI.fx was renamed to objectsGDI_KW.fx. That's how I did it in my mods. As for RA3 and C&C4, same idea.

Edited by zocom7

Share this post


Link to post

Thank You for Example.

 

I try it

 

ps: my shader are *.fxo???

my shader path ... "my mod"\shaders\compiled\objectgdi2_kw.fxo, so right ?

Edited by Hideyasu

Share this post


Link to post

From the documentation that comes with TW SDK:

 

To create a custom shader, have a look at the ShaderWritingExample.fx file in the 3dsmax shader directory of the MOD SDK. A custom shader needs to exist in multiple locations to work with the various programs involved:

  • 3DSMax first looks at the absolute path to a shader that might be stored in a .max file. After that it searches for shader files according to its External Files preference. It is suggested to have the maps/fx/cnc3 directory in this search path.
  • W3XView has a subdirectory called “Shaders”, where it searches for shaders. Put a copy of custom shaders in there
  • For the game, place any shaders you create in the MOD SDK\Shaders directory. The BuildMod.bat file will automatically copy this to the correct location to be built and compressed into the mod big file created by the build process.

Note: The shaders that shipped with CnC3 are already in big files. The MOD SDK provides versions of these that are compiled for 3DSMax in the maps/fx/cnc3 directory and versions compiled for W3XView in its directory. Do not copy the files from one into the other, or use these shaders in the game/your MOD’s big file, as they have slight differences (to enable UI and previewing) compared to the shaders the game uses.

 

for KW:

 

\Source\SampleMod\Misc\Shaders\Compiled

 

where samplemod is replaced with your modname folder

Edited by Ravendark

Share this post


Link to post

Hellow guys, sorry to bump that topic but I've a similar problem with this:

 

diapo3168ec8c3cb72ef227f54f4ced13d8c0.pn

 

This is the scrin relay node in the final GDI mission from TW that I actually added into KW as a support building.

 

I tried to change the shadders it uses by extracting the ones from TW but without success, any solution?

Edited by blood1995

Share this post


Link to post

There's a texture missing.

Share this post


Link to post

The last texture had a different name, that is why I didn't see it in Asset Extractor.

 

Thank you for the help!

Edited by blood1995

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×