Skip to content

Conversation

tederis
Copy link
Member

@tederis tederis commented May 25, 2024

This PR is aiming to fix a series of problems related to the purity of color of 3D lines and primitives(see #3399 and the discussion below #3321). It adds a new argument "stage" that can hold three values: "prefx", "postfx" and "postgui".

The syntax:

bool dxDrawLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ [, int color = 0xFFFFFFFF, float width = 1.0, bool postGUI = false / string stage = "prefx,postfx,postgui" ] )
bool dxDrawMaterialLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, [ bool flipUV = false, ] element material, float width, [ int color = white, [ bool postGUI = false / string stage = "prefx,postfx,postgui", ] float faceTowardX, float faceTowardY, float faceTowardZ ] )
bool dxDrawMaterialSectionLine3D ( float startX, float startY, float startZ, float endX, float endY, float endZ, float u, float v, float usize, float vsize, [ bool flipUV = false, ] element material, float width, [ int color = white, [ bool postGUI = false / string stage = "prefx,postfx,postgui", ] float faceTowardX, float faceTowardY, float faceTowardZ ] )
bool dxDrawMaterialPrimitive3D ( primitiveType pType, mixed material, bool postGUI / string stage = "prefx,postfx,postgui", table vertex1 [, table vertex2, ...] )
bool dxDrawPrimitive3D ( string primitiveType, bool postGUI / string stage = "prefx,postfx,postgui", table vertex1, table vertex2, table vertex3 [, table vertex4, ...] )

To make colors correct out of the box the stage "postfx" is used by default. For the sake of backward compatibility the "postGUI" argument was preserved.

The meaning of render stages:

  • prefx - Primitives are renderer before the color correction which leads to distorted primitive's colors. This render stage was known as postGUI = false.
  • postfx - Primitives are renderer after the color correction. This is a new render stage that should be used in most situations as it fixes the colors distortion.
  • postgui - Primitives are rendered after GUI. This render stage was known as postGUI = true.

Colors

The color that is used for these primitives: #4199d7.

@tederis tederis added enhancement New feature or request bugfix Solution to a bug of any kind labels May 25, 2024
Copy link
Member

@Nico8340 Nico8340 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 🎉

@Dutchman101 Dutchman101 merged commit 8414476 into multitheftauto:master May 25, 2024
MTABot pushed a commit that referenced this pull request May 25, 2024
@tederis tederis mentioned this pull request May 25, 2024
@TheNormalnij TheNormalnij added this to the 1.6.1 milestone May 25, 2024
@Xenius97
Copy link
Contributor

Xenius97 commented May 29, 2024

Something went wrong @tederis

If there is a 3D Material nearby, some dx images will be change to material's color.

https://streamable.com/fi91g1

@Xenius97
Copy link
Contributor

@tederis
Copy link
Member Author

tederis commented May 29, 2024

@Xenius97 Thanks for the report. I'll look into it.

@tederis
Copy link
Member Author

tederis commented May 29, 2024

@Xenius97 Thanks for the report. I'll look into it.

The fix: #3412

botder pushed a commit that referenced this pull request May 29, 2024
Fixes issue reported in comment: #3402 (comment)
MegadreamsBE pushed a commit to MegadreamsBE/mtasa-blue that referenced this pull request Jun 6, 2024
MegadreamsBE pushed a commit to MegadreamsBE/mtasa-blue that referenced this pull request Jun 6, 2024
@tederis tederis deleted the render_stages branch September 11, 2024 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Solution to a bug of any kind enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants