Fun with shaders (ok so I lied)


(Gonk) #1

I’ve got three textures here, two of which are going to be banners (think flags from RtCW/ET), and one which is just a tarp to hang over something (tatcloth)…

Also, FYI, this is Jedi Academy.

Here’s the shaders as they stand now:

textures/gonk/tatcloth
{
	qer_editorimage	textures/gonk/tatcloth
	q3map_lightimage	textures/gonk/tatcloth
	q3map_nolightmap
	surfaceparm alphashadow
	surfaceparm trans
	cull twosided
    {
        map textures/gonk/tatcloth
	  alphaFunc GE192
        blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatbanner
{
	qer_editorimage textures/gonk/tatbanner
	q3map_nolightmap
	surfaceparm trans
	cull	twosided
	deformVertexes wave 10 sin 0 2 0 .2
	{
        map textures/gonk/tatbanner
	  alphaFunc GE128
	  nextbundle
        depthWrite
	  map $lightmap
        rgbGen vertex
	}
}

textures/gonk/tatbanner_b
{
	qer_editorimage textures/gonk/tatbanner_b
	q3map_nolightmap
	surfaceparm nonsolid
	surfaceparm trans
	surfaceparm alphashadow
	cull	none
	deformVertexes wave 10 sin 0 2 0 .2
	{
        map textures/gonk/tatbanner_b
	  alphaFunc GE128
	  nextbundle
        depthWrite
	  map $lightmap
        rgbGen vertex
	}
}

My problem is, no matter what I set the cull to (twosided or none), the banners/tarps only show on one side, when they should show on two. In addition, the parts of them that you should be able to see through (they have alpha channels in they’re .tgas) are just black, as if the texture is simply being loaded without the shader at all. Also, the banners are supposed to flap in the wind a bit, and they don’t.

The shader file is in shaderlist.txt. q3map2 loads it fine. I’m really not understanding why this doesn’t want to work… I hate shaders with a passion. Any help?


(ratty redemption) #2

I might be wrong but I don`t think we can have alphaFunc GE192 and blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA in the same stage, try one or the other.


(Gonk) #3

I removed the blendFunc stuff and tried it again and still no luck.

The strange thing is a friend tested it on his system and tatcloth worked just fine, except for the fact that you could partially see through parts of the cloth that you weren’t supposed to… both of the banners didn’t work at all…

I’m so very confused…


(rgoer) #4

I belive your problem stems from the fact that there is no such thing as alphaFunc GE192… unless Raven has departed greatly from q3 shaders in JA, then these are the only valid alphaFunc functions: GT0, LT128, GE128.


(Davros) #5

think there could be a bug with this. i have a tree with two sided image for the leaves. but it only works when i join the game not while spectating. weird shit :disgust:


(Gonk) #6

I think I’ve stumbled upon a bug…

I have a LOT of non-standard .pk3s in my /base folder. A LOT. :slight_smile: Mostly player models from JO, a few maps, and vehicles.

So, on a hunch, I removed them all. Leaving me with just the official JA stuff (bonus maps included). I fire up the level, and the shaders work FLAWLESSLY. (Although I have modified them a bit from their incarnation you see here, they did not work prior to me removing the .pk3s.) No problems at all. Looks exactly like it should.

So now I’m extremely confused. APPARENTLY, there’s some kind of conflict between one of these .pk3s, and my shader… why I’m not sure… I removed all of my own personal map .pk3s, and the shaders didn’t work. I removed all map .pk3s, including my own, and it didn’t work. I remove just the models and vehicles, it doesn’t work. But if I remove all .pk3s except the official ones, it works.

I know JA has a vehicle limit of 12, including the vehicles in the game, is it possible that Raven implemented a .pk3 limit as well? (Which seems counter-productive to me…) Or is this just a reason for me to try reinstalling JA?

Edit: Ok so not PERFECTLY flawless… the banners aren’t giving me the “waving in the wind” effect that the deform vertexes call is supposed to do…


(ratty redemption) #7

I too wondered about the ge192 alphafunc, so is that vaild, ie does it work?

and if there is a limit to the number of pk3`s then you could extract some of them and repackage into one zip then rename it to a pk3.

off topic: once Ive finished my latest wolf map, Im seriously thinking of switching to ja, could you guys give me links to your fav mapping forums?


(Gonk) #8

I’m using GE128 right now… dunno if 192 works or not.

I’m going to have to check on the pk3 issue.

As for mapping forums for JA… Try map-center.com, pcgamemods.com, massassi.net, and jediknight.net’s forums.


(Lil Killa) #9

The problem has to do with the JO maps you had in your pk3 (models too) anything from the original JO game sould not be stuck in your JA base as the shader file conflict with JA ones and end up messing everything up. If there are no shader files or it is a non Ravev JO game or map then it should be fine to put in your pk3. :slight_smile:


(Gonk) #10

You are correct sir. I just put these shaders in a custom shader file for the map and it worked fine. Seems there was a conflict somewhere.

Thank you everyone for your help, it all works now! :slight_smile:


(ratty redemption) #11

Gonk, cool that you got it working, and thanx for the links :slight_smile:


(ydnar) #12

Gonk:

If you want twosided lighting on your tattered cloth shaders, remove the “cull none” line and add “q3map_cloneShader textures/gonk/tatcloth_back”.

Create the textures/gonk/tatcloth_back shader and replace “cull none” with “q3map_invert”.

The end effect will be downward facing (and therefore darker lit) cloth on the underside of the canopy.

u


(Davros) #13

nice trick :drink:


(Gonk) #14

Excellent, ydnar. You rule. :slight_smile:

Before and After: 1 2 3

Much improved, methinks.


(rgoer) #15

Hmmm… you might want to give your cloneShader a small surfacelight (and carefully tweak the backsplash value) to simulate light coming through the cloth. You were right that it was too bright before, but now it looks like a metal roof instead of cloth tarp…


(ratty redemption) #16

Gonk, nice pics, and can you get the cloth to work with deformvertexes?


(Gonk) #17

The cloth shaders, no I didn’t get to work with the deformvertexes… The banners do work just fine.

Here’s a shader newbie question… I’m getting error messages in the console to the tune of: “textures/gonk/tatcloth has lightmap but no lightmap stage!” for tatcloth, tatbanner, tatcloth_back, tatcloth_b, and tatcloth_b_back… here’s the entire shader file:

textures/gonk/tatcloth
{
	qer_editorimage	textures/gonk/tatcloth.tga
	q3map_lightimage	textures/gonk/tatcloth.tga
	q3map_cloneShader textures/gonk/tatcloth_back
	q3map_nolightmap
	surfaceparm nonsolid
	surfaceparm alphashadow
    {
        map textures/gonk/tatcloth
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatcloth_back
{
	qer_editorimage	textures/gonk/tatcloth.tga
	q3map_lightimage	textures/gonk/tatcloth.tga
	q3map_nolightmap
	q3map_invert
	surfaceparm nonsolid
    {
        map textures/gonk/tatcloth
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatcloth_b
{
	qer_editorimage	textures/gonk/tatcloth_b.tga
	q3map_lightimage	textures/gonk/tatcloth_b.tga
	q3map_cloneShader textures/gonk/tatcloth_b_back
	q3map_nolightmap
	surfaceparm nonsolid
	surfaceparm alphashadow
    {
        map textures/gonk/tatcloth_b
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatcloth_b_back
{
	qer_editorimage	textures/gonk/tatcloth_b.tga
	q3map_lightimage	textures/gonk/tatcloth_b.tga
	q3map_nolightmap
	q3map_invert
	surfaceparm nonsolid
    {
        map textures/gonk/tatcloth_b
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatbanner
{
	qer_editorimage textures/gonk/tatbanner.tga
	q3map_nolightmap
	cull	twosided
	surfaceparm nonsolid
	deformVertexes wave 10 sin 0 2 0 .2
    {
        map textures/gonk/tatbanner.tga
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatbanner_b
{
	qer_editorimage textures/gonk/tatbanner_b.tga
	q3map_nolightmap
	cull	twosided
	surfaceparm nonsolid
	deformVertexes wave 10 sin 0 2 0 .2
    {
        map textures/gonk/tatbanner_b.tga
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatbanner_c
{
	qer_editorimage textures/gonk/tatbanner_c.tga
	q3map_nolightmap
	cull	twosided
	surfaceparm nonsolid
	deformVertexes wave 10 sin 0 2 0 .2
    {
        map textures/gonk/tatbanner_c.tga
	  alphaFunc GE128
        depthWrite
        rgbGen vertex
    }
}

textures/gonk/tatsandlarge
{
	qer_editorimage textures/gonk/tatsandlarge
	q3map_material Sand
    {
        map $lightmap
        rgbGen identity
    }
    {
        map textures/gonk/tatsandlarge
        blendFunc GL_DST_COLOR GL_ZERO
        rgbGen identity
    }
}

I’m such a newbie… :slight_smile:


(ratty redemption) #18

Gonk, I had a quick look at your shader and I can`t see anything wrong with it, but someone else might.

ydnar, a while back I found cloneShader didnt work in wolf very well with deformvertexes, as the back face of the water tex I was working on was getting split differently then the front, so the deforming ended up different, could that be why Gonk didnt get it working for his cloth shader?


(Tigris) #19

Geez, that sure looks nice- reminds me that I should start mapping again on that ol’ cantina :slight_smile:
I never got the deforming to work on my cloth either.


(Gonk) #20

I’ve been fiddling with q3map_backSplash on tatcloth_back, and I’m not sure what I should really be using for the distance and percentage values… q3map_surfaceLight is 100 currently, and the q3map_backSplash is set to 50% (0.5) and a distance of 8 units from the texture, but I’m not seeing any difference between the normal shader and the backsplashed one… what I should I be tweaking?