Flares visible through thin walls


(Paracyte) #1

I’ve been using ‘depthfunc disable’ in my flare shader for an EF single-player mod so it wouldn’t cut into the wall, but as a side effect, I’ve noticed that you can still see these flares through thin walls. If I increase the thickness of the walls, the flares are for some reason no-longer visible, but the problem with that is that this map is supposed to be based on the actual set of a tv show and making the walls any thicker would not only be inaccurate, but it would also make the hallway next to it too narrow to walk in (in a different area then you see in the screenshots).

So is it possible to block flares with ‘depthfunc disable’ without increasing the width of your brushes?

Tha actual shader:

textures/conference/cround_light
{
	surfaceparm nolightmap
	q3map_flare textures/ent_corridor/flare
	{
	map textures/conference/cround_light.tga
	blendFunc GL_ONE GL_ONE
	}
}
textures/ent_corridor/flare
{
	qer_editorimage textures/ent_corridor/flare.tga
	surfaceparm nolightmap
	deformVertexes autosprite
	{
	map textures/ent_corridor/flare.tga
	blendFunc gl_one gl_one_minus_src_color
	depthFunc disable
	}
}

Heres some images, showing the same wall from 2 different sides.


(ydnar) #2

Don’t use flares?


(Paracyte) #3

Yes I realize thats an option but I’d prefer to leave them in if it’s possible.


(ydnar) #4

depthFunc disable, if I read it correctly, prevents any z-buffer occlusion from happening at all.

Therefore no matter what you do, if the surfaces are visible in the PVS and in the view frustum, they will be visible through whatever walls you put between them and the camera.

Thereforce, do not use depthFunc disable. Try polygonOffset instead.


(Paracyte) #5

Well, thats what I initially thought untill I tested it out viewing the map w/ r_lockpvs 1. While the flares outside of the pvs didn’t appear when I used r_lockpvs 1 (as expected), the flares that were still in the pvs behaved exactly the same as they did before. They disappear behind surfaces that are further away from them but they are still visibile through surfaces that are close to them. I also re-compiled the map without vis so that the whole map would always be rendered just to make sure, and yet it was still blocked by the thicker walls. If depthfunc disable prevents ANY z-buffer occlusion from happening, then why are the flares still occluded if the surface is far enough away? Does depthfunc disable really just give the surface it’s applied to a higher place on the z-buffer than it would normally get, and if so, is this an adjustable distance? Or am I missing something?


(in this image, the map was compiled without vis and there are flares on the other side of both brushes.

I suppose I’ll have to go with your polygonOffset suggestion if I can’t figure this out, although it still doesn’t produce the same realistic flares that you get with depthfunc disable.