frosted glass...

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

frosted glass...

Post by G3mInI »

I am trying to duplicate the same effect you get when use jh_gtwindow1 from the central europe textures. When you use this window it compiles as a frosted glass, cant see through it. In the editor the window even has the frosted glass look. I made a custom texture just like jh_gtwindow1.tga in the textures folder. I do have the alpha channel. I also have duplicated the two shader statements needed in the central europe shader. Nowhere though can I find where the frosted glass look is coming from. Here are the two shader statements in the central europe shader file:

Code: Select all

textures/central_europe/jh_gtwindow1
{
	qer_keyword window
	qer_keyword glass
	surfaceparm trans
	nopicmip
	cull none
	{
		map textures/central_europe/jh_gtwindow1.tga
		blendfunc blend
		depthWrite
	nextbundle
		map $lightmap
	}
}

textures/central_europe/jh_gtwindow1
{
	qer_keyword window
	qer_keyword glass
	surfaceparm trans
	surfaceparm glass
	nopicmip
	cull none
	{
		map textures/central_europe/jh_gtwindow1.tga
		blendfunc blend
		depthWrite
	nextbundle
		map $lightmap
	}
}

When I duplicate this process and compile my window panes are filled with white. In the editor the panes do not look frosted there either. When I apply the texture I can see through the panes as if they were clear, just like when you apply the jh_gtwindow1 texture. However its editor image shows the frosted glass look. Mine has funny geometric shapes inside the panes which are white in color. How did they accomplish this frosted glass look for both in the editor and when it is compiled? The statement nextbundle in the shaders must have something to do with this. I have read extensively on the q3map shaders. It says that nextbundle statement is used for multiple images or to include the next image. The next image shader statement after the second jh_gtwindow1 statement is:

Code: Select all

textures/central_europe/earth_road_gen1bend
{
	qer_keyword terrain
	qer_keyword road
	qer_keyword dirt
	qer_keyword gravel
	surfaceparm dirt
	{
		clampmap textures/central_europe/earth_road_gen1bend.tga
		depthWrite
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc GL_DST_COLOR GL_ZERO
		depthFunc equal
	}
}
???? They cant be including this earth texture. But I cannot find where this frosted glass look is coming from.

My image is tga 32bit. It's nearly exact like the gtwindow.tga image, just a different pattern on the panes. I selected all the areas where the panes would be and chose 'save selection'. Named it layer 0 transparency.

Something else I noticed. When I opened the jh_gtwindow1.tga and loaded the selection, the areas selected are not the panes but the inverse of that. All the wood areas of the window were selected. I tried that too for mine and still looks the same, clear in the editor but when compiled the panes become solid white.

Can anyone help me out here?

By the way a great source of information for shaders besides the q3map shader handbook is this place:

http://www.ritualistic.com/games/ef2/gd ... anual.html

It tells you what nextbundle means. Q3map shader handbook speaks nothing of this statement.

This is what that page says about nextbundle:

Code: Select all

5.10 nextbundle

Used to define the next texture in a multi-texture operation. A map command should immediately follow this command. Any stage commands may follow except for blendFunc.

Example 16.: An example of a multi-texture shader

textures/techdemo/mtexwater1
{
	cull none
	surfaceparm nolightmap
	surfaceparm trans
	surfaceparm water
	qer_editorimage textures/liquids/blue_water1.tga
	qer_trans 0.500000
	{
		map $whiteimage
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphaGen oneMinusDot
		rgbGen constant 0.000000 0.250000 0.750000
	}
if mtex
	{
		map textures/liquids/blue_water1a.tga
		blendFunc GL_ONE GL_ONE
		tcMod scale 0.330000 0.330000
		tcMod turb 0.000000 0.200000 0.000000 0.100000
		nextbundle
		map textures/liquids/blue_water1b.tga
		tcMod scale 0.660000 0.660000
		tcMod scroll -0.050000 -0.030000
	}
endif
	{
		map textures/liquids/blue_water1a.tga
		blendFunc GL_SRC_ALPHA GL_ONE
		alphaGen lightingSpecular
		tcMod scroll 0.070000 -0.040000
	}
}
	  
Design Note: Currently OpenGL multi-texture only allows for the textures involved in the operation to be multiplied together. This is what will happen to the 2 textures before they are placed into the frame buffer with blendFunc.

Any help here appreciated,

G3mInI
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

I think you need to adjust the alpha channel .black areas will be blocked out and white areas will be transparent but shades of gray in areas will be only parlty seen through . How well you can see through them will be determined by how bright or dark they are . Shader are done in stages so you can even have a stage in it that is a differnt texture for example if the window's second stage had a totally tranparent area and the first texture used was a semi tranparent texture then the transparent parts of the second texture would be filled with the semi transparent texture .

This is actually a shader done for COD but the shaders in COD are the same as the ones for mohaa this texture is 4 stages 4 parts of a wall fan each stage has transparent areas except the first stage but it could have had if it was needed .

textures/rifle_range/fanblade2
{
qer_editorimage textures/rifle_range/fanblade2.tga

surfaceparm metal
//cull none
{
map textures/rifle_range/faninside.tga
blendfunc blend
}
{
map textures/rifle_range/fanblade2.tga
tcMod rotate 600
blendFunc blend
}
{
map textures/rifle_range/fanbox.dds
blendfunc blend
}
{
map textures/rifle_range/rusty_grate.dds
blendfunc blend
}
}
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

glass

Post by tltrude »

Here is one I made for blue colored glass.

Code: Select all

textures/custom/tglassblue
{
	qer_editorimage textures/custom/tglassblue.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/tglassblue.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
	}
	{
		map $lightmap
		rgbGen Identity
		blendFunc GL_DST_COLOR GL_ZERO
	}
}
This shader seems to work fine, but my blue glass is pretty dark without nodraw on the back of the brush. The way the glass looks depends a lot on the image and its alpha channel. If the glass is too dark, make the alpha layer a little darker. "environ_puddle.tga" is the reflection.

You can see this blue glass in my "door2" tutorial map--click on my signature logo. Also, I made a window using gtwindow1 for my "test_pointer" tutorial map, so you might want to look at that one too.
Tom Trude,

Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Hey thanks for the replies. It lead me to the solution I was looking for. You see I was always leaving the alpha absolute black in the transparent areas. It never even occured to me to add a little splatter of white and then use some Gaussian Blur to get the effect I needed. I was thinking that 'frosted' look was coming from another texture in the game. It wasnt. It was just the alpha channel having some smeared marks of white in the black.. Gotta love this place. Everyday I keep learning more and more.
A few members along with myself in Area51 are doing a White House Project. I am building the map, custom textures and all, and all the scripting. The others are doing the skins. So far they have made all the recent presidents, Monica :) and bunches of Secret Service Men. Theme is going to be Republicans against the Democrats. Should be pretty cool once its complete. The White House itself is going to be nearly to scale, with the exception of completely smoothed rounded edges. I obtained a floorplan and dimensions of the building plus a picture of every room on the inside. Even found a site that does a panoramic tour of the white house which lets you move 360 in every room on the 1st floor. The second floor and basement will be well... up to me I suppose but it should be cool. I'll let ya's all know when its complete. Will be obj to steal documents or something along those lines.

Peace,
G3mInI
Post Reply