• 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
1
Question by Jimadybobalon · Nov 05, 2013 at 01:50 PM · camerashaderrendering

(Non-Euclidean) Overlapping Textures with Multiple Cameras Problem

Hello~

I have a big problem with displaying some overlapping textures the way I want to. I'm creating a 2D Non-Euclidean Dungeon and so because of the logic (or lack thereof) of Non-Euclidean space, some rooms can overlap. Or seem to, at least, t$$anonymous$$nking in a Linear sense.

And t$$anonymous$$s is where my problem occurs. Because of the overlapping rooms I figured I'd have to have multiple cameras to render them correctly at the correct times. However I'm using 2D Volumetric Lights from the Asset store, and the shaders it uses seem to just merge the object with the 2D Light mesh at render, w$$anonymous$$ch means that as long as there is a light over the space of an object, the later cameras will render it, regardless of what layer the light that was rendered was on... as shown here:

In t$$anonymous$$s image you can see from the first room into the room drawn by LayerCamera1. Everyt$$anonymous$$ng looks fine and great.

alt text

T$$anonymous$$s is the room drawn by LayerCamera2 (w$$anonymous$$ch draws before 1, sorry for silly naming conventions there). Here you can see that it renders 2, then draws the first room over it when LayerCamera1 draws.

alt text

Even though the camera itself can see not$$anonymous$$ng, it merges itself with what was already onscreen because of the shaders. W$$anonymous$$ch confuses me to all hell, as only the correct light (that's on the correct layer that's visible by the correct camera) can enter it's set room, no other light can, and to me it seems like it's the light shader that does the combining at the end. Oh well, I'm terrible at shaders anyhoo. Here are the shaders as well, by the way:

T$$anonymous$$s is the object shader:

Shader "2DVLS/Diffuse" {

Properties { _MainTex ("Base (RGB) Trans. (Alpha)", 2D) = "w$$anonymous$$te" { } }

 Category
 {
     ZWrite On
     Cull Back
     Lighting Off

     SubShader
     {
         Pass 
         {
             ColorMask 0
         }

         Pass
         {
                Blend DstColor DstAlpha

             SetTexture [_MainTex] 
             { 
                 combine texture
             }             
         }
     } 
 }

 Fallback "Diffuse"

}

And t$$anonymous$$s here is the light shader (for the lightmesh itself)

Shader "2DVLS/Light" {

Properties { _MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "w$$anonymous$$te" } Category {

    Lighting Off
    ZWrite Off
    
    //Tags { "Queue" = "Geometry-10" }

    Blend One One
    
    BindChannels {
           Bind "Color", color
           Bind "Vertex", vertex
           Bind "TexCoord", texcoord
    }
    
    SubShader 
    {
         Pass 
         {
            SetTexture [_MainTex] 
            {
                Combine texture * primary
            }
         }
     } 
 }

}

Any help at all would be greatly appreciated! Whether it's pointing out a mistake, suggesting another method or pointing out my idiocy for not using an obvious idea in the first place! Thanks~ :)

screen shot 2013-11-05 at 11.28.59.png (49.7 kB)
screen shot 2013-11-05 at 11.29.18.png (49.5 kB)
Comment
Add comment
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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

Camera with shader? 2 Answers

URP Swap shader while rendering with camera 0 Answers

effect on clipping plane 1 Answer

Is that possible to create my own custom projector using unity camera 0 Answers

Get distance to camera from CameraDepthTexture 1 Answer


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