Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jni97 · Feb 01, 2016 at 03:06 PM · camerashadowfpscontroller

WeaponCamera shadow fail

Hi, I have a 2 camera setting for a fps game.

The first camera(MainCamera): Clear Flags: Skybox; CullingMask: Everything; FoV: 60; Clipping Planes ->Near = 3 ->Far = 3000; Depth: -1; Rendering Path: Forward; Occlusion Culling; true; HDR: false;

The second camera(WeaponCam): The first camera(MainCamera): Clear Flags: Depth only; CullingMask: Everything; FoV: 60; Clipping Planes ->Near = 0.1 ->Far = 3; Depth: 0; Rendering Path: Forward; Occlusion Culling; true; HDR: false;

The problem is that I cant see near shadows. To understand the problem you should look at the pictures:

alt text

alt text

The first one shows the normal shadow, but the second picture shows the bug... How can I fix it?

distance.png (479.1 kB)
near.jpg (21.7 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Whiteleaf · Feb 01, 2016 at 03:40 PM 0
Share

i don't exactly know what's causing this but you do NOT want to rendering everything for a weapon camera. Put all your weapons on separate layers and then set the camera to only render that layer. It doesn't work and it's a waste of processing power. You also probably want to set the near clipping planes to 0.01 for both cameras; otherwise you can get some weird clipping issues.

avatar image jni97 · Feb 01, 2016 at 04:03 PM 0
Share

I use the weapon camera to prevent clipping issues, beacause if I set the near clipping plane lower than 1, I will get z-fighting on terrain and some models...I thought I use 2 cameras, one for range and one to don't look though the wall.

avatar image Whiteleaf jni97 · Feb 01, 2016 at 11:33 PM 0
Share

This is how you make a weapon camera.

$$anonymous$$ake a new layer, assign all your objects that will only be rendered by the gun camera to that new layer.

$$anonymous$$ake a new camera, set its Clear Flags to Don't Clear, and set it's culling mask to be the new layer you created for all your guns.

On the main camera, under culling masks, un-check the new layer. Otherwise it will be rendered twice and won't work right.

You can set your FOV to whatever you want.

And boom, the things that are on the new layer will be only rendered by the gun camera and won't clip through things.

I don't know why you're getting weird terrain issues with the clipping planes, but the higher you have it, objects that are close to the camera won't be rendered. Which is usually why you'd want it to be set to 0.01, or 0.1 like you have it; I prefer 0.01. The shadow problem might also be a problem with Unity itself, a bug perhaps. I've had several issues with multiple cameras and lighting. The problem might also be that you're using Depth Only, and not Don't Clear.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

41 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Fps Controller movement is broken 0 Answers

,the associated scrip cannot be loaded error on FPScontroller prefab from the standard assets 0 Answers

What can cause shadow slicing while moving camera? 1 Answer

FPSController camera moving into model when any button to move the character is pressed? (WASD) 0 Answers

Shadows from culled objects 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges