Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Beanster

Red Dot Sight Effect ~The Arma 3 way~

Recommended Posts

So after finding out how arma 3 does their RDS effects, I went off to do my own, keeping locked deep in my documents.

Now I feel like sharing it!

Thought it would go in this section cos it used camera manipulation and a custom shader (that I didn't write, but found).

 

Please login or register to see this link.

 

The pack has an example scene it, with a model.

 

You may not use this model in your own work, except for TheMars.

 

Ill make a tutorial on how to use it after my sport.

  • Like 1

Share this post


Link to post
Share on other sites

Yeah, it also uses subtractive rendering to hide the red dot, when not looking down the signts.

Share this post


Link to post
Share on other sites

Nice! But I remember you've had three cameras in the scene, but you only need two. One that renders the red dot & the sight blocker + the red dot model with the special shader, and the other one renders the rest (also the red dot sight but with a normal shader)

Share this post


Link to post
Share on other sites

Yes I know that, it's I have the holosight an extra camera so it doesn't clip into objects in a fps

Share this post


Link to post
Share on other sites

A more faster (performance), but more tedious way is to have the DepthMask shader from UnifyCommunity wiki (google it) and mask out the "dot" using the render queue. You require an occlusion mesh to hide the dot and fit the sights or lens. Render queue of occlusion mesh should be 4001, the dot should be 4002. Then I just use the script to calculate the offset of the weapon (pretty much the inverse of weapon delay) to give it a parallax effect. It took about 10 minutes to set up and I am currently using it for the Kobra sight for Darkraze.

 

Best part is that this works with Unity Free/Indie.

Share this post


Link to post
Share on other sites

Actually, the dot automatically gets effected by the mask depending on the transparent shader you use for the dot. but youll want to render queue the mask as well to make the masking shader not be effected by the muzzle flash. If not, the muzzle flash will be cut out where the mask is

P.S. your the first person to come up the same method I use

Share this post


Link to post
Share on other sites
Please login or register to see this quote.

I noticed a render queue of 3000 would occlude the muzzle flash (additive particle shader), but 4000 solves it since it's "Overlay" and not "Transparent". I just added 1 just in case 4000 is being used by another shader.

 

Render queue information:

b62329dd4d294c0e58a28298b0b80e89.png

Please login or register to see this link.

 

Additionally, the only flaw about this method is that if you set the texture/laser too far away, it will get culled from other geometry. Having ZTest set to Off would fix that problem, but then the masking would not work. I just moved it 0.5 meters away and just attached a script to it to move according to the weapon position in order to give a "faked" parallax effect.

 

EDIT: This flaw only occurs when you don't have a weapon camera.

Share this post


Link to post
Share on other sites

Not necessarily. It should be on the weapon layer which renders only the weapon, arms and dot setup. No other geometry will effect it

 

-----------------------------------

 

Please login or register to see this link.

 

Press RMB to aim : Sorry, forgot to tick run in background but don't feel like rebuilding

 

Since you've already shared how it's done, there's no point in keeping it to myself and a few others anymore. Download is attached. Also demonstrated is Depth Crosshairs using the same concept

  • Like 1

Share this post


Link to post
Share on other sites

Well, the problem is that I have it all in one camera (no weapon camera) since I want shadows to be casted onto the player's arms and weapon. I used to have it work in my old projects where it wouldn't clip through objects and I realized that I had a weapon camera in that version.

 

EDIT: The merge deleted the attachment, sorry about that.

Share this post


Link to post
Share on other sites

Eh, it's ok. In your case, you fix that by adding a red dot camera that is a child of you main camera that only renders the the dot and mask and butt the front of the mask up to the front of the sight. Then problem solved. I may upload again later if I feel like it, or just leave the web player link for people to just see how it works, but we will see

Share this post


Link to post
Share on other sites

I already solved the problem using a different way, kinda like an illusion to make you think the dot is farther away when it's actually really close up, but thanks for the idea.

Share this post


Link to post
Share on other sites

When I saw the feed for this I was like...Beanster? You back? 😫

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...