Jump to content

Recommended Posts

i'd suggest using

positionCameraToWorld [0,0,0];

instead of the player's position to make it work in any scenario.

 

also i'm wondering how many ms it eats. is it reasonable? (will test later)

 

i think it could work great to use textures with not only one snow flake on them for higher density without performance impact. i feel like the current way the number of snow flakes would directly translate into performance, right? but might be so small that it's possible to ignore.

 

thx KK for sharing that algorithm. nice and simple. didn't even know drop was still a thing.

 

@neetch: lol are you steve jobs reincarnated or something? i mean if people are happy to help i guess there is no problem but the way you are trying to guide them to making you exactly what YOU need kinda makes me feel dirty reading it. no offense. but have you tried lifting a single finger yourself yet? might get you results faster. also you might learn something....eeww

  • Like 1

Share this post


Link to post
Share on other sites

Looks good, but this is because you are not shy with how much snow you are generating. To optimise you can only generate snow where you look. Then there is also thing about when you are in vehicle and moving fast. The snow needs to be generated well ahead but then it starts getting complicated as with when you introduce wind. I suggest forcing wind to 0 when with snow. It is not realistic but it is either this or a bunch of complicated calculations on top of already demanding loop.

  • Like 1

Share this post


Link to post
Share on other sites
10 minutes ago, killzone_kid said:

Looks good, but this is because you are not shy with how much snow you are generating. To optimise you can only generate snow where you look. Then there is also thing about when you are in vehicle and moving fast. The snow needs to be generated well ahead but then it starts getting complicated as with when you introduce wind. I suggest forcing wind to 0 when with snow. It is not realistic but it is either this or a bunch of complicated calculations on top of already demanding loop.

 

Yes it needs to be optimized :) Setting fog and lowering view distance should help FPS a little. Wind is already forced to zero in the script. Its not ideal as people will want blowing snow etc. I guess we could calculate where the snow will land given the wind vector (for those that love their math) and surface check to that point instead, this should stop snow blowing into buildings. The script kinda takes into consideration player velocity and vehicle speeds, but could be improved.

 

Also, TTL is confusing, seems like particles live way longer than they should in seconds.

 

@neetch cl_water is the round snowflake. Go experiment!

Share this post


Link to post
Share on other sites

@benson I am aware that im being direct. I'm just speaking my point trying to get my vision across. I have never ordered anyone to do anything. I'm tired of people nagging on people for saying what they really mean when in the end it is only improving mods. If i just where being sweet and cute and pretending that everything was awesome, no improvements would be made.... Btw i have already stated my limited skills with coding.

 

Edit: Also, if people don't agree with my suggestions and decide to use them anyway, you have to have some sick masochistic side to go on with that. And i don't think anyone helps because of that. I think people help because they are interested and they agree with the suggestions and see how it could help improve the mod/script (if not, then please find your car keys, get in your car, drive down to the beach and drown yourself because you are wasting your time, modifying your own creation, with things that you do not agree with.).

Aaalso you are twisting my suggestions/bug reports as criticisms "have you tried lifting a single finger yourself". I have NOT ONCE criticized anyone. Only thing i have done, is speaking my honest opinion and giving suggestions (hoping, ofcourse, that people see what i see, and agree with me)

The goal is smooth and delicious, bug free mods. Buggy or stuttery mods i simply won't use. Again, not a criticism, just my own personal preference.

Share this post


Link to post
Share on other sites

seems like i was more spot on than i thought. nice post mate. i hope you got what you needed...errr i mean improved mods for everyone.you're a fucken hero! the world needs more leaders like you.

 

i'm just pulling your leg man. all good. seems i hit a nerve though. :f:

 

@KK & tup: i was thinking maybe one could cheat for vehicles and attach a source to them and use parameters that assure that the particles match up speed/direction wise with the vehicle. almost like local space particles. but that could be very hard to do and performance hungry. just thinking out loud.

Share this post


Link to post
Share on other sites

Thanks for the positionCameraToWorld... good idea. Useful for testing with Zeus.

Share this post


Link to post
Share on other sites
5 hours ago, killzone_kid said:

 To optimise you can only generate snow where you look.


Not sure about this though... you would want to simulate snow being blown from behind someone into their view - if handling wind blown snow.

 

In my tests FPS is not massively affected by the current code (setviewdistance 500 and using fog helps). Should probably not use while loop though, move it to a CBA PFH.

 

Would be awesome if someone could do the math to work out the landing spot of snowflake given starting position, velocity towards ground and wind vector. Any takers?

Share this post


Link to post
Share on other sites
21 minutes ago, tupolov said:

you would want to simulate snow being blown from behind someone into their view - if handling wind blown snow.


I am still against using wind, with snow, it is cost benefit problem, too much cost not much benefit. And when I said generate snow where you look I meant the snow generates mostly in your visible sector and a little beyond, this means some snow will be generated just behind too in case you decide to walk backwards

Share this post


Link to post
Share on other sites

I tested your script and is not working in small huts and "Land_Medevac_house_V1_F". And when you enter big millitary tower, there is also snow inside. Hope this report will help.

