Making a circle decal on ground

Hey all,
I was wondering how one could to make a circle decal grtound(like circles around units/characters on the ground).
I’ve read about the DecalEffect, but I don’t know if this is the right way to go as it’s made for GeomNodes, which are 3d objects, and I would make texture decal.
What would you suggest? Could you give me some pointers on how to use the DecalEffect right?

You could use projected textures on the ground
panda3d.org/manual/index.php … d_Textures

But if you have shader generator enabled on the ground, then tough luck… theres a bug.

Some games simply use a ring textured with semitransparent image. The texture or ring can optionally rotate to give it nicer look.

Though if you post an example screenshot, I might know better how exactly you want it to look like

One noob question on the texture approach(I think that might be sufficient):
Would I have to create an big empty(alpha cutout) texture with only the circle on it for the whole ground or is there any way to limit a small texture to only those view u,v coordinates that are at the vertices I want to appear the circle at?

Just try it.
It works like this,
you use an image like this

this is how it ends up

Simple.

This effect can also be used for fake shadows.
But once again you cant use this with grounds with shadergenerator.

dirt-cheap alternative sollution, reparent a square-geometry with the transparent circle texture to your node. works ok in most cases but has some issues with very sloopy terrain.

First all: Thank you for your answers. :slight_smile:
One additional question on the Projected Textures:
How can I find a corresponding NodePath to the base.camLens?

EDIT:
There is one big problem I encountered with the projected textures: You cannot project the texture on an aribtrary point on a model. What I want is to project a texture on a certain point on ground e.g. where my unit is standing.
Is there any possible way to achieve that with projected textures?

Yes, you just need to position your projector above the point in space where your unit is standing. For instance, you could parent the projector directly to the unit.

David

I got this working now, but there is one big problem:
If I had an extra TexProjector for every unit, I would need an extra TextureStage for every unit, which is not possible.

Yep. That’s the big problem with projected textures.

If you need to show many rings at the same time, you’ll probably have to find a different approach, such as a card placed to be just above the ground.

David

Oh…
Is this because how OpenGL and DirectX work?

It’s because of how the graphics hardware works. To layer up multiple textures onto the same geometry requires specialized pipelines built into the card, one pipeline for each texture. Graphics cards only have so many pipelines.

You can also avoid this limitation by writing a shader (or using the shader generator), which doesn’t have a hard limit on the number of unique TextureStages. But each one you add will make the entire ground plane draw a little bit more slowly, so there’s still a practical limit to the number of different textures you can layer together.

There are other workarounds, of course, generally involving subdividing the terrain into different pieces, so you don’t have to apply each ring to the entire terrain. Then your limit is only on the number of rings for each piece.

David

Oh,
is it possible to avoid with a custom shader?

Anyway, SiWi if I were you, after all the info I got from this topic, I would simply load a model and make it render in front of the terrain, always. Unless you have very uneven terrain, or very distant camera, you wont have problems. Otherwise I have no idea.
For buildings and such, you can just have them as separate geom and not change their render order.

Hmm, so I’m probably gonna stick to the approach Anon suggested.

One idea I have on the other one: If I set auto vertex generation to MWorld Position, wouldn’t it be sufficient to find the closest vertex of the terrain for every unit and draw an circle around the uv of the vertex on a big texture.
The I could simply apply that texture to my ground and that would be enough?
Thing is that I don’t know how to find such an closest vertex? (Are there any built in functions? Is this coming at an forbiding cost?)

Yes, painting circles into a big texture would be another approach. You don’t need to locate specific vertices, since UV values are continuous across the surface and are not tied to specific vertices. So if your terrain is small enough that you can apply one big texture across the entire terrain with enough detail to support your rings, all you need to do is draw a ring on the texture at the pixels that correspond with your object’s 3-d position.

David

I have tried both shader-based and geometry-based approaches, both on uneven terrain :

[how to make these kind shodow?)