Transparent texture?
Transparent texture?
Alright, so I want to make a plant right?
Pretty simple, just make two square planes in a cross and apply a texture. Altho for it not to look weird, were theres nothing on the texture I want it to be transparent. So for example i have some leaves on a white background. How would i make that white transparent? I use Darkplaces.
Pretty simple, just make two square planes in a cross and apply a texture. Altho for it not to look weird, were theres nothing on the texture I want it to be transparent. So for example i have some leaves on a white background. How would i make that white transparent? I use Darkplaces.
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
In unmodified Quake/GlQuake engines, there's no support to transparent colors in .mdl. Besides the usual Darkplaces/FTE indications, the RMQ engine (developed and maintained by mh) does support transparency to .bsp models (not sure about .mdl though, better to ask mh directly), and I remember the Kurok engine having this exactly to implement vegetation (a simple engine change was required and there's a thread where mh showed how to do that - use the forum search if you want to get your hands dirty in engine coding ).
If you're not targeting a modified engine, it's possible to emulate what you want with 2 entities and 2 sprites (sprites do support color index 255 as transparency). Basically, spawn both entities in the same coordinates but having a 90 degrees offset in the .angles_y and here is your plant/bush.
If you're not targeting a modified engine, it's possible to emulate what you want with 2 entities and 2 sprites (sprites do support color index 255 as transparency). Basically, spawn both entities in the same coordinates but having a 90 degrees offset in the .angles_y and here is your plant/bush.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
There hasn't been a requirement for having this on MDLs in RMQ yet so it doesn't support it. I'd personally run with the two sprites idea if only for one drawback - sprites are always drawn fullbright.
I guess you could hack it with MDLs by setting the entity alpha to something like 0.999 and using a TGA with an alpha channel as the skin. This may even work with the native 8-bit texture; Nehahra does this for fences/grills/grates on brush models and it works - kinda - fine. I haven't personally tested this for MDLs though so I don't know how robust it would be, and I wouldn't encourage hacks of this nature (they normally either come back to bite you or conflict with something else).
I guess you could hack it with MDLs by setting the entity alpha to something like 0.999 and using a TGA with an alpha channel as the skin. This may even work with the native 8-bit texture; Nehahra does this for fences/grills/grates on brush models and it works - kinda - fine. I haven't personally tested this for MDLs though so I don't know how robust it would be, and I wouldn't encourage hacks of this nature (they normally either come back to bite you or conflict with something else).
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
Since you use Darkplaces just use scripts/plants.shader with like um
progs/plants_0 leading to a .tga, or .png of course (or even a jpg with a _alpha.jpg pair)
Code: Select all
progs/plants_0
{
cull disable
{
map progs/plants_0
alphaFunc GE128
rgbGen lightDiffuse
}
}
i should not be here
I used the transparant effect by transporting the model to a sprite.
There's a good sprite-editor from FricaC that can obtain the effect by using one of Quake's colours as alpha chanel,while importing small bmp.
It's a bit in the way like the grenade explosion, which also makes use of the transparant effect.
Quake uses the Pal Colour:255 R:159 G:091 B:083 for transparant.
So when you use this as your surrounding colour it will be transparant. Don't forget to use 2bit black/white shaders for alfa.
Bad point is the plant will always turn like in doom, but when you make it round enough, like a palmtree it won't be that disturbing.
fimg_v can be found at the Quakaddicted site/tools
http://www.quaddicted.com/tools/
Here's an example of the voreball as sprite, the red surrounding won't appear in Quake.
There's a good sprite-editor from FricaC that can obtain the effect by using one of Quake's colours as alpha chanel,while importing small bmp.
It's a bit in the way like the grenade explosion, which also makes use of the transparant effect.
Quake uses the Pal Colour:255 R:159 G:091 B:083 for transparant.
So when you use this as your surrounding colour it will be transparant. Don't forget to use 2bit black/white shaders for alfa.
Bad point is the plant will always turn like in doom, but when you make it round enough, like a palmtree it won't be that disturbing.
fimg_v can be found at the Quakaddicted site/tools
http://www.quaddicted.com/tools/
Here's an example of the voreball as sprite, the red surrounding won't appear in Quake.
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Actually when I suggested to use sprites I was thinking about oriented sprites (the kind that doesn't always face you). It's just a flag you set when creating sprites with ADQuedit, I think it's possible to do the same with Fimg.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
but sprites aren't lit!
Well, if you're using darkplaces, stick a ! beginning in the filename then it'll be lit
Personally I don't like using oriented sprites for objects because you'd require more entities to simulate more volume, AND the sprites do not have visible backfaces
also, glquake (and everything after) broke its sprite rendering for the various different modes. mh needs to like write a tut to fix the exotic sprite modes in GL or something. VP Parallel Oriented is very cute to make sprite effects with (rotating smoke anybody?)
Well, if you're using darkplaces, stick a ! beginning in the filename then it'll be lit
Personally I don't like using oriented sprites for objects because you'd require more entities to simulate more volume, AND the sprites do not have visible backfaces
also, glquake (and everything after) broke its sprite rendering for the various different modes. mh needs to like write a tut to fix the exotic sprite modes in GL or something. VP Parallel Oriented is very cute to make sprite effects with (rotating smoke anybody?)
i should not be here
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Also, if the objective is to put a few arbusts in a garden lit by the sun light this won't be an issue at all.leileilol wrote:but sprites aren't lit!
Well, if you're using darkplaces, stick a ! beginning in the filename then it'll be lit
EDIT:
makestatic() is your friend!leileilol wrote:Personally I don't like using oriented sprites for objects because you'd require more entities to simulate more volume, AND the sprites do not have visible backfaces
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
makestatic is fine up to a point. Most engines still have a hard limit on the number of static entities they can have; any quick examination of the code will reveal that this limit is actually completely unnecessary. Each static entity needs one or more efrags to link it into the BSP tree, so even if you remove the limit on static entities you still need to remove the limit on efrags. Static entities live on the client only, they won't show up in clipping hulls (even if static bmodel entities) so you still need to sprinkle clip brushes around the place.
Regarding sprites, they're a solution with drawbacks. Biggest drawback is that lighting on them - even if you do enable the trick with a ! in the name - is gouraud-shaded, meaning that you don't get proper shadows that would otherwise be generated from light.exe.
For any given solution, if you find yourself having to accumulate more and more hacks, complexity and bugfixes in order to get it working, it's a pretty good sign that it might not be the correct solution, and maybe you need to backtrack and rethink your approach.
Regarding sprites, they're a solution with drawbacks. Biggest drawback is that lighting on them - even if you do enable the trick with a ! in the name - is gouraud-shaded, meaning that you don't get proper shadows that would otherwise be generated from light.exe.
For any given solution, if you find yourself having to accumulate more and more hacks, complexity and bugfixes in order to get it working, it's a pretty good sign that it might not be the correct solution, and maybe you need to backtrack and rethink your approach.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
We knew the words, we knew the score, we knew what we were fighting for
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
@mh: bushes made up of sprites are hacks with several problems and limitations, no doubt about this. But, as I said, they get the job done in a easy way without wasting time and effort. Later, if the result is not good enough and there's enough motivation, other solutions like custom .mdl/.md3 props can be provided.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)