All Mohaa windows have bad shader files!

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

All Mohaa windows have bad shader files!

Post by tltrude »

I made a test map and put every see-through window I could find in it ( and the broken version of each). Everyone of them gave errors like this:

WARNING: shader 'textures/general_structure/window725_broken' has opaque maps defined after stage 0!!!
WARNING: shader 'textures/general_structure/window725_broken' has depthmask enabled after stage 0!!!
WARNING: shader 'textures/general_structure/window725_frame' has opaque maps defined after stage 0!!!
WARNING: shader 'textures/general_structure/window725_frame' has depthmask enabled after stage 0!!!


When I look over the shader files, they all looked alike. The windows above are the ones I want to use and, other than the errors in the console, they both seem to work fine.

Does anyone have a no-error shader for a frame/broken window?

Image
Last edited by tltrude on Sat Oct 04, 2003 6:06 am, edited 3 times in total.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

That's right most window textures have bad shaders, that's why they often don't render well on older vid cards :(
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

jv_map wrote:That's right most window textures have bad shaders, that's why they often don't render well on older vid cards :(
So... how does one of these bad shaders look? Or rather, what exactly is wrong with them and how can they be fixed?
Admin .MAP Forums
Image
Head above heels.
User avatar
small_sumo
Lieutenant General
Posts: 953
Joined: Mon Jul 01, 2002 4:17 pm
Contact:

Post by small_sumo »

Pm balr14 at tmt he is a shader specialist.

:)
Image

www.smallsumo.tk

Yeah Truth above Honor Man ;)
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Here's a common window shader:

Code: Select all

textures/general_structure/window725_broken
{
	qer_editorimage textures/general_structure/window725_frame.tga
	qer_keyword broken
	qer_keyword window
	qer_keyword glass
	surfaceparm fence
	surfaceparm wood
	{
		map textures/mohcommon/envnormndy_day.tga
		tcgen environment
		alphagen const .2
		blendFunc blend
		alphaFunc GT0
	nextbundle
		map textures/general_structure/window725_broken.tga
	}
	{
		map textures/general_structure/window725_frame.tga
		blendFunc blend
		depthWrite
	nextbundle
		map $lightmap
	}
} 
I think this error:

WARNING: shader 'textures/general_structure/window725_broken' has opaque maps defined after stage 0!!!

is caused by this line:

map textures/general_structure/window725_frame.tga

and this one:

WARNING: shader 'textures/general_structure/window725_broken' has depthmask enabled after stage 0!!!

by this:

depthWrite

Not sure how to fix it though. Actually I think the _broken and _frame texture should have been made into one texture manually, rather than blending both in game. Not only would this result in a significantly simplified shader, it would also reduce the amount of texels per window (and thus reduce mtex count).

Moreover I think depthWrite should only be used in the first stage, all subsequent stages should use depthFunc equal instead.

Something that surprises me is that the last stage does include a map $lightmap but not a rgbIdentity command. Generally these are used in conjunction with each other.
Shader manual wrote:5.12.4 rgbGen identity

Colors are assumed to be all white (1.0,1.0,1.0). With the addition of the over-bright ?sunlight? emitted from the sky textures, rgbGen identity must be included in all textures with a lightmap.
The alphaFunc GT0 command seems a bit out of place in the environment map stage. I think it should have been placed below the nextbundle command to only affect the broken texture map.

Concludingly I can only admit I really don't know how this shader should have been written properly. :oops:

I'll give it a try though, maybe something like this:

Code: Select all

textures/general_structure/window725_broken
{
	qer_editorimage textures/general_structure/window725_frame.tga
	qer_keyword broken
	qer_keyword window
	qer_keyword glass
	surfaceparm fence
	surfaceparm wood
	{
		map textures/mohcommon/envnormndy_day.tga
		tcgen environment
		alphagen const .2
		blendFunc blend
	nextbundle
		map textures/general_structure/window725_broken.tga
		alphaFunc GT0
	nextbundle
		map textures/general_structure/window725_frame.tga
		alphaFunc GT0
		depthWrite
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc filter
	}
} 
However I really don't have any idea whether this will work at all, let alone whether it'll be 'better' than the original shader.
Image
Random
Moderator
Posts: 401
Joined: Sun Jun 01, 2003 11:00 pm

Post by Random »

