Board index FlightGear Development Effects and shaders

Particle system won't work

An exciting "new" option in FlightGear, that includes reflections, lightmaps, the particle system etc.. A lot is yet to be discovered/implemented!

Particle system won't work

Postby TheEagle » Wed Jun 01, 2022 2:04 pm

Can anyone tell me why this particle system simply won't work ? It works when I put fixed values for red,green,blue, but I need to bind them to properties to allow runtime selection of the smoke color:
Code: Select all
<PropertyList>
   <particlesystem>
      <name>smoke</name>
      <texture>smoke.png</texture>
      
      <!--<condition>
         <property>sim/multiplay/generic/int[6]</property>
      </condition>-->
      
      <emissive>false</emissive>
      <lighting>false</lighting>
      <align>billboard</align>
      <attach>world</attach>
      
      <placer>
         <type>point</type>
      </placer>
      
      <shooter>
         <theta-min-deg>10</theta-min-deg>
         <theta-max-deg>86</theta-max-deg>
         <phi-min-deg>-1.5</phi-min-deg>
         <phi-max-deg>8</phi-max-deg>
         <speed-mps>
            <value>10</value>
            <spread>2.5</spread>
         </speed-mps>
      </shooter>
      
      <counter>
         <particles-per-sec>
            <value>50</value>
            <spread>1</spread>
         </particles-per-sec>
      </counter>
      
      <particle>
         <start>
            <color>
               <red><property>sim/model/smoke/red</property></red>
               <green><property>sim/model/smoke/green</property></green>
               <blue><property>sim/model/smoke/blue</property></blue>
               <alpha><value>0.3</value></alpha>
            </color>
            <size>
               <value>0.3</value>
            </size>
         </start>
         <end>
            <color>
               <red><property>sim/model/smoke/red</property></red>
               <green><property>sim/model/smoke/green</property></green>
               <blue><property>sim/model/smoke/blue</property></blue>
               <alpha><value>0.001</value></alpha>
            </color>
            <size>
               <value>30.0</value>
            </size>
         </end>
         <life-sec>
            <value>100</value>
         </life-sec>
         <mass-kg>0.001</mass-kg>
         <radius-m>1.0</radius-m>
      </particle>
      
      <program>
         <fluid>air</fluid>
         <gravity>true</gravity>
         <wind>true</wind>
      </program>
   </particlesystem>
</PropertyList>

I get no errors, but no particles either …
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Particle system won't work

Postby Thorsten » Wed Jun 01, 2022 5:59 pm

Probably you're not writing

Code: Select all
sim/model/smoke/red


but rather

Code: Select all
/sim/model/smoke/red


and so the particle system receives NaN as a color. Usually it's something like that.
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Particle system won't work

Postby TheEagle » Wed Jun 01, 2022 6:16 pm

Well, relative properties refer to the property tree root / when used in the aircraft that I'm currently flying, right ? And I have checked that /sim/model/smoke/red is set to a number (0), as well as the two other color props …
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Particle system won't work

Postby TheEagle » Wed Jun 01, 2022 6:22 pm

Could it be that you can't mix properties and values in the color definitions ? I have pointed red,green,blue to properties but as you can see in the code the alpha channel is a fixed value.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Particle system won't work

Postby TheEagle » Wed Jun 01, 2022 6:53 pm

It works now … after setting <gravity> back to false !!! Now, can anyone tell me why it only works without gravity ???
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Particle system won't work

Postby wkitty42 » Thu Jun 02, 2022 10:08 am

TheEagle wrote in Wed Jun 01, 2022 6:53 pm:It works now … after setting <gravity> back to false !!! Now, can anyone tell me why it only works without gravity ???

trace the code, grasshopper... trace the code... there might be a typo or it could be on purpose...
what influence do you think gravity would have?
does the volcano code have gravity?
what about the "Jurassic Park" waterfalls in Hawaii?
"You get more air close to the ground," said Angalo. "I read that in a book. You get lots of air low down, and not much when you go up."
"Why not?" said Gurder.
"Dunno. It's frightened of heights, I guess."
User avatar
wkitty42
 
Posts: 9162
Joined: Fri Feb 20, 2015 4:46 pm
Location: central NC, USA
Callsign: wk42
Version: git next
OS: Kubuntu 22.04

Re: Particle system won't work

Postby Thorsten » Thu Jun 02, 2022 12:54 pm

Well, relative properties refer to the property tree root / when used in the aircraft that I'm currently flying, right ?


Yes, but you didn't write where your particle system resides, so it was a plausible guess.

Generally using property control for colors works fine, I've done it in more than one context, so chances are the code is doing something which you don't expect. The most likely scenario is that it's not reading the properties you think it reads, but there's also more subtle issues possible.

Finally, when all else is ruled out, I think it's safe to say that the particle system has a number of genuine bugs (which we can't work around because they reside inside the OSG codebase).
Thorsten
 
Posts: 12490
Joined: Mon Nov 02, 2009 9:33 am

Re: Particle system won't work

Postby erik » Thu Jun 02, 2022 12:59 pm

Thorsten wrote in Thu Jun 02, 2022 12:54 pm:Finally, when all else is ruled out, I think it's safe to say that the particle system has a number of genuine bugs (which we can't work around because they reside inside the OSG codebase).

James has reworked the code in such a way that it is quite acceptable now. I don ´t think there are any real bugs remaining.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2248
Joined: Thu Nov 01, 2007 2:41 pm

Re: Particle system won't work

Postby TheEagle » Thu Jun 02, 2022 1:09 pm

Well, the color control works just fine now. But when I change <gravity>false</gravity> to <gravity>true</gravity> or <gravity type="bool">true</gravity>, it simply stops working. The worst thing is - I have successfully used particle systems with <gravity>true</gravity> before (https://github.com/TheFGFSEagle/FGFireworks) ! IIRC it doesn't work neither on git next as well as the 2020.3.13 release - I'll check that again though for git next.
Cessna 210 (Wiki)
My other aircraft: my wiki profile !
Other: FGTools (GitHub)
World tour: View on SkyVector
Please consider donating $1 / €1 to help me finance a new camera !
User avatar
TheEagle
 
Posts: 3433
Joined: Sat May 01, 2021 3:27 pm
Location: France
Pronouns: You, he
Callsign: F-EAGLE
IRC name: none
Version: Git next
OS: Ubuntu Studio 22.04

Re: Particle system won't work

Postby erik » Thu Jun 02, 2022 1:25 pm

This could of course be a regression after the particle code work done by James.
Maybe you should take it to the mailing-list.

Erik
Current: Parachutist, Paraglider, Pterosaur, Pilatus PC-9M and variants, ERCO Ercoupe, Fokker Dr.1, Fokker 50, Fokker 100
Less active: Cessna T-37, T-38, Santa Claus. Previous: General Dynamics F-16. Worked on: Wright Flyer
erik
 
Posts: 2248
Joined: Thu Nov 01, 2007 2:41 pm


Return to Effects and shaders

Who is online

Users browsing this forum: No registered users and 4 guests