getting a flag banner too appear that it doesnt have a bg


(ensiform) #1

i need some help getting this too work

its a copy of
textures/q3f_32smooth/bluebanner1
but it looks exactly the the above pic yet it is a shader in radiant. i want it so that the black isnt there and you can see what is behind it. can someone help me ?

textures/2fort5/mtf1-red
{
     qer_editorimage textures/2fort5/mtf1-red.tga
     cull disable
     surfaceparm alphashadow
     surfaceparm trans	
     surfaceparm nomarks
     deformVertexes wave 64 sin 0 1 0 .2
	 
        {
        textures/2fort5/mtf1-red.tga
//		tcmod scale 0.25 0.25
        alphaFunc GE128
		depthWrite
		rgbGen vertex
        }
        {
		map $lightmap
		rgbGen identity
		blendFunc filter
		depthFunc equal
	}
}

(WolfWings) #2

It would appear that the image in question doesn’t have an Alpha channel, to me. Can you upload the actual .tga file somewhere for us to take a look at? Other than formatting (that Shader is a mess to read) the shader itself looks good.

Also, depending on how far to the walls the banner will be hung, you might want to make the shader two-sided with q3map_backShader so the lighting can be different in the front from the back. Or, if it’s only meant to be hung incredibly close (effectively right ON the wall) then you could (seperately) do away with the ‘cull disable’ entirely.


(ydnar) #3

If the shader uses a lightmap, then change “rgbGen vertex” to “rgbGen identity” in the first line.

y


(ensiform) #4

thanks, here is the tga:

http://tsf.cpusource.net/mtf1-red.tga


(WolfWings) #5

Yup, the .tga file you’re using doesn’t have any transparency.

A replacement shader, and the replacement .tga file:

textures/2fort5/mtf1-red
{
	q3map_backShader textures/2fort5/mtf1-red_back
	qer_editorImage textures/2fort5/mtf1-red.tga
	surfaceParm alphaShadow
	surfaceParm trans   
	surfaceParm noMarks
	deformVertexes wave 64 sin 0 1 0 .2
	{
		textures/2fort5/mtf1-red.tga
		alphaFunc GE128
		depthWrite
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc filter
		depthFunc equal
	}
}

textures/2fort5/mtf1-red_back
{
	q3map_lightImage textures/2fort5/mtf1-red.tga
	surfaceParm alphaShadow
	surfaceParm trans   
	surfaceParm noMarks
	deformVertexes wave 64 sin 0 -1 0 .2
	{
		textures/2fort5/mtf1-red.tga
		alphaFunc GE128
		depthWrite
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc filter
		depthFunc equal
	}
}

And here’s the .tga file with a fixed alpha channel:

http://wolfwings.us/mtf1-red.tga

Using the linked-to image by itself will fix your problem. The above shader will incorporate the ‘fix’ ydnar pointed out for the lighting, as well as making the banner able to be seperately lit from the front and the back. The replacement shader will only work with q3map2 2.5.15 or above, which you should be using regardless if you’re using q3map2 at all. :slight_smile:


(ensiform) #6

can u do the blue tga too:

or show me how too add alpha channel in photoshop. (i have cs)

http://tsf.cpusource.net/mtf1-blue.tga


(WolfWings) #7

(un)Fortunately, I use The GIMP for my graphics-editing, because it’s 100% free, and available for just about every operating system under the sun. I can step you through how I added an Alpha Channel with that though.

First, after installing it, when you start it for the first time you’ll be presented with a ‘Welcome to The GIMP User Installation’ screen. Don’t panic, this is normal. GIMP supports multiple users on one computer, and it needs to do some per-user setup the first time any given user runs the program. Just click the ‘Continue’ button until the big orange-topped window goes away, and wait for The GIMP to finish loading. It takes a while the first time.

Close the ‘Tip of the Day’ box, and tell it to never come back if you want to.

Now, find this dialog box:

Using your left mouse button, drag the image you want to edit and drop it onto this window to open it. Taking the mtf1-blue.tga file as an example for this exercise, you’ll end up with this screen:

Now, go back to the Main Window (the one you dropped the file on) and click on the icon of a hand pointing at a gray box between a yellow and red box. This is the ‘select by colour’ tool, that lets you select all of the regions in an image that are a single colour. In this case, black.

When you click on the tool, a bunch of options will show up in the bottom half of that window. Turn off AntiAliasing, and set the Threshold to 0.0 first.

Now, go back to the mtf1-blue.tga window, and click anywhere that’s black. A bunch of the image should highlight.

