.qc (dot qc) - the group for quake c coders of all denominations. If you make quake one mods and write code in quake c, join our group! I'll try to answer any quake c questions - please post your inquiry in the forums...
|Darkplaces Alpha Texture||Locked|
numbersix quake-c coder++
|Oct 12 2012 Anchor|
This is a tutorial candidate.
How can I do alpha texture in darkplaces ?
There are 2 methods to do this.
A. As an override texture. Darkplaces allows .tga and .jpg to be used to override in game textures. This has a big advantage of allowing a full 32 bit palette, where the in game miptex are limited to 8 bits (a 256 color palette.)
This is a complex process that takes advantage of transparency (alpha channel) in .tga files and darkplaces ability to use tga for overriding in game miptex.
1. Use gimp or an other editor to make the texture. The texture must have an alpha channel and some measure of transparency.
You can do the same thing with model skins. Darkplaces looks for model skin overrides in "quake/id1/progs" with the following convention: for player.mdl, the skin0 override would be "player.mdl_0.tga", for skin1 - "player.mdl_1.tga" and so on. Those tga can be made exactly the same way with transparency. You can have all or part of a model skin be transparent. NOTE: Making models transparent is tricky because of internal triangles - if the model isnt made just right, you might see things that dont normally show up.
Darkplaces is not seeing the override texture. Make sure "quake/id1/textures" (or "quake/id1/progs" for model skins) is setup right and override textures stored there work.
The map compiler (qbsp or hmap2) did not find NEWTEX in the wad file - this will register as a warning:
The override texture is not _really_ transparent. Make sure it has an alpha channel. Make sure it was saved with some transparent pixel values that can actually be seen through. Make sure the texture is saved as a tga and NOT a jpg. Both are supported by darkplaces but jpg does not handle transparency.
This method should work on any darkplaces derived engine. Other engines that use .tga overrides may or may not work correctly.
B. As a code controlled model property. This will not work on map walls and possibly things like func_door and func_wall.
You can also make any entity that displays a model transparent with this quake-c code:
.float alpha; // defined anywhere, like at the end of "defs.qc".
for some entity like the player:
self.alpha = 0.5; // level of transparency
This makes the _entire_ entity transparent at 50%. You can not pick and choose parts of a model like you can with the skin override.
The model has no transparency. Make sure you set the correct entities ".alpha".
server EDICT 1:
If alpha is >= 1 or 0 you will not have a transparent model.
This provides 2 methods for in game texture transparency.
Only registered members can share their thoughts. So come on! Join the community today (totally free - or sign in with your social account on the right) and join in the conversation.