Custom Decal Trouble


(FireFly) #1

I’m having some problems with a custom decal I created. A bit hard to explain, but they say a picture is worth a thousand words, so here we go:

I made a window in photoshop and added some shadow as seen on the alpha channel.

However, ingame the shadow doesn’t blend as it does in the alpha channel: Instead I get a very harsh/ non blending shadow…

I used the shader from the ‘oilslick’ texture as a base for my own window shader: ( textures/decals/oil_slick.tga)

textures/ronda_b3/ff_cruz_window
{
qer_editorimage textures/ronda_b3/ff_cruz_window.tga
surfaceparm trans 
surfaceparm nonsolid 
surfaceparm pointlight
surfaceparm nomarks
polygonOffset
{
map textures/ronda_b3/ff_cruz_window.tga
alphaFunc GE128
rgbGen vertex
}
}

For my previous maps(s) I already made some custom commandmap-icons that worked correct: So I tried the same shader that’s being used for the commandmap-icons:

textures/ronda_b3/ff_cruz_window
{
nomipmaps
nopicmip
{
map textures/ronda_b3/ff_cruz_window.tga
blendfunc blend
rgbgen vertex
}
}

Now I get the right blend, and everything looks the way I intended (as seen in the first screenshot) But now I also get some nasty z_fighting on the window! :???:

Any ideas? I’m pretty sure that the problem / answer must be in the shader…


(nUllSkillZ) #2

Try adding polygonOffset to the second one.

BTW here is a link to the shadermanual:
q3map2 shadermanual


(FireFly) #3

Thanks nUllSkillZ, that did the trick!

Also thanks for the shadermanual you posted as ‘www.shaderlab.com’ has been dead for a while…


(nUllSkillZ) #4

Not sure what keywords of the first shader you have to add in addition to the now working shader as I don’t have any knowledge of shaders.
But don’t add alphaFunc GE128.


(carnage) #5

alphaFunc GE128

perhaps i can elaborate a bit for thoes who are interesting and learning shaders

this command will render each pixel of the image totaly opaque if the alpha channel for that pixel is greater then 128. (alpha values go from 0 - 256, white - black) and pixel less that 128 alpha is not rendered at all. this creates a very sharp edge like seen on the fueldump trees

i dont like this sort of belnding for terrain and it makes it very obvious were the terrain texture changes and can often make it apear that patches of one terrain type are floating above the other (especialy when the image reolutions are differnt)

good uses for this shader commad are things like tree, bushes and flat fence rails. ususaly things that are a floating decal rather then against an exiting surface. using this type of decal agaisnt an exisitng surface imo gives the impresion that the decal is actuly on top of the other surface rather then one totaly smooth surface. this can be usefull sometimes e.g. the foam in the map warbell


(FireFly) #6

Thanks for sharing this info Carnage:I’m not very familiar with creating these kind of ‘complex’ shaders, so I find the info you posted very usefully for me.
The window shader / texture I created is part of an ASE model ( a church) I made. I’m not sure if the shader I created will also work on the ASE model, as I did not yet converted the brushwork to an ASE model, but I’ll test that tomorrow…


(EB) #7

dONKEY put together a tutorial thread that you may find interesting… HERE

…also note that using polygonoffset on textures/shaders will cause image-axis-fighting(per whatever angle used). Pay attention to the SORT value.


(FireFly) #8

I converted the brushwork to an ASE model and here’s the result:

For the walls I used Detoeni’s shader for Ase models that he posted on his Homepage…
And here’s the final shader I used for the decal windows:

textures/ronda_b3/ff_cruz_window
{
	surfaceparm trans
	PolygonOffset
	{
		map textures/ronda_b3/ff_cruz_window.tga
		blendfunc blend
		rgbgen vertex
	}
}

I have double checked the ASE model ingame from every angle ,but at the moment I’m not getting any kind of z-fighting with the above shader I’m using…

BTW thanks for the link you posted: I am planning to do a major makeover on the church in tramfight ( where the objective / venom gun is) and this is exactly what I need for the church windows, thanks…

EDIT:

BTW, For those interested : Here’s the real church I used as an example…


(EB) #9

NP, I forgot to say “fight with marks”, like bullet marks/smoke stains.
nice ase


(Shaderman) #10

Nice!