jv_map wrote: Not sure how to fix it though. Actually I think the _broken and _frame texture should have been made into one texture manually, rather than blending both in game. Not only would this result in a significantly simplified shader, it would also reduce the amount of texels per window (and thus reduce mtex count).
WOuld you happen to be refering to this: targetShader"Name" and targetShader"NewName". I was reading up on it in the shader bible recently because im trying to understand more about something i posted earlier.
Moderator
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Random wrote:WOuld you happen to be refering to this: targetShader"Name" and targetShader"NewName".
Honestly I have no idea what you are refering to :? but in fact I meant the textures should have been made into one texture with a paint program (like Photoshop), instead of mixing both textures at run-time.
Image
Random
Moderator
Posts: 401
Joined: Sun Jun 01, 2003 11:00 pm

Post by Random »

http://qeradiant.com/manual/Q3AShader_M ... /appA.html

From the Shader Bible. I thought since this texture was going to be applied to an entity that somehow it applied.

Most everything else you said makes sence after reading through the manual. Lots if nifty useful info in there especially since i am trying to expand my understanding of the things that can be done through shaders alone. A must read for everyone.


Shader Manual
Moderator
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Hmm interesting, this seems like a(nother?) way to control shaders via script. :)

It has nothing to do with this window texture though :wink:
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Stages

Post by tltrude »

I too have been re-reading the shader bible. It is not too clear on "stages", but isn't a stage defined by the blending. I think the terms that look like this are what it is missing.

GL_ZERO
GL_ONE_MINUS_SRC_ALPHA

As I remember the one word blenfunctions are short cuts for lines that use the above terms. So, i guess we need to find out what "blendFunc blend" is short for.

I made a colored glass shader, and it doesn't have any console errors. However it is only a pane of blue glass with no frame. I don't have a broken version of it either.

Code: Select all

textures/custom/tblueglass
{
	qer_editorimage textures/custom/tblueglass.tga
	qer_keyword window
	qer_keyword glass
	qer_trans .95
	surfaceparm glass
	cull none
	{
		map textures/mohcommon/environ_puddle.tga
		tcgen environment
		alphagen const .4
		blendFunc blend
	}
	{
		map textures/custom/tblueglass.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
	}
	{
		map $lightmap
		rgbGen Identity
		blendFunc GL_DST_COLOR GL_ZERO
	}
}

You can see the glass in this screenshot:

Image
Tom Trude,

Image
Random
Moderator
Posts: 401
Joined: Sun Jun 01, 2003 11:00 pm

Post by Random »

6.2.1.3 blendfunc blend
Shorthand for blendfunc gl_src_alphagl_one_minus_src_alpha. This is conventional transparency, where part of the background is mixed with part of the texture.
What i have noticed in some shaders it is that it is actually written as such:
blendfunc gl_one_minus_src_alpha gl_src_alpha. Here is an example but they comment out the short hand and write it in again the long way. hmm

Code: Select all

textures/misc_outside/riversf
{
	qer_editorimage textures/misc_outside/ocean2.tga
	qer_keyword natural
	qer_keyword liquid
	qer_keyword ocean
	qer_trans .4
	surfaceparm trans
	surfaceparm water
		surfaceparm nolightmap
	cull none
	deformvertexes wave 30 sin 0 5 0 .2
	{
		map textures/misc_outside/froth.tga
		blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA
//        blendfunc blend   //wonder why they comment this out and use long hand too?
//		alphaGen lightingSpecular
		tcMod scroll .0 0.15
//		tcMod scale 2.50 2.50
Cool part is that they throw in some good definitions as well.
Moderator
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

blendFunc GL_ONE_MINUS_SRC_ALPHA GL_SRC_ALPHA

I think they invert the alpha channel here. Again it would have been easier to modify the image rather than changing the shader...

Anyway tltrude that really is a good looking glass 8-) I think that's the way it has to be made, with just one actual texture stage. To me yours seems much better than the mohaa shaders :)
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

black

Post by tltrude »

Well, I tried using my blue glass shader for window725_frame and it came out looking like black (smokey) glass that is hard to see through. The frame part of the window was dark as well. My blue glass is like that too (dark blue not black), and I have to uses nodraw on one side to use it. Even with the nodraw, it is hard to see through without a light on the other side.

Random - Looks like they reversed the order in the long hand version of the blend--for that water shader.

jv_map - I tried your window725_broken shader and the textures are not being drawn at all. I get that white and yellow flashy border.
Tom Trude,

Image
Post Reply