Stencil Like Shader?
Started by Baker
avatar
Baker Rep. 0
#1   19 Jul 2023
Is it possible to create a stencil like shader?
I want a translucent brush to only draw where it intersects a surface.
My thought experiment is that I have a circle that shrinks (battle royale style, shrinking player area). I create a hollow sphere and where it touches a surface it draws.
My thought is someone here would probably know if this is possible or impossible.
I'm not actually using Quake3 but DarkPlaces / Xonotic and I've been putting in the work and the code to support some exotic mapping ideas.
www.moddb.com/mods...pping-resources (and this is actually a released thing www.moddb.com/mods...er-demo-release .. version 1 was released a month ago)
And this battle royale shader idea came to mind today.
avatar
Tig Rep. 2292
#2   20 Jul 2023
@Baker - I have no idea what your code can and can not do, I'm also not completely sure if my definition of a stencil is the same as yours, but yes, you make a stencil like shader.

Now, what exactly do you mean by stencil like :)

If you mean semi-transparent - yes, Q3A has windows in the base game you can use as start point.

If you mean something more like cel shading (cartoon), yes, you can do that as well. For a few examples, see:

If you mean something else, there is a really good chance that you make that affect on a brush. The real question is going to be how are you going to implement this in your code.
avatar
Baker Rep. 0
#3   21 Jul 2023
Hey Tig, I guess what I mean by stencil is draw pass where the only part of the draw that occurs is a pass on exactly "depthFunc equal".
I have a couple of tests, I'll see how those go and post a link to a pic of the success or failure or partial success.
avatar
Baker Rep. 0
#4   21 Jul 2023
Here are 2 pics ... the idea is the circle shrinks. Which is what they have used in last man standing games for quite a while to shrink the circle so players can't camp forever (you die if outside circle).
media.moddb.com/im...ofile/circ2.jpg (Circle starts large ... would need to be far larger, actually)
media.moddb.com/im...ofile/circ1.jpg (Circle gets smaller)
I have various methods at my disposal to achieve some sort of functional result. I saw "depth" stuff in the shader docs and was wondering if there was a shader would achieve that, but upon reflection this is unlikely since the engine would need to do it, the map compiler can't.
Sorry if I rambled a bit, Tig. I'm trying to sort of what shaders can and can't be made to do.
Edited 5.62 minutes after the original posting.
avatar
Tig Rep. 2292
#5   21 Jul 2023
Shaders tell the engine how to render a surface. That is all they do. They are almost always linked to a texture, but they could just be coordinates in the 3D space.

An ever decreasing dome or cylinder is not something that already exists (as far as I know) in Q3A. That is something you will have to write yourself. What ever you come up with will also need to map the shader to that surface.

I would see if you can get a hold of the PainKeep Arena source code or check the Kamikaze code in Team Arena. Both might be a good starting point for what you want to do, just on a match larger scale.

avatar
Baker Rep. 0
#6   22 Jul 2023
I think everything going to be peachy, haha.
Battle Royale Walls Prototype 1:
media.moddb.com/im...file/royale.jpg
Edited 9.02 minutes after the original posting.
avatar
Baker Rep. 0
#7   28 Jul 2023
Just sharing an update of the Battle Royale effect.
At moddb, this image is attracting views like supercollider magnet.
media.moddb.com/im...file/royale.gif
avatar
Tig Rep. 2292
#8   28 Jul 2023
@Baker: That is looking really good and very promising. Well done.
avatar
Baker Rep. 0
#9   29 Jul 2023
Thanks, Tig :)

Only registered members can post a reply.
Already registered? Sign in.

lvl-pq-pack2
Clear