Urban Terror Forums: Shaders and transparency - Urban Terror Forums

Jump to content

 Login | Register 
Advertisement
  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Shaders and transparency Rate Topic: -----

#1 User is offline   Kolossus Icon

  • Account: kolossus
  • Joined: 28-September 10
  • Posts: 386

Posted 30 May 2014 - 10:47 AM

I've searched and tried different shaders but I can't really make this thing transparent. Basically I created a texture, a grid, I added an alpha channel, saved it as 32 bit, but I think I am missing something.

I made the background black but when I see examples in other forums, they have an alpha mask layer, which I haven't done. Is that it?

Also I'm a total noob when it comes to the shader writing and I have no idea what does what. :| Help.

#2 User is offline   rayne2 Icon

  • Account: rayne2
  • Joined: 17-May 13
  • Posts: 102

Posted 30 May 2014 - 12:50 PM

Well if you saw them do it why didn't you do it too?

Yes alpha channel is the main component. Your black background is supposed to be in the alpha channel serving as a filter. It will block out everything except the grid itself.

Alpha channel controls opacity. Black means opacity 0%, white is opacity 100%.

#3 User is offline   Kolossus Icon

  • Account: kolossus
  • Joined: 28-September 10
  • Posts: 386

Posted 30 May 2014 - 01:39 PM

View Postrayne2, on 30 May 2014 - 12:50 PM, said:

Well if you saw them do it why didn't you do it too?

Yes alpha channel is the main component. Your black background is supposed to be in the alpha channel serving as a filter. It will block out everything except the grid itself.

Alpha channel controls opacity. Black means opacity 0%, white is opacity 100%.


I just noticed it. And to be honest, I'm not sure how to do it. I'll check some tutorials, but the hardest part for me is the shader. :P

#4 User is offline   rayne2 Icon

  • Account: rayne2
  • Joined: 17-May 13
  • Posts: 102

Posted 30 May 2014 - 02:08 PM

Shader is easy, there's tons of them all around.

The alpha channel is even easier. Just create a selection of what you want to be masked out and hit the new channel button in the channels tab.
Whatever is selected will be white. So either you select parts you want to be visible and create a new channel or select parts you want invisible, create a new channel and then invert it.

#5 User is offline   Kolossus Icon

  • Account: kolossus
  • Joined: 28-September 10
  • Posts: 386

Posted 30 May 2014 - 03:10 PM

I think I'm almost done, and the shader works because the command cull none works, but the transparency doesn't.

This is what I have:

{
	map textures/folder1/texture1.tga
       	blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
	alphaFunc GT128
	depthWrite
	rgbGen identity
}


I copied it from another shader, I also tried changing values but nothing happens. Or at least, nothing noticeable. :D

This post has been edited by Kolossus: 30 May 2014 - 03:12 PM


bullet_loaderAdvertisement

#6 User is offline   rayne2 Icon

  • Account: rayne2
  • Joined: 17-May 13
  • Posts: 102

Posted 30 May 2014 - 03:23 PM

The shader is incomplete.

Try this one

textures/vietnam_plants/monstera
{

qer_editorimage textures/vietnam_plants/monstera.tga
surfaceparm alphashadow
surfaceparm nolightmap
surfaceparm nonsolid
surfaceparm nomarks
cull none
//deformVertexes wave 150 sin 0 .3 0 .1
{


map textures/vietnam_plants/monstera.tga
blendFunc GL_ONE GL_ZERO
alphaFunc GE128
depthWrite
rgbGen identity

}

}


I think this one should work. I used it a long time ago for some plants.

This post has been edited by rayne2: 30 May 2014 - 03:26 PM


#7 User is offline   Kolossus Icon

  • Account: kolossus
  • Joined: 28-September 10
  • Posts: 386

Posted 30 May 2014 - 03:41 PM

This was the complete shader I was using:

textures/base_floor/pjgrate1
{
	surfaceparm metalsteps
	cull none

	// A GRATE OR GRILL THAT CAN BE SEEN FROM BOTH SIDES
	{
		map textures/base_floor/pjgrate1.tga
		blendFunc GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA
		alphaFunc GT0
		depthWrite
		rgbGen identity
	}
	{
		map $lightmap
		rgbGen identity
		blendFunc GL_DST_COLOR GL_ZERO
		depthFunc equal
	}
}


Changing the paths obviously.

#8 User is offline   Kolossus Icon

  • Account: kolossus
  • Joined: 28-September 10
  • Posts: 386

Posted 30 May 2014 - 04:20 PM

I used yours and in Radiant it still appears black, but in game it works. Maybe it's the same for the one I was using?

I was convinced it would show the transparency in radiant too (I was using that as a way to check if it was working).

#9 User is offline   NulL Icon

  •   former FS member   
    Level Designer
  • Account: null
  • Country:
  • Joined: 28-April 09
  • Posts: 2,606

Posted 30 May 2014 - 08:28 PM

View PostKolossus, on 30 May 2014 - 04:20 PM, said:

I was convinced it would show the transparency in radiant too (I was using that as a way to check if it was working).


Try qer_alphafunc, it only works in some versions of radiant though. See here:

http://q3map2.robotr...directives.html

#10 User is offline   ottone Icon

  • Account: ottone
  • Main tag: =IvN=
  • Country:
  • Joined: 26-December 10
  • Posts: 63

Posted 30 May 2014 - 08:36 PM

qer_alphafunc gequal .5

this is the shader that i use for transparency:

textures/arnoville/Various0712ext
{
qer_editorimage textures/arnoville/Various0712.tga
qer_alphafunc gequal .5
surfaceparm alphashadow
nomipmaps
nopicmip
polygonoffset
cull none
{
map textures/arnoville/Various0712.tga
alphafunc GE128
depthwrite
}
{
map $lightmap
blendfunc filter
depthfunc equal
rgbGen identity
}
}

ops mr.Null already answered XD

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

Advertisement


Copyright © 1999-2024 Frozensand Games Limited  |  All rights reserved  |  Urban Terror™ and FrozenSand™ are trademarks of Frozensand Games Limited

Frozensand Games is a Limited company registered in England and Wales. Company Reg No: 10343942