Transparent textures
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
Transparent textures
Hey guys,
I'm hoping one of you could help me out here.
I'm trying to figure out how make a texture semi-transparent.
For example, a certain part of the hull would be slightly see through.
I'm sure it's something regarding an alpha channel of a map but I can't find anything.
Thanks ahead.
I'm hoping one of you could help me out here.
I'm trying to figure out how make a texture semi-transparent.
For example, a certain part of the hull would be slightly see through.
I'm sure it's something regarding an alpha channel of a map but I can't find anything.
Thanks ahead.
- Killjaeden
- Posts: 5366
- Joined: Sun, 3. Sep 06, 18:19
Re: Transparent textures
Alpha channel is just another "channel" (next to red green blue). Black - invisible, White - visible, Gray - semi-transparent.
Do you know how to make an alpha channel? There should be tutorials for GIMP or Photoshop (or any other graphic tool that supports transparency). Once you have the texture with transparency, save it as PNG with alpha, or as TGA 32bit. Then you need to convert it to .DDS texture format. For semi-transparency you need the DXT5 .DDS format - because it allows 8bit alpha channel (black-grey-white values 0-255). DXT1 only allows 1 bit alpha channel (only black or white) channel. "DXT1 no alpha" has no alpha channel.
I can recommend the tool DXTbmp -its pretty old, but it does everything you need. I always used that back in the day. You can load the .dds from vanilla and check how they look/ what format they are, check out the alpha channel etc. You can save the desired DDS DXT formats. You can also load a non-alpha image and insert a greyscale image as alpha channel.
I dont remember if there was anything special/different required to display transparent textures ingame in the model's material definition. 10 years ago i could have told you exactly - but its simply too long ago If it doesnt work outright, check out the materials in the vanilla ship models - there are many transparent textures used in vanilla, look at how they do it/ copy from them.
You cant turn something "temporarily translucent" - this wont work. Unless you replace the ship/station via script completely with one that has another model with the transparent texture .
Edit: An example for an old X3:R shader (old X3R argon shader - you propably better want to use a modern material from X3TC/AP as template, i just dont have one right now to use.
if you want to turn the entire texture translucent then you could also try and play with the material definition alone, maybe it works just changing the highlighted value to <1.0.
also note the other alpha related parameters - idk anymore, but maybe you can provide a separate alpha map (instead of the"NULL", use a path) - and maybe also you have to enable alpha blending value (change 0 to 1).MATERIAL6: 40; 0x2000000; 1; argon.fx; 57; diffcompression;SPTYPE_BOOL;0; bumpcompression;SPTYPE_BOOL;0;
speccompression;SPTYPE_BOOL;0; lightcompression;SPTYPE_BOOL;0; nofiltering;SPTYPE_BOOL;0; autofree;SPTYPE_BOOL;0;
Tex2;SPTYPE_BOOL;0; TexAnimStartU;SPTYPE_FLOAT;0.000000;TexAnimStartV;SPTYPE_FLOAT;0.000000;TexAnimEndU;SPTYPE_FLOAT;0.000000;TexAnimEndV;SPTYPE_FLOAT;0.000000;TexAnimDuration;SPTYPE_FLOAT;9.000000;TexAnimRotation;SPTYPE_FLOAT;9.000000;TexAnimOriginU;SPTYPE_FLOAT;0.500000;TexAnimOriginV;SPTYPE_FLOAT;0.500000;
Brightness;SPTYPE_FLOAT;1.000000; contrast;SPTYPE_FLOAT;1.000000; saturation;SPTYPE_FLOAT;1.000000; hue;SPTYPE_FLOAT;0.000000; colormatrix;SPTYPE_BOOL;0; g_ColorWriteEnable;SPTYPE_LONG;15; g_Wrap;SPTYPE_LONG;0; g_CullMode;SPTYPE_LONG;2; g_AlphaBlendEnable;SPTYPE_LONG;0; g_BlendOp;SPTYPE_LONG;1; g_SrcBlend;SPTYPE_LONG;2; g_DestBlend;SPTYPE_LONG;1; g_ZEnable;SPTYPE_LONG;1; g_ZWriteEnable;SPTYPE_LONG;1; g_ALPHATESTENABLE;SPTYPE_LONG;0; g_LightAmbientIntensity;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; LightDir_Dir0;SPTYPE_LONG;0; LightDir_Color0;SPTYPE_FLOAT4;1.000000;1.000000;1.000000;0.000000; LightDir_Dir1;SPTYPE_LONG;0; LightDir_Color1;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; g_MatSpecularStrength;SPTYPE_FLOAT;1.000000; g_MatSpecularPower;SPTYPE_FLOAT;10.000000; g_MatReflectionStrength;SPTYPE_FLOAT;1.000000; g_MatReflectionBias;SPTYPE_FLOAT;1.000000; g_MatReflectionBlur;SPTYPE_FLOAT;0.000000;g_AlphaValue;SPTYPE_FLOAT;1.000000; g_MatEmissiveColor;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; t_FilterTypeDiffuse;SPTYPE_LONG;2; t_SamplerAddressMode;SPTYPE_LONG;1; t_SamplerMaxAnisotropy;SPTYPE_LONG;4; t_MipMapLODBias;SPTYPE_FLOAT;0.000000; t_DiffuseTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_diff.dds; t_MinFilterTypeDiffuse;SPTYPE_LONG;3; g_MatDiffuseStrength;SPTYPE_FLOAT;1.000000; t_AlphaTexture;SPTYPE_STRING;NULL; t_BumpTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_bump.dds; t_MinFilterTypeBump;SPTYPE_LONG;3; t_BumpMipMapLODBias;SPTYPE_FLOAT;0.000000; t_FilterTypeBump;SPTYPE_LONG;2; t_SpecularTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_spec.dds; t_LightMapTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_light.dds; t_CubeMapTexture;SPTYPE_STRING;DDS\envmap_test.dds;
MATERIAL6: 40; 0x2000000; 1; argon.fx; 57; diffcompression;SPTYPE_BOOL;0; bumpcompression;SPTYPE_BOOL;0;
speccompression;SPTYPE_BOOL;0; lightcompression;SPTYPE_BOOL;0; nofiltering;SPTYPE_BOOL;0; autofree;SPTYPE_BOOL;0;
Tex2;SPTYPE_BOOL;0; TexAnimStartU;SPTYPE_FLOAT;0.000000;TexAnimStartV;SPTYPE_FLOAT;0.000000;TexAnimEndU;SPTYPE_FLOAT;0.000000;TexAnimEndV;SPTYPE_FLOAT;0.000000;TexAnimDuration;SPTYPE_FLOAT;9.000000;TexAnimRotation;SPTYPE_FLOAT;9.000000;TexAnimOriginU;SPTYPE_FLOAT;0.500000;TexAnimOriginV;SPTYPE_FLOAT;0.500000;
Brightness;SPTYPE_FLOAT;1.000000; contrast;SPTYPE_FLOAT;1.000000; saturation;SPTYPE_FLOAT;1.000000; hue;SPTYPE_FLOAT;0.000000; colormatrix;SPTYPE_BOOL;0; g_ColorWriteEnable;SPTYPE_LONG;15; g_Wrap;SPTYPE_LONG;0; g_CullMode;SPTYPE_LONG;2; g_AlphaBlendEnable;SPTYPE_LONG;0; g_BlendOp;SPTYPE_LONG;1; g_SrcBlend;SPTYPE_LONG;2; g_DestBlend;SPTYPE_LONG;1; g_ZEnable;SPTYPE_LONG;1; g_ZWriteEnable;SPTYPE_LONG;1; g_ALPHATESTENABLE;SPTYPE_LONG;0; g_LightAmbientIntensity;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; LightDir_Dir0;SPTYPE_LONG;0; LightDir_Color0;SPTYPE_FLOAT4;1.000000;1.000000;1.000000;0.000000; LightDir_Dir1;SPTYPE_LONG;0; LightDir_Color1;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; g_MatSpecularStrength;SPTYPE_FLOAT;1.000000; g_MatSpecularPower;SPTYPE_FLOAT;10.000000; g_MatReflectionStrength;SPTYPE_FLOAT;1.000000; g_MatReflectionBias;SPTYPE_FLOAT;1.000000; g_MatReflectionBlur;SPTYPE_FLOAT;0.000000;g_AlphaValue;SPTYPE_FLOAT;1.000000; g_MatEmissiveColor;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; t_FilterTypeDiffuse;SPTYPE_LONG;2; t_SamplerAddressMode;SPTYPE_LONG;1; t_SamplerMaxAnisotropy;SPTYPE_LONG;4; t_MipMapLODBias;SPTYPE_FLOAT;0.000000; t_DiffuseTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_diff.dds; t_MinFilterTypeDiffuse;SPTYPE_LONG;3; g_MatDiffuseStrength;SPTYPE_FLOAT;1.000000; t_AlphaTexture;SPTYPE_STRING;NULL; t_BumpTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_bump.dds; t_MinFilterTypeBump;SPTYPE_LONG;3; t_BumpMipMapLODBias;SPTYPE_FLOAT;0.000000; t_FilterTypeBump;SPTYPE_LONG;2; t_SpecularTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_spec.dds; t_LightMapTexture;SPTYPE_STRING;dds\metal_argon_exhaust_trims_02_light.dds; t_CubeMapTexture;SPTYPE_STRING;DDS\envmap_test.dds;
[ external image ]
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
X-Tended TC Mod Team Veteran.
Modeller of X3AP Split Acinonyx, Split Drake, Argon Lotan, Teladi Tern. My current work:
Re: Transparent textures
Thanks once again Kiljeaden.
I'll have a play with all this information and see what's happens.
Sidetrack question here if you don't mind.
I noticed in XTC, there is 57 (if I remember correctly) weapons. I was under the impression that weapon numbers are limited in X3AP, at least bullets. Is there something special you guys did to achieve that many weapons?
Thanks again.
I'll have a play with all this information and see what's happens.
Sidetrack question here if you don't mind.
I noticed in XTC, there is 57 (if I remember correctly) weapons. I was under the impression that weapon numbers are limited in X3AP, at least bullets. Is there something special you guys did to achieve that many weapons?
Thanks again.
Re: Transparent textures
There is a limit of 32 weapon groups, but you can have multiple weapons in the group. The limit on actual weapons will be around 65536
The weapon groups define the compatability with a ship. So ships can define what groups the ship is compatability with.
If there are multiple weapons in the group then a ship will be compatible with them all.
The weapon groups define the compatability with a ship. So ships can define what groups the ship is compatability with.
If there are multiple weapons in the group then a ship will be compatible with them all.
Re: Transparent textures
Oh ok, well that clears that, thanks Cycrow. Very useful.
Re: Transparent textures
Killjaeden wrote: ↑Tue, 17. Mar 20, 22:44
Alpha channel is just another "channel" (next to red green blue). Black - invisible, White - visible, Gray - semi-transparent.
Do you know how to make an alpha channel? There should be tutorials for GIMP or Photoshop (or any other graphic tool that supports transparency). Once you have the texture with transparency, save it as PNG with alpha, or as TGA 32bit. Then you need to convert it to .DDS texture format. For semi-transparency you need the DXT5 .DDS format - because it allows 8bit alpha channel (black-grey-white values 0-255). DXT1 only allows 1 bit alpha channel (only black or white) channel. "DXT1 no alpha" has no alpha channel.
...
Hey again. I've been testing this out for hours now to no avail.
I just can't get it to work.
I'll add what I'm trying to do as well so it makes more sense.
As you can see, there is grey patches appearing over the ship. They are a separate mesh part from the main ship. They have the window dots textures to them along with a light map.
So I'm trying to keep the windows with lights appearing but make the grey parts invisible.
I have tried all that Killjaeden suggested without any luck.
The DDS itself, I've made the diffuse's alpha all black minus the window dots which are white. Compressed with DXT 5.
I've changed the alpha settings in the Mat6 entry without any luck. Even tried the alpha texture to my diffuse map & non-white.dds
Sure, I could just texture the windows and lights onto the main hull but I need to figure this out for other projects I will be doing.
Thanks again.
Re: Transparent textures
I’m trying to understand what you’re trying to accomplish here so bear with me. So your basically wanting those grey parts to be translucent yes? As in the grey parts are where you want a window or illuminated part? Is it a model that you’ve made, if so what program did you use?
Re: Transparent textures
Yes, the ship has 2 bod files. The main hull which is fine and the then the windows boxes (grey patches you see).J.M. wrote: ↑Sat, 21. Mar 20, 09:16I’m trying to understand what you’re trying to accomplish here so bear with me. So your basically wanting those grey parts to be translucent yes? As in the grey parts are where you want a window or illuminated part? Is it a model that you’ve made, if so what program did you use?
The hull is textured fine.
The windows boxes, are supposed to be invisible except the dots that appear as windows. There is a diffuse map, light map & a bump map. All are applied correctly. I am just trying to figure out how to make the object see through except the dots.
I have many more ships like this. All came the same way, rather not have to texture 100+ ship.
I'm using 3ds max 2010 with dbox2. I hope that explains it better.
Re: Transparent textures
Ok I know what your trying to do now, the light map needs a black background, so only the parts you want to light up are in colour, the alpha channel needs to be the same as this will determine which parts glow. If you have it, I use photoshop 7 with the dds plugin, with which you can save different formats of dds, which in this case is DXT5, quite easily. When I can get on my computer I’ll check all my settings for 3dsmax so we can eliminate that from causing you issues.
To me this sounds more like a problem with your texture. Any chance you could post a picture of what your light map looks like when you open it in a viewer of some sort? Hopefully that will give me a better idea of what’s happening here.
To me this sounds more like a problem with your texture. Any chance you could post a picture of what your light map looks like when you open it in a viewer of some sort? Hopefully that will give me a better idea of what’s happening here.
Re: Transparent textures
Right, I’ve had a play with applying textures in different ways and unfortunately I can’t get it to work by making those grey bits translucent. The only way I can get it to work is if the grey parts aren’t translucent but are infact textured and apply a light map on the self-illumination part of the multimaterials in max.
Are your models uvw mapped or box mapped?
Are your models uvw mapped or box mapped?
Re: Transparent textures
Uv mapped I think. The light map is fine, that's is working as intended.
Yes, there is no opacity setting in Mat6 entry in the bod files.
There is a glass texture knocking about in my install which is transparent as it's for the cockpit windows on fighters. It can be done, just not sure how.
I tried coping that mat6 for the glass texture but repointing it to my textures but it isn't having it.
The glass texture has a diffuse and a bump entry with the the specular entry being white (reflective glass).
I might try that texture on it instead but with my light map.
Would be great to figure it out however.
Yes, there is no opacity setting in Mat6 entry in the bod files.
There is a glass texture knocking about in my install which is transparent as it's for the cockpit windows on fighters. It can be done, just not sure how.
I tried coping that mat6 for the glass texture but repointing it to my textures but it isn't having it.
The glass texture has a diffuse and a bump entry with the the specular entry being white (reflective glass).
I might try that texture on it instead but with my light map.
Would be great to figure it out however.
Re: Transparent textures
Just managed to get it to work the way you want it to I think. When in max, import the argon_M3_scene from the game files (I’m assuming you’ve extracted all the game files), then go to the material editor, and select the multimaterial that is applied to the engine effect. I’ve just used that and replaced the diffuse (-79) with a light map (DXT5 with interpolated alpha) of my choice and it worked, only the windows showed.
Re: Transparent textures
Ok, I'll give that a try and let you know. Thank you.
Edit - It worked. It just seemed dull and unlike light like so I turned up the brightness and it looks great now. The only issue remaining is when I move the camera, the windows blur into each other. Gonna tweak the settings a bit in Mat6 entry. Thanks again.
Edit - It worked. It just seemed dull and unlike light like so I turned up the brightness and it looks great now. The only issue remaining is when I move the camera, the windows blur into each other. Gonna tweak the settings a bit in Mat6 entry. Thanks again.
Re: Transparent textures
I dont suppose you have the blurring problem. Tried changing a load of settings but no luck.
https://imgur.com/zXBoBXm
This is great but when you move the camera, this happens
https://imgur.com/IqRzXjt
Edit - I've figured it out. You don't need to use the effects entry, I think that the effects.fx is causing the motion blur thing. You can use standard entries. You just need to adjust a couple of things. Some of which Killjeaden had pointed out before.
I changed to 4
I then also set my light map as the alpha texture.
Works exactly as intended now. Thanks very much for the help. Much appreciated.
https://imgur.com/zXBoBXm
This is great but when you move the camera, this happens
https://imgur.com/IqRzXjt
Edit - I've figured it out. You don't need to use the effects entry, I think that the effects.fx is causing the motion blur thing. You can use standard entries. You just need to adjust a couple of things. Some of which Killjeaden had pointed out before.
I changed to one.MATERIAL6: 0; 0x2000000; 1; XT_standard_lighting.fx; 80; nofiltering;SPTYPE_BOOL;0; autofree;SPTYPE_BOOL;0; Tex2;SPTYPE_BOOL;0; TexAnimStartU;SPTYPE_FLOAT;0.000000; TexAnimStartV;SPTYPE_FLOAT;0.000000; TexAnimEndU;SPTYPE_FLOAT;0.000000; TexAnimEndV;SPTYPE_FLOAT;0.000000; TexAnimDuration;SPTYPE_FLOAT;0.000000; TexAnimRotation;SPTYPE_FLOAT;0.000000; TexAnimOriginU;SPTYPE_FLOAT;0.500000; TexAnimOriginV;SPTYPE_FLOAT;0.500000; Brightness;SPTYPE_FLOAT;1.000000; contrast;SPTYPE_FLOAT;1.000000; saturation;SPTYPE_FLOAT;1.000000; hue;SPTYPE_FLOAT;0.000000; colormatrix;SPTYPE_BOOL;0; g_ColorWriteEnable;SPTYPE_LONG;15; g_Wrap;SPTYPE_LONG;0; g_CullMode;SPTYPE_LONG;2; g_AlphaBlendEnable;SPTYPE_LONG;1; g_BlendOp;SPTYPE_LONG;1; g_SrcBlend;SPTYPE_LONG;2; g_DestBlend;SPTYPE_LONG;4; g_ZEnable;SPTYPE_LONG;1; g_ZWriteEnable;SPTYPE_LONG;1; g_ALPHATESTENABLE;SPTYPE_LONG;0; g_LightAmbientIntensity;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; LightDir_Dir0;SPTYPE_LONG;0; LightDir_Color0;SPTYPE_FLOAT4;1.000000;1.000000;1.000000;0.000000; LightDir_Dir1;SPTYPE_LONG;0; LightDir_Color1;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; g_MatSpecularStrength;SPTYPE_FLOAT;1.000000; g_MatSpecularPower;SPTYPE_FLOAT;5.000000; g_MatReflectionStrength;SPTYPE_FLOAT;1.000000; g_MatReflectionBlur;SPTYPE_FLOAT;0.000000; g_AlphaValue;SPTYPE_FLOAT;1.000000; g_MatEmissiveColor;SPTYPE_FLOAT4;0.000000;0.000000;0.000000;0.000000; t_FilterTypeDiffuse;SPTYPE_LONG;2; t_SamplerAddressMode;SPTYPE_LONG;1; t_SamplerMaxAnisotropy;SPTYPE_LONG;4; t_MipMapLODBias;SPTYPE_FLOAT;0.000000; t_DiffuseTexture;SPTYPE_STRING;dds\emwindows_diff.dds; t_MinFilterTypeDiffuse;SPTYPE_LONG;3; g_MatDiffuseStrength;SPTYPE_FLOAT;1.000000; t_AlphaTexture;SPTYPE_STRING;dds\emwindows_diff.dds; t_BumpTexture;SPTYPE_STRING;dds\emwindows_bump.dds; t_MinFilterTypeBump;SPTYPE_LONG;3; t_BumpMipMapLODBias;SPTYPE_FLOAT;0.000000; t_FilterTypeBump;SPTYPE_LONG;2; g_BumpMapStrength;SPTYPE_FLOAT;1.000000; t_SpecularTexture;SPTYPE_STRING;NULL; t_LightMapTexture;SPTYPE_STRING;dds\emwindows_light.dds; t_OcclusionTexture;SPTYPE_STRING;NULL; g_MatOcclStr;SPTYPE_FLOAT;1.000000; g_bIsDecalMap;SPTYPE_BOOL;0; t_DetailTexture;SPTYPE_STRING;NONE_NORMAL_DETAIL.DDS; p_DetailMapBlendWeight;SPTYPE_FLOAT;1.000000; g_NormalDetailStr;SPTYPE_FLOAT;1.000000; p_TexTiling;SPTYPE_FLOAT;10.000000; t_CubeMapTexture;SPTYPE_STRING;effects\others\envmap_test.dds; g_FresnelExpon;SPTYPE_FLOAT;2.000000; g_MatMinFresnel;SPTYPE_FLOAT;0.399994; g_Color_Envipaint;SPTYPE_FLOAT4;1.000000;1.000000;1.000000;0.000000; g_Brightness;SPTYPE_FLOAT;5.000000; g_Contrast;SPTYPE_FLOAT;1.000000; g_Saturation;SPTYPE_FLOAT;1.000000; g_Hue;SPTYPE_FLOAT;0.000000; g_Color_1;SPTYPE_FLOAT4;0.309998;0.299988;0.069992;0.000000; g_Color_2;SPTYPE_FLOAT4;0.299988;0.279999;0.089996;0.000000; g_Color_3;SPTYPE_FLOAT4;0.099991;0.279999;0.299988;0.000000; g_Color_Lines;SPTYPE_FLOAT4;0.339996;0.289993;0.000000;0.000000; g_Color_Highlight;SPTYPE_FLOAT4;0.599991;0.099991;0.099991;0.000000; g_Color_LinesPower;SPTYPE_FLOAT;9.000000; g_Color_HighlightPower;SPTYPE_FLOAT;12.000000; g_Color_Weighting;SPTYPE_FLOAT;0.500000; g_bColor_Mixing;SPTYPE_BOOL;0; effectfile;SPTYPE_STRING;XT_standard_lighting.fx; renderEnabled;SPTYPE_BOOL;0; renderMaterial;SPTYPE_LONG;790636832; technique;SPTYPE_LONG;0;
g_AlphaBlendEnable;SPTYPE_LONG;1
I changed to 4
g_DestBlend;SPTYPE_LONG;4
I then also set my light map as the alpha texture.
Works exactly as intended now. Thanks very much for the help. Much appreciated.
Re: Transparent textures
Good stuff, weirdly I didn’t actually have the blur problem
At least you’ve got it sorted now anyway.
At least you’ve got it sorted now anyway.