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

Mach cone / A/B flame effects broken over MP #174

Open
1 task done
colingeniet opened this issue May 28, 2021 · 3 comments
Open
1 task done

Mach cone / A/B flame effects broken over MP #174

colingeniet opened this issue May 28, 2021 · 3 comments
Labels

Comments

@colingeniet
Copy link
Collaborator

colingeniet commented May 28, 2021

Longstanding issue, I'm trying to at least document it.

Context

These effects have parameters which depend on /rendering/scene/diffuse/red, used to adjust their brightness depending on the scene light (makes the vapour cone darker and the flame more visible at night). There's a lot of issues with that:

  • /rendering/scene/diffuse/red is tied, which means effect do not work properly with it (they never update its value).
    This affect the Mach cone, which directly uses diffuse/red as parameter.
    The current solution is to instead use a duplicate property diffuse/red-unbound, updated regularly in nasal.
  • The flame effect doesn't directly use diffuse/red-unbound, but rather its "inverse". Since effects parameters do not allow expression AFAIK, the parameter values are computed in nasal.

With these hacks, the effects work properly locally.

MP Effects—current state

MP models is where it gets fun. Say aircraft A is looking at a MP model Viggen (aircraft B).

  • Simple case: aircraft A is also a Viggen. Then A already has the nasal-updated parameters described above in its property tree.
    The effects for the MP model of B use these parameters, and everything works.
  • Problematic case: aircraft A is not a Viggen. Then the parameters do not exist, and the effect is broken (Mach cone is black, A/B flame is invisible).

Nasal in MP Model

As of v5.0.0, the xml model files contain Nasal code to update these parameters from MP models, meaning that the Nasal code from MP model B will update the properties for A (cf. color_loop() in Models/JA37Di-Viggen.xml).
This doesn't work: the effects do not use these properties. I suspect the issue is that the property doesn't exist yet when the effect is set up (MP model nasal block runs after effects are loaded).

  • Remove this since it doesn't help.
@NikolaiVChr
Copy link
Owner

I suspect the issue is that the property doesn't exist yet when the effect is set up (MP model nasal block runs after effects are loaded).

Effects cannot use MP properties, on dev list they kinda indicated it was not something easy to fix. So myProperty wont work. Only will read from /myProperty
So just make a local (absolute) property for scene red, that is not bound.
Since scene red is used in almost all our aircraft in effects, I think we could install that at least in all OPRF aircraft.

@colingeniet
Copy link
Collaborator Author

colingeniet commented May 28, 2021

My terminology, because we seem to use opposite ones :)

  • /ai/models/multiplayer/<something> is what I call local (in the context of MP models)
  • /<something> is what I call global

The Nasal code I'm referring to was trying to set the global/absolute properties (i.e. the ones the effects should use).
It still doesn't work.

@colingeniet
Copy link
Collaborator Author

/rendering/scene/diffuse/red being unusable in effects sounds like something which should be possible to fix in FG.
Either by improving the code which reads parameters in effects, or by fixing how /rendering/scene/diffuse/red is tied.
(I could be talking nonsense, but I think there are new/good and old/bad tied properties, and I assume it is an old/bad one).

Of course that only helps with next...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants