Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 vestax_ion · Jul 23, 2011 at 07:25 PM · offsetz-depth

clones bugging with Shader Offset command?

alt text

If you copy and paste 2 planes with a shader "Offset" value (to prevent coplanar pixel jumbling) they have artefacts, same if you clone them, but if you import them both separately through the "browser>GameObject>Create" and give them the same shader the offset works great. So for example you couldn't clone posters on a wall, windows on a house, etc.

I also tried Setting the offset value during clone instantiation, it didn't solve it:

 InstantiateObject.renderer.material.mainTextureOffset = Vector2(-8,-6); 


Here is the shader code that only works in manually placed objects, but fails when you copy the same objects into a shared space.

 Pass {
     Cull Front
         Offset -8,-8
     SetTexture [_MainTex] {
         Combine Primary * Texture
     }

if you test this out, Artefacting is always apparent if the 2 plane objects are rotated like cards. why dont clones take pixel offset commands? do i have to force a "deep copy" in JS:

 panel.renderer.material.mainTexure = Instantiate (panel.renderer.material.mainTexture) as Texture2D;


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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Mortennobel · Jul 24, 2011 at 09:19 AM

I think you are mixing two different offset.

  • The offset in the shader code moves the geometry towards the camera to prevent z-fightling

  • The mainTextureOffset is a UV-mapping offset.

Checkout solutions for z-fighting in the following answer:

http://answers.unity3d.com/questions/27519/z-fighting-problem.html

Comment
Add comment · Show 3 · Share
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 vestax_ion · Jul 24, 2011 at 11:48 AM 0
Share

Thanks $$anonymous$$orten! The ShaderLab "offset" command also doesn't work with clones and copies, because i have been searching for a solution for more than 24 hours now and i tried everything i can amateurishly think of. if you make clones using a shaderlab code with offset -10,-10 etc, it doesnt solve the z fighting at all!

avatar image Mortennobel · Jul 24, 2011 at 12:11 PM 0
Share

But isn't your problem in the picture that you use the same offset on both shaders? To me it looks like it is the same material and shader (I'm guessing here). Besides it is a mystery to me why you are using a offset factor of -8 and not 0? (I have only found Offset 0,-1 useful)

avatar image vestax_ion · Jul 24, 2011 at 01:17 PM 0
Share

That is what i also presumed: Same offset value and shader on 2 objects would make artefacts... However, the same offset value works fine when 2 objects are created in browser and set to same shader, i tried it, but if i copy-paste/clone the same plane the offset solution suddenly is ineffective.

here is jessy demonstrating the advantage of the -8,-8 setting compared to 0,-1 http://www.youtube.com/watch?v=$$anonymous$$lLvQxZv3h4

I will attempt a clear demo of the bug.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How to apply offset to touch position when dragging object 4 Answers

Play(offsetInSamples) acuracy - still cannot get it to work perfectly 5 Answers

SetTextureOffset, small offset skip? 1 Answer

How to make a plane with a texture flicker, as if it was animated? 1 Answer

Shader CG not taking tiling into account 2 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