Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

alphaTransparent and "draw_last" flag doesn't change anything! #3124

Open
1 task done
FileEX opened this issue Jul 21, 2023 · 19 comments
Open
1 task done

alphaTransparent and "draw_last" flag doesn't change anything! #3124

FileEX opened this issue Jul 21, 2023 · 19 comments
Labels
bug Something isn't working

Comments

@FileEX
Copy link
Contributor

FileEX commented Jul 21, 2023

Describe the bug

Setting the "DRAW_LAST" flag for the model still doesn't change anything and transparent models still don't show vehicles and other objects behind them.

alphaTranasparent is set to true in the engineReplaceModel function.

image

I think that flags still doesn't work correctly.

Steps to reproduce

Load the model with transparent materials

Version

Multi Theft Auto v1.6-release-21890

Additional context

No response

Relevant log output

No response

Security Policy

  • I have read and understood the Security Policy and this issue is not security related.
@FileEX FileEX added the bug Something isn't working label Jul 21, 2023
@TheNormalnij
Copy link
Contributor

Hi!
Can you provide WTR resource, please?

@FileEX
Copy link
Contributor Author

FileEX commented Jul 21, 2023

I sent the resource to you on discord

@PlatinMTA
Copy link
Contributor

PlatinMTA commented Jul 21, 2023

The flags do work, but they won't work for alphas that are too high in value.

diferencia alphas

Afaik this is the same bug that happens with the windshields but I'm unsure about that.

@FileEX
Copy link
Contributor Author

FileEX commented Jul 21, 2023

So what should be the maximum alpha value for the flag to work properly?

The flags do work, but they won't work for alphas that are too high in value.

diferencia alphas

Afaik this is the same bug that happens with the windshields but I'm unsure about that.

@PlatinMTA
Copy link
Contributor

So what should be the maximum alpha value for the flag to work properly?

No idea tbh. Probably 127 and lower (less than 50%).

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

So what should be the maximum alpha value for the flag to work properly?

No idea tbh. Probably 127 and lower (less than 50%).

Should be 100(or 140, depends on entity type). But probably better to use flag "no_zbuffer_write" for glass, in that case an alpha doesn't matter. But note that when alpha is less than beforementioned value the usage of flag "draw_last" loses its meaning because alpha testing takes the stage.

@Dujin9931
Copy link

100 is better to use in this case.

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

And yes, this flag can produce unexpected results in some conditions. It's the specifics of GTA:SA transparent objects sorting.

@FileEX
Copy link
Contributor Author

FileEX commented Jul 22, 2023

With "no_zbuffer_write" elements are visible through walls
image

@FileEX
Copy link
Contributor Author

FileEX commented Jul 22, 2023

This problem persists no matter what the alpha is set to. No matter if I set alpha to 140, 127, 100 it's still this bug and nothing changes. This bug appear when vehicle is so near to the glass, because when the vehicle/player is so far from the glass then everything looks fine.

image
image

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

With "no_zbuffer_write" elements are visible through walls image

Seems like an another bug.

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

Please, create a test resource and attach to the issue. It would be easier to help with it.

@FileEX
Copy link
Contributor Author

FileEX commented Jul 22, 2023

With "no_zbuffer_write" elements are visible through walls image

Seems like an another bug.

The "no_zbuffer_write" flag triggers when I get close to the window and the vehicle is not visible, then that vehicle is visible but is rendered later than the window with the "draw_last" flag. Look at this

Flag "draw_last" without flag "no_zbuffer_write" RESULT:
So far:
image
So near:
image

Flag "draw_last" with flag "no_zbuffer_write" RESULT:
So far:
image
So near:
image

Vehicle is rendered with no_zbuffer_write flag when dissapear without this flag

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

This problem persists no matter what the alpha is set to. No matter if I set alpha to 140, 127, 100 it's still this bug and nothing changes. This bug appear when vehicle is so near to the glass, because when the vehicle/player is so far from the glass then everything looks fine.

image image

This is an important comment about distance. Because it explains the where the bug comes from and how to solve it. I have a possible solution but without a test resource cannot check the correctness of it.

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

This problem persists no matter what the alpha is set to. No matter if I set alpha to 140, 127, 100 it's still this bug and nothing changes. This bug appear when vehicle is so near to the glass, because when the vehicle/player is so far from the glass then everything looks fine.
image image

This is an important comment about distance. Because it explains the where the bug comes from and how to solve it.

Did you still need a test resource?

Yes, it would be great. I have a possible solution but without a test resource cannot check the correctness of it.

@FileEX
Copy link
Contributor Author

FileEX commented Jul 22, 2023

This problem persists no matter what the alpha is set to. No matter if I set alpha to 140, 127, 100 it's still this bug and nothing changes. This bug appear when vehicle is so near to the glass, because when the vehicle/player is so far from the glass then everything looks fine.
image image

This is an important comment about distance. Because it explains the where the bug comes from and how to solve it.

Did you still need a test resource?

Yes, it would be great. I have a possible solution but without a test resource cannot check the correctness of it.

I send a test resource to your discord, cuz this model is private and i can't attach this here

@tederis
Copy link
Collaborator

tederis commented Jul 22, 2023

Okay, I just got the test resource. I have already responded in PM, but maybe it would be interested for someone else. This is not a bug actually, just a feature of GTA:SA renderer. The problem is quite common. Glass and other transparent objects must be a separate object. Without it glass isn't able to be sorted the correct way. Moreover, transparent objects must be separated so that a camera wouldn't be able to be positioned within the transparent object's bounding box.

@FileEX
Copy link
Contributor Author

FileEX commented Jul 24, 2023

Okay, I just got the test resource. I have already responded in PM, but maybe it would be interested for someone else. This is not a bug actually, just a feature of GTA:SA renderer. The problem is quite common. Glass and other transparent objects must be a separate object. Without it glass isn't able to be sorted the correct way. Moreover, transparent objects must be separated so that a camera wouldn't be able to be positioned within the transparent object's bounding box.

There is still bug with glass. Even with glass as separated object with alpha 100

image
image

@tederis
Copy link
Collaborator

tederis commented Jul 25, 2023

Okay, I just got the test resource. I have already responded in PM, but maybe it would be interested for someone else. This is not a bug actually, just a feature of GTA:SA renderer. The problem is quite common. Glass and other transparent objects must be a separate object. Without it glass isn't able to be sorted the correct way. Moreover, transparent objects must be separated so that a camera wouldn't be able to be positioned within the transparent object's bounding box.

There is still bug with glass. Even with glass as separated object with alpha 100

image image

Like I said, GTA SA rendering isn't perfect and has limitations. Seems like a glass object is too large to let SA handle it correctly. You cannot create one big object contains all transparent parts of a house. There are some considerations require you to separate all windows(but depends on the windows themselves) into isolated flat(not concave or convex) objects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants