Quake3World.com Forums
     Level Editing & Modeling
        blendFunc blend surfaces and z-indexing


Post new topicReply to topic
Login | Profile | | FAQ | Search | IRC




Print view Previous topic | Next topic 
Topic Starter Topic: blendFunc blend surfaces and z-indexing

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44136
PostPosted: 06-27-2015 05:32 AM           Profile   Send private message  E-mail  Edit post Reply with quote


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?




Top
                 

The Afflicted
The Afflicted
Joined: 14 Oct 2001
Posts: 581
PostPosted: 06-27-2015 05:37 AM           Profile Send private message  E-mail  Edit post Reply with quote


That's 'sort' *value*, right?




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44136
PostPosted: 06-27-2015 06:10 AM           Profile   Send private message  E-mail  Edit post Reply with quote


ahhh yes thanks, that works




Top
                 

Insane Quaker
Insane Quaker
Joined: 06 Nov 2011
Posts: 250
PostPosted: 06-27-2015 11:44 AM           Profile Send private message  E-mail  Edit post Reply with quote


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.




Top
                 

Cool #9
Cool #9
Joined: 01 Dec 2000
Posts: 44136
PostPosted: 06-28-2015 12:28 AM           Profile   Send private message  E-mail  Edit post Reply with quote


I have the advantage the brushes are always viewed from the same angle, so their physical ordering is always the same.




Top
                 

I'm the dude!
I'm the dude!
Joined: 04 Feb 2002
Posts: 12498
PostPosted: 06-29-2015 08:59 AM           Profile Send private message  E-mail  Edit post Reply with quote


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.



_________________
GtkRadiant | Q3Map2 | Shader Manual


Top
                 
Quake3World.com | Forum Index | Level Editing & Modeling


Post new topic Reply to topic


cron
Quake3World.com
© ZeniMax. Zenimax, QUAKE III ARENA, Id Software and associated trademarks are trademarks of the ZeniMax group of companies. All rights reserved.
This is an unofficial fan website without any affiliation with or endorsement by ZeniMax.
All views and opinions expressed are those of the author.