Now, go to the one window you haven’t touched yet, the Layers, Channels, Paths, … window. Right-click on the image of the Background layer, and click on “Add Layer Mask” if it’s available. If it’s not available (grayed out) click on “Add Alpha Channel” first, then go into the right-click menu again and the option will become available. When asked what to Initialize the Layer Mask to, pick White (Full Opacity) for now. The Layer Mask will be the ‘active layer’ now, as evidenced by the black border around the actual image, and the white border around the new Layer Mask. (Trust me, you’ll notice it more when you come back to this window in a moment.)

Now, go back to the image mtf1-blue.tga window, and right-click again. Under the Edit menu, pick ‘Fill with FG Color’ to fill the selected areas of the image with black in the active layer. Since the Layer Mask is active, this fills in the ‘solid black’ areas in the image that we selected earlier with Black, marking them to be set transparent in a moment.

Press Ctrl+Shift+A to unselect everything, since we’re done with that. Next, press Shift+= three or four times to zoom into the image, go pick the ‘Pencil’ tool, and click on the little left-and-down arrow in the upper-right corner of the Colour Selector to switch the foreground and background colours. We want to draw with white for a moment, not black.

Going back to the mtf1-blue.tga window, you should see something like this:

What we’re going to do now is remove the ‘tiny flecks’ of transparency (the checkboard gray pattern, like PhotoShop uses) from the image, as they don’t tend to show up well in-game, nor does q3map2 handle them well when casting shadows. So, see those two little flecks by the big long diagonal slash on the left half of the window? Move the mouse over them until the highlighted circle (that’s your brush) covers them, without covering any of the diagonal slash itself. Then left-click lightly. The circle should vanish for a moment, and the two flecks of transparencyshould fill in with black again as well.

Continue cleaning up any spots of transparency that don’t make sense, like this area:

When you’re done, it should look more like this:

Now, go to the Layers window again, and right-click on the Layer Mask. Select ‘Apply Layer Mask’ and you’re almost done.

Go back to the mtf1-blue.tga window, right-click, under File select Save as… then save the image as whatever you want, just as long as you make sure it ends in .tga and not .jpeg, otherwise you’ll lose the transparency information. When given a window of options to use for the ‘Save as TGA’ filetype, make sure RLE Compression is unchecked and Origin at bottom left has to be checked before clicking OK.

Viola, you’re done. Press Ctrl+Q to quit The GIMP.

Oh, and here’s the new .tga file if you don’t want to trudge through the above:

http://wolfwings.us/mtf1-blue.tga


(obsidian) #8

In Photoshop, choose ‘Window > Show Channels’.

In the Channels window tab, click on the ‘Create new channel’ button on the bottom of the window (second from the right).

Select the new ‘Alpha 1’ channel and use the bucket tool to fill it with white.

Use a paintbrush and paint in the transparent areas with black.

When you’re done, choose ‘File > Save as’. Choose a file name, TGA format, save. A second menu pops up, since you have an alpha channel, save this TGA as 32-bit/pixel (TGA’s without alpha should be 24-bit).


(WolfWings) #9

AKA, you say what I said, but with a lot less detail, Obsidian. Like skipping the useful part about using ‘Select by Colour’ to quickly get rid of all of the black areas to begin with. :slight_smile:


(obsidian) #10

The process of creating alpha channeled images in GIMP and Photoshop are pretty much the same, but there are a few differences. Since you’ve covered most of the details, I was just pointing those differences since ensiform’s a Photoshop user and probably has never used GIMP.


(WolfWings) #11

Ah, gotcha. =^.^=


(majestyk) #12

This is a great step-by-step tutorial and should be saved. How about moving it to a tutorial section or pack it up for web page archiving on map-depot.com or any other map development page?


(WolfWings) #13

Probably because it doesn’t use PhotoShop (note the images look NOTHING like any version of PhotoShop, that I know of at least) so most folks would ignore it entirely from what I’ve seen? =^.^=

I’ll see about posting the above to my website when I get a chance though, if you really think anyone would find a use for it?


(majestyk) #14

I personally useThe Gimp, and since I am not big into design and graphics stuff I am really happy about such a “hands-on” tutorial. You are right, most folks will ignore it. But for a minority, it is even more important to help each other :slight_smile:


(WolfWings) #15

`Kay. I’ll package it up after I finish building and writing my ‘dithered texture transition’ tutorial I’m writing to explain and build on the technique Ratty_Redemption originally thought of and created.