Welcome on MasterOf13FPS! MasterOf13FPS

Register today or sign up if you are already a member and never miss any cool content again :)

OutlineESP - enlarge Entity for stencil rendering

bootsec

New member
Joined
Jan 18, 2023
Messages
1
Reaction score
0
Points
0
Hello guys,

as it says in the title, I need a better way to render entity outlines in my OutlineESP. The algorithm I'm using right now can be found here (-> Object outlining).
The idea itself is pretty simple and it almost works for me: render the model normally, update the stencil buffer in the process and render it again scaled upwards but this time only where the defined stencil test passes.

To scale the model up for the second pass, I first tried the glScale methods which lead to unsymmetrical outlines (thick outline at the head,
barely any outline when looking sideways on the entity's torso).
Right now I'm using glPolygonMode with GL_LINE and a relatively thick line width to render a wireframe version which kind of "bleeds out" of the normal entity bounds.
It looks good (for my purposes :D) on plain models, but leads to glitches as soon as there are layers involved, especially held items. See attached file.

Is there another, more preferred way to "enlarge" the whole model as-is, including all layers and their edges?
Some ideas I could look into would be appreciated.

Cheers!
 

Attachments

  • Screenshot 2023-01-18 164144.png
    Screenshot 2023-01-18 164144.png
    89.7 KB · Views: 26
Hey there,
sadly without any code I can’t really help you but I have a suggestion for you: Instead of trying to use a stencil buffer you should look into shaders. The process is actually pretty easy and performance wise there shouldn’t be any difference (Depending on the implementation of course).

For rendering shaders you should take a look at the minecraft source code.

Here is a quick explanation what you have to do:
  1. Create a new framebuffer (If you don‘t know what a framebuffer is, take a look at the tutorial you referenced. It contains an easy to understand explanation)
  2. If the framebuffer is not yet initialized, initialize the framebuffer using the screen width and height
  3. Clear and bind your own framebuffer
  4. Render the entity onto the framebuffer
  5. Unbind your own framebuffer
  6. Bind the mc framebuffer
Now, how would you outline the entity?
A good approach would be to use an edge detection algorithm like a sobel operator.

The naive approach would be to check for every pixel that has an alpha = 0 and check the next/previous N pixel (N would be your outline size) if their alpha > 0. If there is any pixel that met the condition then return your esp color. Else return any value with an alpha of 0.
Do this for both the x- and the y-Axis.
The result should be an outline.

Now you have to actually use and render the framebuffer.
  1. Enable your shader
  2. Upload every uniform
  3. Render your framebuffer
  4. Disable your shader
That’s basically it.

Here are some cool ideas to enhance the esp:
  • The farther the pixel is away from the player the less the opacity should be (Will result in a „glow“)
  • Blur the outline by using a gaussian filter (slower)
  • Blur the outline by using a kawase filter (faster)
  • Return the actual pixel color if the alpha > 0. This will result in a chams (you could theoretically even „tint“ the entity by messing around with the colors)
  • Add a dark outline with lower opacity to the outline. This should theoretically result in a „shadow“ (Might look interesting)
  • Try to render chests, items, projectiles and blocks. As long as you render these onto your framebuffer, they will be outlined.
  • Try to play around with the display width and height in your Framebuffer. This will change the quality of the outline (A lower resolution will result in a more pixelated look. A higher resoltuon will super sample the framebuffer)
I hope this helps! In my opinion shaders are the best solution for outline esps.

BTW:
There might be issues with the shadows, nametags and perhaps the glint of enchanted items. The easiest way to fix this is by just not rendering these onto the framebuffer.

Hopefully this inspired you (or even others that come across this post) to take a look at shaders

EDIT 1:
To improve the performance of your shader you should try to avoid branching.
Instead of bloating one single shader with uniforms you should try to „group“ every uniform and create a different shader for every group.
 
Last edited:
Hey there,
sadly without any code I can’t really help you but I have a suggestion for you: Instead of trying to use a stencil buffer you should look into shaders. The process is actually pretty easy and performance wise there shouldn’t be any difference (Depending on the implementation of course).

For rendering shaders you should take a look at the minecraft source code.

Here is a quick explanation what you have to do:
  1. Create a new framebuffer (If you don‘t know what a framebuffer is, take a look at the tutorial you referenced. It contains an easy to understand explanation)
  2. If the framebuffer is not yet initialized, initialize the framebuffer using the screen width and height
  3. Clear and bind your own framebuffer and unbind the minecraft framebuffer
  4. Render the entity onto the framebuffer
  5. Unbind your own framebuffer
  6. Bind the mc framebuffer
Now, how would you outline the entity?
A good approach would be to use an edge detection algorithm like a sobel operator.

The naive approach would be to check for every pixel that has an alpha = 0 and check the next/previous N pixel (N would be your outline size) if their alpha > 0. If there is any pixel that met the condition then return your esp color. Else return any value with an alpha of 0.
Do this for both the x- and the y-Axis.
The result should be an outline.

Now you have to actually use and render the framebuffer.
  1. Enable your shader
  2. Upload every uniform
  3. Render your framebuffer
  4. Disable your shader
That’s basically it.

Here are some cool ideas to enhance the esp:
  • The farther the pixel is away from the player the less the opacity should be (Will result in a „glow“)
  • Blur the outline by using a gaussian filter (slower)
  • Blur the outline by using a kawase filter (faster)
  • Return the actual pixel color if the alpha > 0. This will result in a chams (you could theoretically even „tint“ the entity by messing around with the colors)
  • Add a dark outline with lower opacity to the outline. This should theoretically result in a „shadow“ (Might look interesting)
  • Try to render chests, items, projectiles and blocks. As long as you render these onto your framebuffer, they will be outlined.
  • Try to play around with the display width and height in your Framebuffer. This will change the quality of the outline (A lower resolution will result in a more pixelated look. A higher resoltuon will super sample the framebuffer)
I hope this helps! In my opinion shaders are the best solution for outline esps.

BTW:
There might be issues with the shadows, nametags and perhaps the glint of enchanted items. The easiest way to fix this is by just not rendering these onto the framebuffer.

Hopefully this inspired you (or even others that come across this post) to take a look at shaders
to fix the nametags and entity shadow issue go under your gamesettings.
if you use 1.8.8 there is a boolean called render_Nametags & render_entityShadow
before you render your Outline/Shader just make:
render_Nametags && render_entityShadow = false
after renderring put it to true

should look like this
mc.gamesettings.renderEntityShadow = false;
mc.gamesettings.renderNameTags = false;
/** do your shit */
mc.gamesettings.renderEntityShadow = true;
mc.gamesettings.renderNameTags = true;
 
shape1
shape2
shape3
shape4
shape5
shape6
Back
Top