Share this post


Link to post
Share on other sites
3 hours ago, M1ke_SK said:

I tested your script and is not working in small huts and "Land_Medevac_house_V1_F". And when you enter big millitary tower, there is also snow inside. Hope this report will help.

Yah still needs some tweaking. Thanks

  • Like 1

Share this post


Link to post
Share on other sites
On 1/25/2017 at 9:22 PM, killzone_kid said:


I am still against using wind, with snow, it is cost benefit problem, too much cost not much benefit. And when I said generate snow where you look I meant the snow generates mostly in your visible sector and a little beyond, this means some snow will be generated just behind too in case you decide to walk backwards

 

I think that we can optimise it with BIS_fnc_inAngleSector to limit particles to your visible sector.

Share this post


Link to post
Share on other sites
2 minutes ago, killzone_kid said:

 

I think this would make it worse.

 

When we use it with IF statement and limit number of particles (min 30%) that will make it worse?

Share this post


Link to post
Share on other sites
13 minutes ago, M1ke_SK said:

 

When we use it with IF statement and limit number of particles (min 30%) that will make it worse?


So you are randomly generating positions and then checking if they are in sector? Running this function for every generation, rejecting 70% of generated positions, how is this makes it better? 70% of waste, running pretty expensive function for nothing. 

Share this post


Link to post
Share on other sites

Ok well probably last post from me on the subject unless others fancy contributing :) Tweaked some things, still some issues. Guess it needs better placement of the emitters (rather than random placement), adjustment for viewing frustum and player velocity. TTL still confuses me as particles seem to live for way longer than the TTL, guess its the random changing vector particle effects.

 

Spoiler

1 setFog 0.6;   
snow = true;    
snowIntensity = 700;   
snowTempIntensity = 700;    
snowVelocity = 1.25;    
snowFidelity = 5;    
snowMaxDistance = 35;   
setViewDistance 500;    
snowTTL = 0.1;
TTL = 0.5;
 
0 = [] spawn {      
   
    while {true} do {      
   
        private _a = 0;      
        while {snow && _a < snowIntensity} do {      
   
            private _fi = snowFidelity;      
            private _max = snowMaxDistance;     
   
            if (vehicle player != player) then {    
                _max = _max * 2;   
                smowTempIntensity = snowIntensity;    
                snowIntensity = snowIntensity * 9;    
            } else {    
                snowIntensity = snowTempIntensity;   
            };      
   
            for "_d" from _fi to _max step _fi do {   
   
                private _pos = ATLtoASL positionCameraToWorld [0,0,0];   
                private _hpos =+ _pos; _hpos set [2,(_pos select 2)+20]; 

                setWind [0,0,true];    
                0 setRain 0;      
                   
                private _height = (_max - _d + 2) min 10;   
                if (speed player > 30) then {_height = 8;};   
   
                private _dpos = [   
                    ((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 1)*1)),   
                    ((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),   
                    (_pos select 2) + _height   
                ];      
   
                private _hdpos =+ _dpos; _hdpos set [2,(_dpos select 2) + 20]; 
   
                private _ldpos =+ _dpos; _ldpos set [2,(_pos select 2)+0.1];       
                   
                if (!lineIntersects [_dpos, _hdpos] || {(_hpos distance2D _hdpos > 7) && (lineIntersects [_pos,_hpos])}) then {     
   
                    private _ttl = (_height*TTL);    
                    private _surfaces = lineIntersectsSurfaces [_dpos,_ldpos,player,player,true,1];    
                    private _size = (0.02 + (random 0.06));
                    private _vel = (_size*10)*snowVelocity;   
                    if (count _surfaces > 0) then {   
   
                        _surfHeight = _surfaces select 0 select 0 select 2;   
                        private _dist = (_dpos select 2) - _surfHeight;   
                        _ttl = ((_dist / _vel) * snowTTL) min (_height * snowTTL);                           
   
                    };    
  
                    private _snowDrop = selectRandom [                      
                        ["a3\data_f\ParticleEffects\Universal\Universal.p3d",16,12,(1 + ceil(random 7)),0],  
                        "\ca\data\cl_water",  
                        ["a3\data_f\ParticleEffects\Universal\Universal.p3d",16,12,13,0],                     
                        ["a3\data_f\ParticleEffects\Universal\Universal.p3d",16,12,(1 + ceil(random 7)),0],  
                        ["a3\data_f\ParticleEffects\Universal\Universal.p3d",16,12,16,0],  
                        "\ca\data\cl_water",                               
                        ["a3\data_f\ParticleEffects\Universal\Universal.p3d",16,12,(1 + ceil(random 7)),0]  
                    ];  
  
                    drop [_snowDrop, "", "Billboard", 1, _ttl, ASLToATL _dpos, [0,0, 0 - _vel], 1, 0.0000001, 0.000, 0.7, [_size], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, (1.5 -_vel) max 0.3, "", "", ""];      
                };     
                _a = _a + 1;      
            };                 
        };    
        sleep 0.2;         
    };      
};

 

 

  • Like 2
  • Thanks 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×