Romagnolo Posted February 4, 2017 15 hours ago, FishMan said: I ****ing did it!!! I fixed the scope! Shit it took me 3 weeks to understand this shit! Omg! Here is the code... You can add effects to this and sphere mask as an opacity so the reticle would not fly through scope. I still not sure what is the nature of this constant vector (0.153; 4,32; 0) maybe it is the shift from weapon blueprint or difference between the attachment and optics position, I will investigate this later... UPD: Ah yeah! It is the local position of the scope center. Here is the screenshot from 3ds max: Dont forger that mesh reticle is also shifted (by developers) you should move it back at the center of the scope to force it work right. You know what? You can even force the scope to remain the same scale no matter the distance I will show you tomorrow how to do this. Fantastic work! Have the DEVs gotten in contact with you already? Share this post Link to post Share on other sites
FishMan Posted February 5, 2017 (edited) By the way I guess the tank turret stabilistation might work the simlar way it the future. Here is the code to force it always remain the same size: If you ignorant enough (like me) you will notice that its not about size but about positon. This code just basically shifting the retilce in camera depth so it allways remain at the same distance (second value of 3vector parameter. In our case - 17 cm), no matter where are you or where is your weapon. And this what causes the problem when you trynig to mask it out with sphere mask. Cause sphere masks has depth as well and allways moving with the scope and most of the time it's not even touch the reticle mesh. Here is what I mean: You can shift it with the reticle together, but it now will remain the same size, while the lens changing its sizes while moving in depth (cause this is how prespective works). I guess you can modify the radius of the sphere depending on the distance from camera, but in my opinion it will end in some really big and paintfull FOV-dependend calculations using Pythagorean theorem or something like that. I also was trying to solve this by generating 2D cirle mask using lenght of 2d vector, but first of all - It's not stable and secondly it's always remain the same size on the screen, while lens should become smaller when it moving in camera z axis (depth) as I said before. We basically needs a cylinder mask, that will change its radius in 3d space depending on its position but it should have unlimited height (like 2d cirle), I wasn't able to generate such mask... Anyway I wasn't able to find any beautifull solution for this. And by beautifull I mean the solution that works just using shader math. BUT! (here is that dramatic point where you should forget everything that I was saying before) There is another way to solve this. We can use Custom Stencils (or custom depth - but I personally prefer stencils because they have bit masks). As you can see it very stable. The problem is that you have to modify the weapon blueprits to make everything right, here is the short tutorial about how to do it: So now you can use this code in the shader to get that mask: The result you can see on the second video that I've posted. So here is what we got so far, just to be clear: This code shifting the reticle and masking it so it never leave the scope area. Here is the result: It doesn't matter what is your fov. It can be compatible with PIP scope and any kind of effects. It will be visible on top of the smoke. Another good news is that you can use this not only for masking the retilce, but for some cool effects as well. I will tell you about them in my next post... I want to take a break to have some tea with sugar, eat some semechki and pelmens with mayonez to recharge my slav powers... TO BE CONTINUED Edited February 5, 2017 by FishMan Share this post Link to post Share on other sites
FishMan Posted February 5, 2017 (edited) Ok. So I said you can use custom stencils for additional effects. For exmaple you can blur everything but lens. Here is how it looks assembled: Screenshot: I also added parallax effect from first pages of this thread. How I did it... I just closed the hole in the scope and made it so the cap is used its own material. I could make everything in one material but I've decided that it will become unnesessary complicated in this case. Here is the shader which I used for parallax effect: And here is the post-process shader which I use to blur everything but lens: The devs allready made Post-process slot in their weapon blueprint so I just plugged it there. As you can see here I'am using custom material function called "average blur". It just takes pixels shifting them and average them. Unreal has native function for this, but I've made my own, so it better suit for my needs. Why average blur? Cause it pretty cheap and aeasy to do (understand), but my goal is to make something similar to Heroes and Generals. So when I figure out how to do good blur effect which will not kill perfomance I will change this, other words may be I'll figure our later how to do another blur, Gussian for example, but for now its AverageBlur. Here is how AverageBlur function looks like: I will add later chromatic abberations and lens distortion effect to it. I also have some experiments with it, but nothing super exciting for now: Also I would like to exepriment with lens flare effects from sun and this luna artifacts when you look not straight through scope (for what it all was started). And finally the last thing. You can set up zeroing with that veeeeery precise... You can even bind a key in blueprints to change zeroing using for example mouse scroll. Like in Heroes and Generals. Example: And here all the nesessary files: https://dl.dropboxusercontent.com/u/9760936/collimator/PSO-RETICLEFIX.rar Pay attention that when you load this to your engine it gonna be missing average blur function in PP_Blur_Stenciled material. so you should manually open it and fix it like on this picture, then hit apply. Also to make it work you should enable custom stencils in project rendering settings. Thats all good luck. Edited February 5, 2017 by FishMan Share this post Link to post Share on other sites
Tillee Posted February 5, 2017 Someone better get a damn developer over here. Great work, congratulations! Share this post Link to post Share on other sites
eggman Posted February 5, 2017 Nice experimantation! Share this post Link to post Share on other sites
LugNut Posted February 5, 2017 Great work! Not knowing any better, would the method to change the scope elevation also work for adjustable rear iron sights? Share this post Link to post Share on other sites
FishMan Posted February 5, 2017 (edited) 17 minutes ago, LugNut said: Not knowing any better, would the method to change the scope elevation also work for adjustable rear iron sights? Nah. Iron sights is about rotation stuff, not just shifting in X and Y. By the way. About the rerticle. Did I mentioned that you can make it smaller just using parameters? Well you can. Edited February 5, 2017 by FishMan Share this post Link to post Share on other sites
Chap Posted February 6, 2017 (edited) Very cool man. In such a short time to do so many cool things. In your system may be implemented backlight on the grid? Edited February 6, 2017 by Chap Share this post Link to post Share on other sites
JarryHead Posted February 6, 2017 Awesome job! Please devs, we need this! Share this post Link to post Share on other sites
FishMan Posted February 6, 2017 4 hours ago, Chap said: In your system may be implemented backlight on the grid? Of course it just color of the reticle, right now it's emit black color, basically you can just add vector3 parameter and switch it to any color through blueprint or c++ code. Share this post Link to post Share on other sites
FishMan Posted February 6, 2017 By the way, here some other references, just for compare... Its "Rakurs-p" russian 1x (collimator) optics. Share this post Link to post Share on other sites
grimshadow Posted February 6, 2017 Yeah nice work fishman! I also like your training range target magnification Share this post Link to post Share on other sites
FishMan Posted February 9, 2017 By the way. I've forgot to say something. Rangefinder also works if you adjust the reticle scale to right dimentions. But the rande doesn't matter cause you can easily shoot targets on 400 meters with a reticle that was set to 100. Are you sure that there is nothing wrong with the ballisitc in Squad? The bullet drop seems too small. Anyway the devs did reticle right, so I even haven't changed anything, it just work as it is... Well plus/minus some small error. Doesn't matter what is the FOV. Here is the video: Share this post Link to post Share on other sites
IhanaMies Posted February 11, 2017 On 9.2.2017 at 11:18 AM, FishMan said: Are you sure that there is nothing wrong with the ballisitc in Squad? The bullet drop seems too small. Squad doesn't have bullet drag atm. With bullet drag SVD scope is pretty accurate to 800m which I have extensively tested. Without zeroing though Share this post Link to post Share on other sites
Fandango831 Posted February 21, 2017 This has to be one of my favorite threads to keep track of! Your work is phenomenal and hopefully the Devs can pull some creative ideas from it all. +1 Share this post Link to post Share on other sites
FishMan Posted February 21, 2017 (edited) Took some time to play with the engine again... Here some small results from experiments with refraction and chromatic aberrations. It's basically a post-process shader, at this time I wasn't doing much with my self and just stole everything from this thread: https://forums.unrealengine.com/showthread.php?119740-Simple-refraction-with-chromatic-aberration Check it out, It really awesome. But it seems that its a little bit perfomance heavy (not very much), so I might try to do it another way... May be a default refraction will cost less than this. I have to try it. Soon I will have plenty of time, cause here in Russia we've got some holidays (it's called "Defender of the Fatherland Day") so I might spend more time on this to make something descent. Edited February 21, 2017 by FishMan Share this post Link to post Share on other sites
Major Trouble Posted February 21, 2017 Great job FishMan. That's definitely what's missing currently. A worthy addition. When you say it's performance heavy I guess you mean gpu. Squad being cpu bound on full servers I guess most can take the hit on gpu usage. Share this post Link to post Share on other sites
FishMan Posted February 21, 2017 When I said perfomance heavy - I mean it's red on "shader complexity". It's not a big deal actually. But I'am looking a solution that will cost as low as possible. Don't forget - refraction and abberation is not all that will be at the end, there will be some additional effects, so I need some space for them as well. This video is a good representation of how I want this shader to look at the end. Share this post Link to post Share on other sites
Xx-RAGING-DEATH-xX Posted February 21, 2017 wow man,with that sort of zoom mechanics i'll want to be a Sniper all game long...I like it,like it alot. Share this post Link to post Share on other sites
ZiGreen Posted February 22, 2017 @Assifuah Some dangerous and possibly destructive stuff here. Fishman is encouraging sniper lone wolf gameplay here. I'd suggest to ban him. Share this post Link to post Share on other sites
grimshadow Posted February 22, 2017 8 minutes ago, ZiGreen said: @Assifuah Some dangerous and possibly destructive stuff here. Fishman is encouraging sniper lone wolf gameplay here. I'd suggest to ban him. Lol, but in reality it would make it more difficult from its current state Share this post Link to post Share on other sites
ZiGreen Posted February 22, 2017 3 minutes ago, grimshadow said: Lol, but in reality it would make it more difficult from its current state That is why I always suggest optics/irons balance through proper implementation of optics. Not only because I am dumb realismfag. Share this post Link to post Share on other sites
FishMan Posted February 22, 2017 9 minutes ago, ZiGreen said: I'd suggest to ban him. Share this post Link to post Share on other sites