I've got a problem with two brushes that are textures with nodraw, but a single surface is textured with a TGA texture that has a shader that applies a blendFunc blend on it. These two brushes are positioned behind each other. However, for some reason, the texture of the brush that is farthest away to the player is rendered on top of the other, which obviously is not what I want. The goal is to create 2D grass with a 2D tree behind it.
Is there a solution to this problem or is it something I'm going to have to work around?
blendFunc blend surfaces and z-indexing
Re: blendFunc blend surfaces and z-indexing
That's 'sort' *value*, right?
Re: blendFunc blend surfaces and z-indexing
ahhh yes thanks, that works
-
- Posts: 252
- Joined: Sun Nov 06, 2011 11:11 pm
Re: blendFunc blend surfaces and z-indexing
Sort won't really work for every scenario though, will it? As soon as you switch the positions of the two sorted items, the reverse problem will occur. As well, if you have a bunch of surfaces with the same shader on them, they will overlap each-other in odd ways (for example, leaf blocks in Minecraft maps).
One solution is to not use blendFunc, but instead alphaFunc GE128, which will turn all the pixels into on/off, so semi-transparent pixels don't work here. Another way that seems to work for me is to use depthWrite, but it can cause other conflicts in other situations.
Maybe sort does solve these problems somehow, but it's never worked properly for me, and I don't know why.
One solution is to not use blendFunc, but instead alphaFunc GE128, which will turn all the pixels into on/off, so semi-transparent pixels don't work here. Another way that seems to work for me is to use depthWrite, but it can cause other conflicts in other situations.
Maybe sort does solve these problems somehow, but it's never worked properly for me, and I don't know why.
Re: blendFunc blend surfaces and z-indexing
I have the advantage the brushes are always viewed from the same angle, so their physical ordering is always the same.
Re: blendFunc blend surfaces and z-indexing
If it's for a sprite or grate, etc. you probably want do to depth testing...
http://q3map2.robotrenegade.com/docs/sh ... #depthFunc
Check out some stock Q3 shaders for examples.
http://q3map2.robotrenegade.com/docs/sh ... #depthFunc
Check out some stock Q3 shaders for examples.
[size=85][url=http://gtkradiant.com]GtkRadiant[/url] | [url=http://q3map2.robotrenegade.com]Q3Map2[/url] | [url=http://q3map2.robotrenegade.com/docs/shader_manual/]Shader Manual[/url][/size]