Forum

Transparent texture?

Discuss the creation of various model formats for Quake engines, and related matters to modeling.

Moderator: InsideQC Admins

Transparent texture?

Postby Karall » Sat Apr 02, 2011 2:06 pm

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.
Karall
 
Posts: 128
Joined: Thu Jul 15, 2010 5:23 pm

Postby ceriux » Sat Apr 02, 2011 4:43 pm

check out external tga support and how to use alpha channels
User avatar
ceriux
 
Posts: 2228
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby frag.machine » Sun Apr 03, 2011 2:14 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.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Postby mh » Sun Apr 03, 2011 4:18 pm

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).
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby Spike » Mon Apr 04, 2011 1:23 am

hexen2 has a few extra mdl flags that enable different transparency modes. A regular Quake engine doesn't support it though. With FTE or DP you can write some q3-style shaders to do it.

getting a brush model thin enough to make a good tree may be problematic, and can't easily be animated.
Spike
 
Posts: 2911
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby leileilol » Mon Apr 04, 2011 1:34 am

Since you use Darkplaces just use scripts/plants.shader with like um

Code: Select all
progs/plants_0
{
cull disable
       {
          map progs/plants_0
          alphaFunc GE128
          rgbGen lightDiffuse
       }
}


progs/plants_0 leading to a .tga, or .png of course (or even a jpg with a _alpha.jpg pair)
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby Madfox » Tue Apr 12, 2011 9:00 pm

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.
Image
User avatar
Madfox
 
Posts: 106
Joined: Sat Jan 15, 2005 3:13 pm
Location: Holland

Postby frag.machine » Wed Apr 13, 2011 12:20 am

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)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Postby leileilol » Wed Apr 13, 2011 12:23 am

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?)
i should not be here
leileilol
 
Posts: 2783
Joined: Fri Oct 15, 2004 3:23 am

Postby frag.machine » Wed Apr 13, 2011 12:47 am

leileilol wrote:but sprites aren't lit! :(

Well, if you're using darkplaces, stick a ! beginning in the filename then it'll be lit


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. :)

EDIT:
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


makestatic() is your friend!
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm

Postby goldenboy » Wed Apr 13, 2011 8:24 am

You're giving me ideas.
User avatar
goldenboy
 
Posts: 924
Joined: Fri Sep 05, 2008 11:04 pm
Location: Kiel

Postby mh » Wed Apr 13, 2011 12:42 pm

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.
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
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby frag.machine » Thu Apr 14, 2011 12:52 am

@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)
User avatar
frag.machine
 
Posts: 2120
Joined: Sat Nov 25, 2006 1:49 pm


Return to Modeling

Who is online

Users browsing this forum: No registered users and 1 guest