[Tutorial] How to render custom overlays [World Renderer]

Started by sumeshi0216 on

Topic category: User side tutorials

Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] How to render custom overlays [World Renderer]
Sat, 08/17/2024 - 02:03 (edited)

The event trigger "Graphics - Render overlays" allows you to render custom overlays.

 

In order to render overlays, you will need to set render targets and, if necessary, run them on the world as follows.

There are these procedures in the list "Overlay."

 


 

Render Target

To render overlays, you will need to use the procedure "Overlay - Set render target" and set a target.

Objects need to be rendered within the statement; otherwise nothing will be rendered.

  • ALWAYS: It can always render objects.
  • GAME: It can render objects just like GUIs such as health/food gauges. These may be displayed behind some GUIs.
  • GUI: It can render objects on GUIs such as a crafting table or a furnace.

 


 

Run on the World

To render items or entities, need to do it on the world using this procedure.

Within the statement, the procedure provides you with these dependencies.

 

Dependencies

  • entity: it's the camera entity.
  • dimension: It's the dimension that the camera entity is in.
  • x/y/z: It's the position of the camera entity.
  • world: It's the client world.

 


 

Coordinate Definition

World Renderer defines coordinates for overlays as follows.

The top left of the screen is the origin: (x, y) = (0.0, 0.0).

 

 


 

Render shapes

To render shapes like triangles, quads, etc., first, you will need to create and return a shape on the event trigger "Graphics - Render shapes."

See the guide for shapes

 

Next, call the procedure and get the shape, and then render it. You can also use shape variables as follows.

If necessary, set a texture. Here is the guide for textures.

Edited by sumeshi0216 on Sat, 08/17/2024 - 02:03